kamene
kamene copied to clipboard
Automation - Too many open files
When I run a large automation script I'll get this Exception
OSError Traceback (most recent call last)
/usr/local/homebrew/lib/python3.4/site-packages/scapy/sendrecv.py in sr1(x, filter, iface, nofilter, _args, *_kargs) 337 kargs["timeout"] = -1 338 s=conf.L3socket(filter=filter, nofilter=nofilter, iface=iface) --> 339 a,b=sndrcv(s,x,args,*kargs) 340 s.close() 341 if len(a) > 0:
/usr/local/homebrew/lib/python3.4/site-packages/scapy/sendrecv.py in sndrcv(pks, pkt, timeout, inter, verbose, chainCC, retry, multi) 71 timeout = None 72 ---> 73 rdpipe,wrpipe = os.pipe() 74 rdpipe=os.fdopen(rdpipe, "rb") 75 wrpipe=os.fdopen(wrpipe,"wb")
OSError: [Errno 24] Too many open files
The code I'm running:
import string import scapy.all as sc import re import time import sys def testChar(pos,char): ip_layer = sc.IP(dst="192.168.42.223") icmp_layer = sc.ICMP(type=13, seq=pos, id=ord(char)) response = sc.sr1(ip_layer/icmp_layer, verbose=False) raw = str(bytes(response)) if re.search('OK\'d', raw): return True return False flag="" chars = string.ascii_lowercase + '_' for i in range(0,46): time.sleep(5) for c in chars: if testChar(i, c): flag = flag + c print(c) continue
What is your open files limit? Have you tried increasing it? http://posidev.com/blog/2009/06/04/set-ulimit-parameters-on-ubuntu/
I think the open files limit shouldn't be reached at all. Using the same code with python2 works without any problems. My limit is 12288