Package: web-pt
About WebPTWebPT is a library for analyzing and crawling websites, the library is designed to be used by Pentesters and developers to make their code easier.Installationgit clone https://github.com/saharavitan/webpt.gitpython -m pip install webptRecommended Python Version:WebPT currently supportsPython 3The recommended version for Python 3 is>=3.6.xDependencies:WebPT depends on there,requests,bs4,urllib,threadingandtimepython modules.These dependencies can be installed using the requirements file:Installation on Windows:c:\python38\python.exe -m pip install -r requirements.txtInstallation on Linuxsudo pip install -r requirements.txtMake Request AttributesAttributesDescriptionrequestCreate a requestFind FunctionsFunctionsDescriptiontagExports all found objects, some tag must be written in the functionattrExports the value of the attribute from the tagmailsGet mails from sourceRequest Analysis AttributesAttributesDescriptionmethodType of methodprotocolType of protocol (GET, POST...)urlGet urldataReturns the data from the request within a dictionarycookiesReturns the data from the cookies within a dictionaryheadersReturns the data from the headers within a dictionaryparamsReturns the data from the params within a dictionarypathThe path of the urlstatus_codeThe status code of the responseresponseThe content of the responseredirectTo which address the server will redirectSpider AttributesThe spider is a tool that is used to automatically discover new resources (URLs) on a particular Site.AttributesDescriptionlinksExports all links found to the listguiGraphic display of the siteExamplesUsing WebPT as a module in your python scriptsMakeRequest Exampleimportwebptrequest=webpt.make_request(url,method='POST',data="param1=val1&param2=val2").requestimportwebptrequest=webpt.make_request(url).requestSpider Exampleimportwebptget_links=webpt.spider("https://example.com").linksimportwebptprint(webpt.spider("https://example.com").gui)Response Analysis Exampleimportwebpttags=find(source).tag("a")fortagintags:res=tag.attr("href")importwebptmails=find(source).mails()PortScanner Exampleimportwebptports=webpt.scanport(url/ip)importwebptports=webpt.scanport(url/ip,from,to)Request Analysis Exampleimportwebptrequest="""POST /api/scope.php HTTP/1.1Host: example.comConnection: closeContent-Length: 69Cache-Control: max-age=0Upgrade-Insecure-Requests: 1Origin: https://example.comContent-Type: application/x-www-form-urlencodedUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9Sec-Fetch-Site: same-originSec-Fetch-Mode: navigateSec-Fetch-User: ?1Sec-Fetch-Dest: documentReferer: https://example.com/Accept-Encoding: gzip, deflateAccept-Language: he-IL,he;q=0.9,en-US;q=0.8,en;q=0.7Cookie: __cfduid=d77a6a7e8c8303932379a959c941da11a1604046519; PHPSESSID=fpehjl7lamt1akovf990bd2gflcsrf=3dff02bd9e7f4d014ff7218d2f3a80dc&target=https%3A%2F%2Fexample.co.il"""req=webpt.request_analysis(request)method=req.methodprotocol=req.protocolurl=req.urldata=req.dataheaders=req.headersparams=req.paramspath=req.pathstatus_code=req.status_coderesponse=req.responseredirect=req.redirectAuthorSaharAvitanVersionCurrent version is 1.2.7