-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbash.py
More file actions
57 lines (51 loc) · 1.35 KB
/
Copy pathbash.py
File metadata and controls
57 lines (51 loc) · 1.35 KB
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
from pwn import *
import requests
import time
import logging
import threading
import random
import traceback
from log import logger
from log import log
iplist = ['127.0.0.1']
port = 80
Retrys = 10
timeout = 3
def bash(ip):
for j in xrange(Retrys):
try:
ipip = "'" + ip + "'"
p = remote(ipip , port)
except requests.exceptions.ConnectTimeout:
logger.warn("[BASH] [{}] Time out".format(ip))
continue
except:
logger.warn("[BASH] [{}] Unexpected Error when Bash opt".format(ip))
traceback.print_exc()
continue
for i in xrange(Retrys):
try:
p.sendline(opt)
except requests.exceptions.ConnectTimeout:
logger.warn("[BASH] [{}] Time out ".format(ip))
continue
except:
logger.warn("[BASH] [{}] Unexpected Error".format(ip))
traceback.print_exc()
continue
def opt():
threads_bash = []
for ip in iplist:
try:
w = threading.Thread(target=bash, name='thread for %s' % ip, args=(ip,))
w.start()
threads_bash.append(w)
except:
logger.error("Thread error...")
traceback.print_exc()
def main():
while 1:
opt = raw_input("Your opt:")
opt()
if __name__ == '__main__':
main()