Package: hek
HekA python library mostly used for pentesting and automation some tasks.Hek library is not near to be completed It's under constant updates.Installation.pipinstallhekSystem.Get device current username.importhek# get device current usernameuser=hek.system.username()# print usernameprint(user)Request device os name.importhekos_name=hek.system.oname()print(os_name)Download content.You could not add any path and It'll extract the file name from the url.fromhekimportsystem# new file pathpath="dog.jpg"# file urlurl="https://example/dog_picure.jpg"# download contentresult=system.download_content(url=url,path=path)# print resultprint(result)System - process.kill processYou could change the name argument to process pid like (pid="1234"), also you could disable kill with force using force=False.importhek# process namename="chrome.exe"# kill processres=hek.system.process.kill_process(name=name)print(res)Get process PID by process name.fromhekimportsystem# targeted process name\username="chrome.exe"# will return process PID\IDname=system.process.getnamebypid(name=pid)# print process PID\IDprint(name)Get process name by PID.fromhekimportsystem# targeted process PID\idpid="2779"# will return process namename=system.process.getnamebypid(pid=pid)# print process nameprint(name)Proxy usages.Doing http request using tor proxyWith this way you can do all kinds of requests like post/get/options, before using the function you need to setup and run tor bundle you could download it from tor official siteimporthek# request tor sessiontor_session=hek.tor.get_session()# tor get requestresult=tor_session.get("http://httpbin.org/ip").text# print resultprint(result)You may add your host/proxy manually using this way, Identity is your proxy location contain some other info.importhek# adding host manuallyhost="127.0.0.1:9050"# request sessionsession=hek.tor.get_session(host=host)# request your proxy identity..identity=session.identity(host=host)# print proxy identityprint(identity)This code result your proxy identity.Simple function to check if proxy is working.importhekresult=hek.proxy.checkproxy(# function to check if proxy is workingurl="https://github.com/",# targeted urluser_agent="Mozilla/5.0",# user agentproxy="185.61.94.65:61616"#  HTTP/HTTPS proxy)if"Working"inresult:# It'll return Working if It's alive end exception if notprint("Alive proxy")It'll return Working if It's alive end exception if notIp stuff.Code to grab site ip address.importhekurl="github.com"# targeted urlip=hek.ipstuff.siteip(url)# grap ip by urlprint(ip)Code to check if opened port.importhekip="192.168.0.1"# targeted device ip addressport=80# targeted portresult=hek.ipstuff.portscan(ip=ip,port=port,timeout=3)# checking if opened port or notifresult==True:print("Opened port.")elifresult==False:print("Closed port.")Checking if device SSH by device ip.importhekip="192.168.0.1"# targeted device ip addressresult=hek.ipstuff.checkssh(ip)# checking if device is shh by the device ipifresult==True:print("is ssh")elifresult==False:print("isn't ssh")Simple code to check if device is rdp by device ip address.importhekip="192.168.0.1"# targeted device ip addressresult=hek.ipstuff.checkrdp(ip)# checking if device is rdp by the device ip.ifresult==True:print("is rdp")elifresult==False:print("isn't rdp")Simple code to check if ip does exist or not.importhekip="192.168.0.1"# targeted ip addressresult=hek.ipstuff.checkip(ip)# checking if ip exist, It'll return True is exist and False if not.ifresult==True:print("ip exist")elifresult==False:print("ip doesn't exist")It'll return True is exist and False if not.Get public ip.importhek# get ipip=hek.ipstuff.myip(find="query")# print ipprint(ip)you could get your ip information by removing find="query"  also you can change query and get other info about your ip.Server.Check if server port is open.importhek# server ipip="192.168.0.1"# targeted portport=80# checkresult=hek.server.portscan(ip=ip,port=port)print(result)Retrieve server banner.importhek# server ipip="192.168.0.1"# targeted portport=430# checkresult=hek.server.get_banner(address=ip,port=port)print(result)server.set_socket.server.set_socket is a static way like a session that you only need to add the server info once to start sending and receiving data, unlike server.socket which is not static at all.Connect to a server.importhek# server ipip="192.168.0.1"# server portport=80# set server dataserver=hek.server.set_socket(host=ip,port=port)# connect to serverr=server.connect()print(f"connected:{r}")Send packet to a server.importhek# server ipip="192.168.0.1"# server portport=80# set server dataserver=hek.server.set_socket(host=ip,port=port)# connect to serverr=server.connect()print(f"connected:{r}")# the packetpacket="hi im packet"# send packetresult=server.sendpacket()print(result)Receive data from a server.data=server.recv(bufsize=1048)print(data)Close connection.server.close()server.socket.server.socket unlike set_socket It's unstatic better to work with it while using multiple socket's and multithreading.Create a socket.fromhekimportserver# get the server valueserver=server.socket()# create socketsock=server.socket()connect to a server.# connect to a serverresult=server.connect(sock,host="192.168.0.1",port=80)# connection result True if connectedprint(result)send packet.# the packetpacket="im a packet"# send packetresult=server.sendpacket(sock,packet=packet,host="192.168.0.1",port=80)print(result)Receive data.# receive dataserver.recv(sock,bufsize=1048)Close connection.# close connectionserver.close(sock)Network and trafficking.Sniff  and monitor any device traffic on your network.importhek,threading# start sniffing networkdefsniff():hek.network.arp.start_arp(# your interface mostly It'll be wlan0interface="wlan0",# ip of the router that the device is connected torouter="192.168.0.1",# device ip address that you want to sniffdevice="192.168.0.112")# this function will run wireshark according to the entered datadefmonitor_traffic():hek.wireshark.monitor_device(# your interface mostly It'll be wlan0interface="wlan0",# device ip addressdevice="192.168.0.112")threading.Thread(target=monitor_traffic).start()# run wiresharkthreading.Thread(target=sniff).start()# start sniffingYou can use this if you just want to sniff device traffic without needing to open wireshark.importhek# start sniffing networkdefsniff():hek.network.arp.start_arp(# your interface mostly It'll be wlan0interface="wlan0",# ip of the router that the device is connected torouter="192.168.0.1",# device ip address that you want to sniffdevice="192.168.0.112")sniff()Connect to wifi using hek library.This function is for linux also requires wifi adapter.importhek# connect to wifiresult=hek.wifi.connect(ssid="Wifi ssid/Name",# wifi ssid/namepassword="wifi-password"# wifi password)# connection resultprint(result)Start monitor mode.This function for linux.importhek# Start monitor moderesult=hek.net.monitor_start(name="wlan0")# Outputprint(result)Stop monitor mode.This function for linux.importhek# stop monitor moderesult=hek.net.monitor_stop(name="wlan0mon")# Outputprint(result)Recording , videos, images stuff.While recording a video you could display your choice of fps like fps=30 or 60 or higher.Extracting image exif data.importhekdata=hek.Image.extracexif(filename="hek.jpg")# grab exif dataprint(data)# print dataScreen shot.importhekhek.screen.screenshot(filename="test.png")Webcam picture.importhekhek.webcam.webcamshot(filename="test.png")Screen video capture.importhekhek.screen.capture_video(filename="filename.avi",seconds=5)Webcam video capture.importhekhek.webcam.capture_video(filename="webname.avi",seconds=3)This program uses MIT license.