Merge pull request #56 from guardicore/feature/removednet

Remove DNET library.
This commit is contained in:
itaymmguardicore 2017-10-04 10:50:41 +03:00 committed by GitHub
commit d7ce6c2293
2 changed files with 19 additions and 29 deletions

View File

@ -1,25 +1,27 @@
import logging
import ntpath
import os import os
import sys import os.path
import pprint
import socket import socket
import struct import struct
import ntpath import sys
import pprint
import logging
import os.path
import urllib import urllib
import monkeyfs
from difflib import get_close_matches from difflib import get_close_matches
from network import local_ips
from transport import HTTPServer
from network.info import get_free_tcp_port, get_routes
from network.firewall import app as firewall
from impacket.dcerpc.v5 import transport, srvs from impacket.dcerpc.v5 import transport, srvs
from impacket.dcerpc.v5.dcom.wmi import DCERPCSessionError
from impacket.smbconnection import SMBConnection, SMB_DIALECT
from impacket.smb3structs import SMB2_DIALECT_002, SMB2_DIALECT_21
from impacket.dcerpc.v5.dcomrt import DCOMConnection
from impacket.dcerpc.v5.dcom import wmi from impacket.dcerpc.v5.dcom import wmi
from impacket.dcerpc.v5.dcom.wmi import DCERPCSessionError
from impacket.dcerpc.v5.dcomrt import DCOMConnection
from impacket.dcerpc.v5.dtypes import NULL from impacket.dcerpc.v5.dtypes import NULL
from impacket.smb3structs import SMB2_DIALECT_002, SMB2_DIALECT_21
from impacket.smbconnection import SMBConnection, SMB_DIALECT
import monkeyfs
from network import local_ips
from network.firewall import app as firewall
from network.info import get_free_tcp_port, get_routes
from transport import HTTPServer
class DceRpcException(Exception): class DceRpcException(Exception):
@ -387,14 +389,7 @@ class HTTPTools(object):
def get_interface_to_target(dst): def get_interface_to_target(dst):
if sys.platform == "win32": if sys.platform == "win32":
try: return get_close_matches(dst, local_ips())[0]
import dnet
intf = dnet.intf()
inte = intf.get_dst(dnet.addr(dst))
return str(inte['addr']).split("/")[0]
except ImportError:
# dnet lib is not installed
return get_close_matches(dst, local_ips())[0]
else: else:
# based on scapy implementation # based on scapy implementation
@ -476,7 +471,7 @@ def build_monkey_commandline(target_host, depth, location=None):
def report_failed_login(exploiter, machine, user, password='', lm_hash='', ntlm_hash=''): def report_failed_login(exploiter, machine, user, password='', lm_hash='', ntlm_hash=''):
from control import ControlClient from control import ControlClient
telemetry_dict =\ telemetry_dict = \
{'result': False, 'machine': machine.__dict__, 'exploiter': exploiter.__class__.__name__, {'result': False, 'machine': machine.__dict__, 'exploiter': exploiter.__class__.__name__,
'user': user, 'password': password} 'user': user, 'password': password}
if lm_hash: if lm_hash:
@ -492,4 +487,3 @@ def get_binaries_dir_path():
return sys._MEIPASS return sys._MEIPASS
else: else:
return os.path.dirname(os.path.abspath(__file__)) return os.path.dirname(os.path.abspath(__file__))

View File

@ -18,11 +18,7 @@ Windows:
Install the python packages listed in requirements.txt. Using pip install -r requirements.txt Install the python packages listed in requirements.txt. Using pip install -r requirements.txt
7. Download and extract UPX binary to [source-path]\monkey\chaos_monkey\bin\upx.exe: 7. Download and extract UPX binary to [source-path]\monkey\chaos_monkey\bin\upx.exe:
http://upx.sourceforge.net/download/upx391w.zip http://upx.sourceforge.net/download/upx391w.zip
8. (Optional) For some exploits to work better, install 'dnet' python library. You'll need to compile it for your OS 8. Run [source-path]\monkey\chaos_monkey\build_windows.bat to build, output is in dist\monkey.exe
or use a precompiled setup that can be found at:
32bit: https://github.com/Kondziowy/scapy_win64/raw/master/win32/dnet-1.12.win32-py2.7.exe
64bit: https://github.com/Kondziowy/scapy_win64/raw/master/win64/dnet-1.12.win-amd64-py2.7.exe
9. Run [source-path]\monkey\chaos_monkey\build_windows.bat to build, output is in dist\monkey.exe
Linux (Tested on Ubuntu 12.04): Linux (Tested on Ubuntu 12.04):
1. Run: 1. Run: