def main() : try : # port must not be smaller than 1024 server = HTTPServer(('', 8888), WebHandler) print 'started httpserver...\n\nhttp://%s:%s/tests' % ( get_local_ip.get_local_ip(), 8888) server.serve_forever() except KeyboardInterrupt : print '^C received, shutting down server' server.socket.close()
def get_ip_by_domain(domain) : global client_sock if domain.find('gqlapp') > -1 : return get_local_ip.get_local_ip() client_sock = socket.socket() client_sock.connect(('127.0.0.1', 6052)) client_sock.send(domain) ip = client_sock.recv(276) cleanup_client_sock() return ip
def __init__(self, crawler): baseAuditPlugin.__init__(self, crawler) # Internal variables self._error_reported = False # User configured parameters self._rfi_url = '' self._rfi_result = '' self._listen_port = w3afPorts.REMOTEFILEINCLUDE self._listen_address = get_local_ip() or '' self._use_w3af_site = True
def get_ip_by_domain(domain): global client_sock if domain.find('gqlapp') > -1: return get_local_ip.get_local_ip() client_sock = socket.socket() client_sock.connect(('127.0.0.1', 6052)) client_sock.send(domain) ip = client_sock.recv(276) cleanup_client_sock() return ip
def get_net_iface(): ''' This function is very OS dependant. @return: The interface name that is being used to connect to the net. ''' # Get the IP address thats used to go to the Internet internet_ip = get_local_ip() # # I need to have a default in case everything else fails! # ifname = 'eth0' if os.name == "nt": # # TODO: Find out how to do this in Windows! # pass else: # # Linux # import fcntl import struct interfaces = [ "eth0", "eth1", "eth2", "wlan0", "wlan1", "wifi0", "ath0", "ath1", "ppp0" ] for ifname in interfaces: try: s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) interface_ip = socket.inet_ntoa( fcntl.ioctl( s.fileno(), 0x8915, # SIOCGIFADDR struct.pack('256s', ifname[:15]))[20:24]) except IOError: pass else: if internet_ip == interface_ip: break return ifname
def get_current_state_dict(): state_dict = {} state_dict["get_uuid"] = get_uuid.get_uuid() state_dict["get_cursor_pos"] = get_cursor_pos.queryMousePosition() state_dict["get_server_ip"] = get_local_ip.get_local_ip() state_dict["get_server_subnet"] = get_local_ip.get_local_subnet() state_dict["get_mac_addr"] = get_mac_addr.get_mac_addr() if state_dict["get_mac_addr"] in mac_csv: state_dict["port_info"] = mac_csv[state_dict["get_mac_addr"]] else: state_dict["port_info"] = {"room": "room0", "port": 0} room_port = '{}_{}'.format(state_dict["port_info"]["room"], state_dict["port_info"]["port"]) if room_port in pc_remarks: state_dict["pc_remarks"] = pc_remarks[room_port] else: state_dict["pc_remarks"] = {'remarks': '0'} click_state = get_mouse_click.get_click_state() state_dict["key_caplock_on"] = get_key_state.get_caplock_state() == 1 state_dict["key_caplock_off"] = get_key_state.get_caplock_state() == 0 # state_dict["key_scrolllock_on"] = get_key_state.get_scrolllock_state() == 1 state_dict[ "key_scrolllock_on"] = click_state[0] == -127 or click_state[0] == -128 # state_dict["key_scrolllock_off"] = get_key_state.get_scrolllock_state() == 0 state_dict[ "key_scrolllock_off"] = click_state[0] == 0 or click_state[0] == 1 # state_dict["key_numlock_on"] = get_key_state.get_numlock_state() == 1 state_dict[ "key_numlock_on"] = click_state[1] == -127 or click_state[1] == -128 # state_dict["key_numlock_off"] = get_key_state.get_numlock_state() == 0 state_dict["key_numlock_off"] = click_state[1] == 0 or click_state[1] == 1 state_dict["get_read_text_line"] = get_read_text_line.get_read_text_line() state_dict["cpu"] = cpu state_dict["ram"] = ram state_dict["disk"] = disk state_dict["display"] = get_display.get_display() state_dict["display_card"] = display_card state_dict["start_time"] = start_time state_dict["last_update_time"] = datetime.datetime.now().strftime( "%m/%d/%Y, %H:%M:%S") return state_dict
def get_net_iface(): ''' This function is very OS dependant. @return: The interface name that is being used to connect to the net. ''' # Get the IP address thats used to go to the Internet internet_ip = get_local_ip() # # I need to have a default in case everything else fails! # ifname = 'eth0' if os.name == "nt": # # TODO: Find out how to do this in Windows! # pass else: # # Linux # import fcntl import struct interfaces = ["eth0","eth1","eth2","wlan0","wlan1","wifi0","ath0","ath1","ppp0"] for ifname in interfaces: try: s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) interface_ip = socket.inet_ntoa(fcntl.ioctl( s.fileno(), 0x8915, # SIOCGIFADDR struct.pack('256s', ifname[:15]) )[20:24]) except IOError: pass else: if internet_ip == interface_ip: break return ifname
def main() : print '#' * 80 print '' print 'Note that you can only run this service as a root user (sudo su root)' print 'DNS server address is %s' % get_local_ip.get_local_ip() print '' print '#' * 80 print 'start DNS Server frontend' udps = None try : udps = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) udps.bind(('', 53)) while 1 : data, addr = udps.recvfrom(1024) p = DNSQuery(data) ip = get_ip_by_domain(p.domain) print '> Resolve %s (%s)' % (p.domain, ip) udps.sendto(p.request(ip), addr) except KeyboardInterrupt : print 'Finish DNS Server frontend' if udps is not None : udps.close()
def main(): print '#' * 80 print '' print 'Note that you can only run this service as a root user (sudo su root)' print 'DNS server address is %s' % get_local_ip.get_local_ip() print '' print '#' * 80 print 'start DNS Server frontend' udps = None try: udps = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) udps.bind(('', 53)) while 1: data, addr = udps.recvfrom(1024) p = DNSQuery(data) ip = get_ip_by_domain(p.domain) print '> Resolve %s (%s)' % (p.domain, ip) udps.sendto(p.request(ip), addr) except KeyboardInterrupt: print 'Finish DNS Server frontend' if udps is not None: udps.close()
self.sock.send('92.123.65.176') else: self.sock.send('Unable to resolve host ' + domain_name) # Close the client socket self.sock.close() self.sock = None # # Setup the server socket and threads list # server_sock = socket.socket() # Setting this option avoids the TIME_WAIT state so that we can rebind faster server_sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) print 'start DNS server backend %s:6052' % get_local_ip.get_local_ip() server_sock.bind(('127.0.0.1', 6052)) server_sock.listen(2) threads = [] # Keyboard Interrupt handler and cleanup routine def cleanup(*args): print 'Exiting' global server_sock global threads # Close the server socket server_sock.close() server_sock = None
if domain_name.find('akamaihd') > -1 : self.sock.send('92.123.65.176') else : self.sock.send('Unable to resolve host ' + domain_name) # Close the client socket self.sock.close() self.sock = None # # Setup the server socket and threads list # server_sock = socket.socket() # Setting this option avoids the TIME_WAIT state so that we can rebind faster server_sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) print 'start DNS server backend %s:6052' % get_local_ip.get_local_ip() server_sock.bind(('127.0.0.1', 6052)) server_sock.listen(2) threads = [] # Keyboard Interrupt handler and cleanup routine def cleanup(*args) : print 'Exiting' global server_sock global threads # Close the server socket server_sock.close() server_sock = None
import asyncio import sys import typing import logging import webbrowser import pyqrcode import app_websocket import win32_volume_utils from win32_volume_utils import (VolumeController, get_process_displayed_name) from get_local_ip import get_local_ip APP_HOST = get_local_ip(mode='v4') APP_PORT = 8080 USER_INTERFACE = "http://{}:{}".format(APP_HOST, APP_PORT) # -------------- initial echo print('/*******************************************') print(' * HELLO KUZYA *') print(' * THIS IS YOUR URL *') print(f' ----> {USER_INTERFACE} <---- ') print(' *******************************************/') print('') print('') print('') url = pyqrcode.create(USER_INTERFACE) url.png('kuzya_volume_slider.png',
''' @return: Returns the data that was saved to the variableName ''' res = None if variableName in self._cf.keys(): res = self._cf[ variableName ] return res cf = config() # These default configs are taken from miscSettings.py cf.save('fuzzableCookie', False ) cf.save('fuzzFileContent', True ) cf.save('fuzzFileName', False ) cf.save('fuzzFCExt', 'txt' ) cf.save('fuzzFormComboValues', 'tmb') cf.save('autoDependencies', True ) cf.save('maxDiscoveryTime', 120 ) cf.save('maxThreads', 15 ) cf.save('fuzzableHeaders', [] ) cf.save('msf_location', '/opt/metasploit3/bin/' ) ifname = get_net_iface() cf.save('interface', ifname ) local_address = get_local_ip() if not local_address: local_address = '127.0.0.1' #do'h! cf.save('localAddress', local_address) cf.save('demo', False ) cf.save('nonTargets', [] ) cf.save('exportFuzzableRequests', '') cf.save('targetOS', 'unix')