Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sashachabin/ecfeaaa586d82f3b31ae36fb4bea92e0 to your computer and use it in GitHub Desktop.
Save sashachabin/ecfeaaa586d82f3b31ae36fb4bea92e0 to your computer and use it in GitHub Desktop.
УрФУ. Отправка POST-запроса, перехват трафика с помощью tcpdump
import requests
import json
request = {
"github": "a-chabin",
"Name": "Alexander",
"Surname": "Chabin"
}
json_request = json.dumps(request)
response = requests.post("http://httpbin.org/post", json_request)
------------------------------------------------
Ответ сервера:
HTTP/1.1 200 OK
Connection: keep-alive
Server: meinheld/0.6.1
Date: Sat, 07 Oct 2017 18:17:37 GMT
Content-Type: application/json
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
X-Powered-By: Flask
X-Processed-Time: 0.000799179077148
Content-Length: 513
Via: 1.1 vegur
{
"args": {},
"data": "{\"Surname\": \"Chabin\", \"Name\": \"Alexander\", \"github\": \"a-chabin\"}",
"files": {},
"form": {},
"headers": {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate",
"Connection": "close",
"Content-Length": "64",
"Host": "httpbin.org",
"User-Agent": "python-requests/2.10.0"
},
"json": {
"Name": "Alexander",
"Surname": "Chabin",
"github": "a-chabin"
},
"origin": "87.224.209.39",
"url": "http://httpbin.org/post"
}
------------------------------------------------
Результат работы утилиты tcpdump:
tcpdump: listening on wlp8s0, link-type EN10MB (Ethernet), capture size 262144 bytes
23:17:37.348067 IP (tos 0x0, ttl 64, id 63231, offset 0, flags [DF], proto TCP (6), length 60)
linux.44730 > ec2-174-129-214-98.compute-1.amazonaws.com.http: Flags [S], cksum 0xfb49 (correct), seq 1924614509, win 29200, options [mss 1460,sackOK,TS val 3745466948 ecr 0,nop,wscale 7], length 0
E..<..@.@......f...b...Pr.Im......r..I.........
.?JD........
23:17:37.434416 IP (tos 0x0, ttl 1, id 1353, offset 0, flags [DF], proto TCP (6), length 60)
linux.43988 > ec2-174-129-214-98.compute-1.amazonaws.com.hostmon: Flags [S], cksum 0x3209 (correct), seq 3098327790, win 29200, options [mss 1460,sackOK,TS val 3745466969 ecr 0,nop,wscale 7], length 0
E..<.I@........f...b..............r.2 .........
.?JY........
23:17:37.506800 IP (tos 0x0, ttl 231, id 0, offset 0, flags [DF], proto TCP (6), length 60)
ec2-174-129-214-98.compute-1.amazonaws.com.http > linux.44730: Flags [S.], cksum 0x7637 (correct), seq 509246351, ack 1924614510, win 26847, options [mss 1380,sackOK,TS val 284025770 ecr 3745466948,nop,wscale 8], length 0
E..<..@...M....b...f.P...Z{.r.In..h.v7.....d...
.....?JD....
23:17:37.506892 IP (tos 0x0, ttl 64, id 63232, offset 0, flags [DF], proto TCP (6), length 52)
linux.44730 > ec2-174-129-214-98.compute-1.amazonaws.com.http: Flags [.], cksum 0x0c88 (correct), seq 1, ack 1, win 229, options [nop,nop,TS val 3745466987 ecr 284025770], length 0
E..4..@.@......f...b...Pr.In.Z{............
.?Jk....
23:17:37.507215 IP (tos 0x0, ttl 64, id 63233, offset 0, flags [DF], proto TCP (6), length 219)
linux.44730 > ec2-174-129-214-98.compute-1.amazonaws.com.http: Flags [P.], cksum 0xdf08 (correct), seq 1:168, ack 1, win 229, options [nop,nop,TS val 3745466987 ecr 284025770], length 167: HTTP, length: 167
POST /post HTTP/1.1
Host: httpbin.org
User-Agent: python-requests/2.10.0
Connection: keep-alive
Accept: */*
Accept-Encoding: gzip, deflate
Content-Length: 64
E.....@.@..(...f...b...Pr.In.Z{............
.?Jk....POST /post HTTP/1.1
Host: httpbin.org
User-Agent: python-requests/2.10.0
Connection: keep-alive
Accept: */*
Accept-Encoding: gzip, deflate
Content-Length: 64
23:17:37.507430 IP (tos 0x0, ttl 64, id 63234, offset 0, flags [DF], proto TCP (6), length 116)
linux.44730 > ec2-174-129-214-98.compute-1.amazonaws.com.http: Flags [P.], cksum 0xbcf2 (correct), seq 168:232, ack 1, win 229, options [nop,nop,TS val 3745466987 ecr 284025770], length 64: HTTP
E..t..@.@......f...b...Pr.J..Z{............
.?Jk....{"Surname": "Chabin", "Name": "Alexander", "github": "a-chabin"}
23:17:37.666365 IP (tos 0x0, ttl 231, id 38978, offset 0, flags [DF], proto TCP (6), length 52)
ec2-174-129-214-98.compute-1.amazonaws.com.http > linux.44730: Flags [.], cksum 0x0c30 (correct), seq 1, ack 168, win 110, options [nop,nop,TS val 284025810 ecr 3745466987], length 0
E..4.B@........b...f.P...Z{.r.J....n.0.....
.....?Jk
23:17:37.666533 IP (tos 0x0, ttl 231, id 38979, offset 0, flags [DF], proto TCP (6), length 52)
ec2-174-129-214-98.compute-1.amazonaws.com.http > linux.44730: Flags [.], cksum 0x0bf0 (correct), seq 1, ack 232, win 110, options [nop,nop,TS val 284025810 ecr 3745466987], length 0
E..4.C@........b...f.P...Z{.r.JU...n.......
.....?Jk
23:17:37.670267 IP (tos 0x0, ttl 231, id 38980, offset 0, flags [DF], proto TCP (6), length 868)
ec2-174-129-214-98.compute-1.amazonaws.com.http > linux.44730: Flags [P.], cksum 0x29c5 (correct), seq 1:817, ack 232, win 110, options [nop,nop,TS val 284025811 ecr 3745466987], length 816: HTTP, length: 816
HTTP/1.1 200 OK
Connection: keep-alive
Server: meinheld/0.6.1
Date: Sat, 07 Oct 2017 18:17:37 GMT
Content-Type: application/json
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
X-Powered-By: Flask
X-Processed-Time: 0.000799179077148
Content-Length: 513
Via: 1.1 vegur
{
"args": {},
"data": "{\"Surname\": \"Chabin\", \"Name\": \"Alexander\", \"github\": \"a-chabin\"}",
"files": {},
"form": {},
"headers": {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate",
"Connection": "close",
"Content-Length": "64",
"Host": "httpbin.org",
"User-Agent": "python-requests/2.10.0"
},
"json": {
"Name": "Alexander",
"Surname": "Chabin",
"github": "a-chabin"
},
"origin": "87.224.209.39",
"url": "http://httpbin.org/post"
}
E..d.D@....\...b...f.P...Z{.r.JU...n)......
.....?JkHTTP/1.1 200 OK
Connection: keep-alive
Server: meinheld/0.6.1
Date: Sat, 07 Oct 2017 18:17:37 GMT
Content-Type: application/json
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
X-Powered-By: Flask
X-Processed-Time: 0.000799179077148
Content-Length: 513
Via: 1.1 vegur
{
"args": {},
"data": "{\"Surname\": \"Chabin\", \"Name\": \"Alexander\", \"github\": \"a-chabin\"}",
"files": {},
"form": {},
"headers": {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate",
"Connection": "close",
"Content-Length": "64",
"Host": "httpbin.org",
"User-Agent": "python-requests/2.10.0"
},
"json": {
"Name": "Alexander",
"Surname": "Chabin",
"github": "a-chabin"
},
"origin": "87.224.209.39",
"url": "http://httpbin.org/post"
}
23:17:37.670353 IP (tos 0x0, ttl 64, id 63235, offset 0, flags [DF], proto TCP (6), length 52)
linux.44730 > ec2-174-129-214-98.compute-1.amazonaws.com.http: Flags [.], cksum 0x0813 (correct), seq 232, ack 817, win 241, options [nop,nop,TS val 3745467028 ecr 284025811], length 0
E..4..@.@......f...b...Pr.JU.Z~............
.?J.....
23:17:37.672687 IP (tos 0x0, ttl 64, id 63236, offset 0, flags [DF], proto TCP (6), length 52)
linux.44730 > ec2-174-129-214-98.compute-1.amazonaws.com.http: Flags [F.], cksum 0x0811 (correct), seq 232, ack 817, win 241, options [nop,nop,TS val 3745467029 ecr 284025811], length 0
E..4..@.@......f...b...Pr.JU.Z~............
.?J.....
23:17:37.831895 IP (tos 0x0, ttl 231, id 38981, offset 0, flags [DF], proto TCP (6), length 52)
ec2-174-129-214-98.compute-1.amazonaws.com.http > linux.44730: Flags [F.], cksum 0x086b (correct), seq 817, ack 233, win 110, options [nop,nop,TS val 284025851 ecr 3745467029], length 0
E..4.E@........b...f.P...Z~.r.JV...n.k.....
.....?J.
23:17:37.831960 IP (tos 0x0, ttl 64, id 63237, offset 0, flags [DF], proto TCP (6), length 52)
linux.44730 > ec2-174-129-214-98.compute-1.amazonaws.com.http: Flags [.], cksum 0x07c0 (correct), seq 233, ack 818, win 241, options [nop,nop,TS val 3745467069 ecr 284025851], length 0
E..4..@.@......f...b...Pr.JV.Z~............
.?J.....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment