Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 22b568a

Browse files
committed
handle scapy dependency issues
1 parent 7991d90 commit 22b568a

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

hacklib.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@
2020

2121
import socket, httplib, threading, time, urllib2, os
2222
from Queue import Queue
23+
try: from scapy.all import *
24+
except: raise MissingPackageException('Please install scapy to continue.')
2325
import logging
2426
logging.getLogger("scapy.runtime").setLevel(logging.ERROR) # Fixes scapy logging error
25-
from scapy.all import * # Required for the Probe Request Class
2627
from string import ascii_uppercase, ascii_lowercase, digits # Import for PatternCreate and PatternOffset
2728

2829
class Backdoor(object):
@@ -563,15 +564,14 @@ def getProxies(country_filter = 'ALL', proxy_type = ('Socks4', 'Socks5')):
563564

564565
def installDependencies():
565566
import subprocess
566-
try:
567-
mech = subprocess.check_output(['/usr/local/bin/pip', 'install', 'mechanize'])
568-
if 'successfully installed' in mech: print 'Installed mechanize'
569-
beaut = subprocess.check_output(['/usr/local/bin/pip', 'install', 'bs4'])
570-
if 'successfully installed' in beaut: print 'Installed beautifulsoup'
571-
scapy = subprocess.check_output(['/usr/local/bin/pip', 'install', 'scapy'])
572-
if 'successfully installed' in beaut: print 'Installed scapy'
573-
except:
574-
raise MissingPipException('Could not find pip.')
567+
mech = subprocess.check_output(['/usr/local/bin/pip', 'install', 'mechanize'])
568+
if 'successfully installed' in mech: print 'Installed mechanize'
569+
beaut = subprocess.check_output(['/usr/local/bin/pip', 'install', 'bs4'])
570+
if 'successfully installed' in beaut: print 'Installed beautifulsoup'
571+
scapy = subprocess.check_output(['/usr/local/bin/pip', 'install', 'scapy'])
572+
if 'successfully installed' in scapy: print 'Installed scapy'
573+
pcapy = subprocess.check_output(['/usr/local/bin/pip', 'install', 'pcapy'])
574+
if 'successfully installed' in pcapy: print 'Installed pcapy'
575575

576576
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
577577
def send(IP, port, message, keepalive = False):
@@ -1110,10 +1110,11 @@ def generate(self):
11101110
11111111
"""
11121112

1113-
11141113
class PatternOffset:
11151114

11161115
def __init__(self, search_pattern):
1116+
1117+
11171118

11181119
self.search_pattern = search_pattern
11191120

0 commit comments

Comments
 (0)