-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathpeekaboo.py
110 lines (94 loc) · 2.93 KB
/
peekaboo.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/usr/bin/env python3
'''
This tool allows one to enable remote desktop service on a remote machine.
Author: Viral Maniar
Twitter: https://twitter.com/maniarviral
Github: https://github.com/Viralmaniar
LinkedIn: https://au.linkedin.com/in/viralmaniar
[+] Python version: 3.6.3
[+] PowerShell version: 5.1
'''
import os, sys
import subprocess
from subprocess import check_output
def logo():
logo = '''
\\\|// [+] Author: Viral Maniar
(o o) [+] Twitter: @ManiarViral
~~~~oOOo~(_)~oOOo~~~~
______ _ ___ ______
| ___ \ | | / _ \ | ___ \
| |_/ /__ ___| | ________/ /_\ \______| |_/ / ___ ___
| __/ _ \/ _ \ |/ /______| _ |______| ___ \/ _ \ / _ \
| | | __/ __/ < | | | | | |_/ / (_) | (_) |
\_| \___|\___|_|\_\ \_| |_/ \____/ \___/ \___/
'''
return logo
OPTIONS = '''
1. Set Execution Policy to Unrestricted
2. Enable Remote Desktop Service
3. Disable Remote Desktop Service
4. Exit
'''
def menu():
while True:
try:
choice = str(input('\n[?] Do you want to continue? \n> ')).lower()
if choice[0] == 'y':
return
if choice[0] == 'n':
sys.exit(0)
break
except ValueError:
sys.exit(0)
def checkHostWindows():
if os.name == "nt":
print ('[+] All good....')
else:
print ('[!] Please run the application on Windows machine')
sys.exit(0)
def cmd_exectionPolicy():
process=subprocess.Popen(["powershell","Set-ExecutionPolicy Unrestricted -Scope CurrentUser"], shell=False);
result=process.communicate()[0]
print ("[!] Execution Policy is now set to unrestricted.")
def cmd_enableRDP():
process=subprocess.Popen(["powershell",".\\rdpe.ps1"], shell=False);
result1=process.communicate()[0]
print("Port scanning...")
process=subprocess.Popen(["powershell",".\\testconnection.ps1"], shell=False);
result3=process.communicate()[0]
print(result3)
print ("[!]RDP settings enabled on a remote machine.")
def cmd_disableRDP():
process=subprocess.Popen(["powershell",".\\rdpd.ps1"], shell=False);
result2=process.communicate()[0]
print(result2)
process=subprocess.Popen(["powershell",".\\testconnection.ps1"], shell=False);
result4=process.communicate()[0]
print(result4)
print ("[!]RDP settings disbaled on a remote machine.")
cmds = {
"1" : cmd_exectionPolicy,
"2" : cmd_enableRDP,
"3" : cmd_disableRDP,
"4" : lambda: sys.exit(0)
}
def main():
os.system('cls')
print (logo())
checkHostWindows()
try:
while True:
choice = input("\n%s" % OPTIONS)
if choice not in cmds:
print ('[!] Invalid Choice')
continue
cmds.get(choice)()
except KeyboardInterrupt:
print ('[!] Ctrl + C detected\n[!] Exiting')
sys.exit(0)
except EOFError:
print ('[!] Ctrl + D detected\n[!] Exiting')
sys.exit(0)
if __name__ == "__main__":
main()