Last active
January 8, 2017 22:13
-
-
Save bityob/9a04666ab3c32efbe09ca70945cd7612 to your computer and use it in GitHub Desktop.
Print http conversation from pcap file using Scapy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| GET / HTTP/1.1 | |
| Host: ifconfig.co | |
| User-Agent: curl/7.47.0 | |
| Accept: */* | |
| HTTP/1.1 200 OK | |
| Server: nginx | |
| Date: Sun, 08 Jan 2017 20:01:11 GMT | |
| Content-Type: text/plain; charset=utf-8 | |
| Content-Length: 14 | |
| Connection: keep-alive | |
| Strict-Transport-Security: max-age=31536000; includeSubdomains; preload | |
| 66.77.120.171 | |
| GET /json HTTP/1.1 | |
| Host: ifconfig.co | |
| User-Agent: curl/7.47.0 | |
| Accept: */* | |
| HTTP/1.1 429 | |
| Server: nginx | |
| Date: Sun, 08 Jan 2017 20:01:17 GMT | |
| Content-Type: text/plain | |
| Content-Length: 22 | |
| Connection: keep-alive | |
| 429 Too Many Requests | |
| GET /port/8080 HTTP/1.1 | |
| Host: ifconfig.co | |
| User-Agent: curl/7.47.0 | |
| Accept: */* | |
| HTTP/1.1 200 OK | |
| Server: nginx | |
| Date: Sun, 08 Jan 2017 20:01:39 GMT | |
| Content-Type: application/json | |
| Content-Length: 52 | |
| Connection: keep-alive | |
| Vary: Accept-Encoding | |
| Strict-Transport-Security: max-age=31536000; includeSubdomains; preload | |
| {"ip":"66.77.120.171","port":8080,"reachable":false} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from scapy.all import * | |
| import sys | |
| pcap_file = sys.argv[1] | |
| pckt = rdpcap(pcap_file) | |
| for p in pckt: | |
| if (p.dport == 80 or p.sport == 80): | |
| flags = p.sprintf("%TCP.flags%") | |
| if flags == 'PA': | |
| print p.load |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ScapyCheatSheet | |
| - https://blogs.sans.org/pen-testing/files/2016/04/ScapyCheatSheet_v0.2.pdf | |
| Black Hat Python: Infinite possibilities with the Scapy Module | |
| - http://bt3gl.github.io/black-hat-python-infinite-possibilities-with-the-scapy-module.html | |
| Scapy Guide | |
| - https://theitgeekchronicles.files.wordpress.com/2012/05/scapyguide1.pdf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment