Skip to content
Snippets Groups Projects
Commit 525229c2 authored by Phil's avatar Phil
Browse files

Broke an import loop

parent 16651631
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
import cPickle,os,sys,time,subprocess import cPickle,os,sys,time,subprocess
from select import select from select import select
from data import * from data import *
from arch import * import arch
from config import conf from config import conf
from packet import Gen from packet import Gen
from utils import warning,get_temp_file,PcapReader from utils import warning,get_temp_file,PcapReader
...@@ -117,7 +117,7 @@ def sndrcv(pks, pkt, timeout = None, inter = 0, verbose=None, chainCC=0, retry=0 ...@@ -117,7 +117,7 @@ def sndrcv(pks, pkt, timeout = None, inter = 0, verbose=None, chainCC=0, retry=0
if remaintime <= 0: if remaintime <= 0:
break break
r = None r = None
if FREEBSD or DARWIN: if arch.FREEBSD or arch.DARWIN:
inp, out, err = select(inmask,[],[], 0.05) inp, out, err = select(inmask,[],[], 0.05)
if len(inp) == 0 or pks in inp: if len(inp) == 0 or pks in inp:
r = pks.nonblock_recv() r = pks.nonblock_recv()
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
import socket,time import socket,time
from config import conf from config import conf
from data import * from data import *
from sendrecv import sndrcv
class _SuperSocket_metaclass(type): class _SuperSocket_metaclass(type):
def __repr__(self): def __repr__(self):
...@@ -42,15 +41,15 @@ class SuperSocket: ...@@ -42,15 +41,15 @@ class SuperSocket:
if self.ins and self.ins.fileno() != -1: if self.ins and self.ins.fileno() != -1:
self.ins.close() self.ins.close()
def sr(self, *args, **kargs): def sr(self, *args, **kargs):
return sndrcv(self, *args, **kargs) return sendrecv.sndrcv(self, *args, **kargs)
def sr1(self, *args, **kargs): def sr1(self, *args, **kargs):
a,b = sndrcv(self, *args, **kargs) a,b = sendrecv.sndrcv(self, *args, **kargs)
if len(a) > 0: if len(a) > 0:
return a[0][1] return a[0][1]
else: else:
return None return None
def sniff(self, *args, **kargs): def sniff(self, *args, **kargs):
return sniff(opened_socket=self, *args, **kargs) return sendrecv.sniff(opened_socket=self, *args, **kargs)
class L3RawSocket(SuperSocket): class L3RawSocket(SuperSocket):
desc = "Layer 3 using Raw sockets (PF_INET/SOCK_RAW)" desc = "Layer 3 using Raw sockets (PF_INET/SOCK_RAW)"
...@@ -102,3 +101,5 @@ class StreamSocket(SimpleSocket): ...@@ -102,3 +101,5 @@ class StreamSocket(SimpleSocket):
if conf.L3socket is None: if conf.L3socket is None:
conf.L3socket = L3RawSocket conf.L3socket = L3RawSocket
import sendrecv
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment