Skip to content

Commit

Permalink
example of requesting with cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
Qianlitp committed Jan 10, 2020
1 parent e119117 commit 7837691
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions examples/request_with_cookie.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/python3
# coding: utf-8

import simplejson
import subprocess
"""
添加Cookie扫描示例
命令行调用时:
./crawlergo -c /home/test/chrome-linux/chrome -o json --ignore-url-keywords quit,exit,zhuxiao --custom-headers "{\"Cookie\": \"crawlergo=Cool\"}"
使用 --ignore-url-keywords 添加你想要的排除的关键字,避免访问注销请求
"""


def main():
target = "http://testphp.vulnweb.com/"
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/74.0.3945.0 Safari/537.36",
"Cookie": "crawlergo=Cool"
}
cmd = ["./crawlergo", "-c", "/home/test/chrome-linux/chrome",
"-o", "json", "--ignore-url-keywords", "quit,exit,zhuxiao", "--custom-headers", simplejson.dumps(headers),
target]

rsp = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output, error = rsp.communicate()

result = simplejson.loads(output.decode().split("--[Mission Complete]--")[1])
req_list = result["req_list"]
for each in req_list:
print(each)


if __name__ == '__main__':
main()





0 comments on commit 7837691

Please sign in to comment.