def get_main_page_url(urlparameter, strDestPath, strMD5):
url = 'https://www.hybrid-analysis.com'
session = requests.Session()
# getting csrf value
response = session.get(url)
soup = bs4.BeautifulSoup(response.content)
form = soup.form
csrf = form.find('input', attrs = {'name':'query'})
## csrf1 = form.find('input', attrs ={'name': 'search'}).get('value')
# logging in
data = {
'query' : strMD5,
'name' : csrf
}
response = session.post(urlparameter, data = data)
soup = bs4.BeautifulSoup(response.content)
print(soup)
data = get_mal_page_urls(soup)
links = []
for link in data:
if len(link) > 20:
link = base_url + link
links.append(link)
isDownloaded = True
for link in links:
if (isDownloaded):
response = session.get(link)
soup = bs4.BeautifulSoup(response.content)
if(None != soup.find('section', id='file').find('table')('tr')[-1].a):
link = soup.find('section', id='file').find('table')('tr')[-1].a.get('href')
link = base_url + link
isDownloaded =False
webFile = session.get(link)
## filename =link.split('/')[-2]
filename = strDestPath + strMD5
localFile = open(filename, 'wb')
localFile.write(webFile.content)
webFile.close()
localFile.close()
print(filename+" file written successfully")
def main():
arg1 = sys.argv[1]
arg2 = sys.argv[2]
url = 'https://www.hybrid-analysis.com/search/'
get_main_page_url(url, arg1, arg2)
我之前为其他网站发布了相同的问题,但
malwr.com
网站上有一个用于搜索的crftoken 在这里,我想搜索给网址中提到的网站的MD5并下载文件 在这里,我无法在搜索框中发布MD5,无法进入下一页,我可以找到下载链接,然后可以下载文件