-
Notifications
You must be signed in to change notification settings - Fork 4
/
configWindows.py
38 lines (32 loc) · 1.17 KB
/
configWindows.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import os
import os.path
import mmap
#--------------creating an Alias-------------
#alias.cmd
exist=os.path.isfile("alias.cmd")
if not exist:
os.system("echo.>alias.cmd")
aliasWrite=open("alias.cmd","r+")
s = mmap.mmap(aliasWrite.fileno(), 0, access=mmap.ACCESS_READ)
if s.find('doskey') == -1:
aliasWrite.write("doskey comit =python c:\Windows\ComIt\\runWithoutRequests.py $*")
#regAlias.reg
exist=os.path.isfile("regAlias.reg")
if not exist:
os.system("echo.>regAlias.reg")
regAliasWrite=open("regAlias.reg","r+")
s1 = mmap.mmap(regAliasWrite.fileno(), 0, access=mmap.ACCESS_READ)
if s1.find('doskey') == -1:
regAliasWrite.write("""Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
\"AutoRun\"=\"c:\\\Windows\\\ComIt\\\\alias.cmd\" """)
#making dir to c:\windows\comit
os.system("mkdir c:\Windows\ComIt")
#coping from desktop to c:\Windows\ComIt
current_dir=os.getcwd()
copy_from=current_dir+"\*"
command_to_copy="copy "+copy_from+" c:\Windows\ComIt"
#os.system("copy %userprofile%\Downloads\ComIt-master\* c:\Windows\ComIt")
os.system(command_to_copy)
#registring the command or making alias
os.system("c:\\Windows\\ComIt\\regAlias.reg")