PYTHON_PROGRAMMING_CHALLENGES Telegram 35
После моего доклада на python fwdays обещал рассказать как пользоваться tcpdump:

Andrii Soldatenko, [18.05.20 13:15]
tcpdump example:
1. Я запустил postgresql в докере и пробросли порт в систему (5432)
f9284723a810 postgres "docker-entrypoint.s…" 2 days ago Up 2 days 0.0.0.0:5432->5432
2. запускаем tcpdump:
sudo tcpdump -i lo0 -nX dst port 5432
важный параметр:
-X print data of each packet in hex and ascii

3. Логинимся
PGPASSWORD=postgres psql -U postgres -h localhost
4. То что видим в tcpdump output (некоторые пакеты я пропустил):
13:09:25.020387 IP6 ::1.62337 > ::1.5432: Flags [P.], seq 8:92, ack 2, win 6371, options [nop,nop,TS val 962074756 ecr 962074756], length 84
0x0000: 6004 334d 0074 0640 0000 0000 0000 0000 `.3M.t.@........
0x0010: 0000 0000 0000 0001 0000 0000 0000 0000 ................
0x0020: 0000 0000 0000 0001 f381 1538 3b74 c631 ...........8;t.1
0x0030: b72a e9e7 8018 18e3 007c 0000 0101 080a .*.......|......
0x0040: 3958 1884 3958 1884 0000 0054 0003 0000 9X..9X.....T....
0x0050: 7573 6572 0070 6f73 7467 7265 7300 6461 user.postgres.da
0x0060: 7461 6261 7365 0070 6f73 7467 7265 7300 tabase.postgres.
0x0070: 6170 706c 6963 6174 696f 6e5f 6e61 6d65 application_name
0x0080: 0070 7371 6c00 636c 6965 6e74 5f65 6e63 .psql.client_enc
0x0090: 6f64 696e 6700 5554 4638 0000 oding.UTF8..
1

13:09:25.022436 IP6 ::1.62337 > ::1.5432: Flags [P.], seq 92:133, ack 15, win 6371, options [nop,nop,TS val 962074758 ecr 962074758], length 41
0x0000: 6004 334d 0049 0640 0000 0000 0000 0000 `.3M.I.@........
0x0010: 0000 0000 0000 0001 0000 0000 0000 0000 ................
0x0020: 0000 0000 0000 0001 f381 1538 3b74 c685 ...........8;t..
0x0030: b72a e9f4 8018 18e3 0051 0000 0101 080a .*.......Q......
0x0040: 3958 1886 3958 1886 7000 0000 286d 6435 9X..9X..p...(md5
0x0050: 6234 3339 6532 3464 3065 6231 3861 3635 b439e24d0eb18a65
0x0060: 6431 6563 3039 6438 3231 3333 3665 6565 d1ec09d821336eee
0x0070: 00 .
1
Далее все завист от того как настроен ваш сервер БД (https://www.postgresql.org/docs/9.1/auth-pg-hba-conf.html)
у меня это md5 - Require the client to supply an MD5-encrypted password for authentication. See Section 19.3.2 for details.
13:09:25.022436 IP6 ::1.62337 > ::1.5432: Flags [P.], seq 92:133, ack 15, win 6371, options [nop,nop,TS val 962074758 ecr 962074758], length 41
0x0000: 6004 334d 0049 0640 0000 0000 0000 0000 `.3M.I.@........
0x0010: 0000 0000 0000 0001 0000 0000 0000 0000 ................
0x0020: 0000 0000 0000 0001 f381 1538 3b74 c685 ...........8;t..
0x0030: b72a e9f4 8018 18e3 0051 0000 0101 080a .*.......Q......
0x0040: 3958 1886 3958 1886 7000 0000 286d 6435 9X..9X..p...(md5
0x0050: 6234 3339 6532 3464 3065 6231 3861 3635 b439e24d0eb18a65
0x0060: 6431 6563 3039 6438 3231 3333 3665 6565 d1ec09d821336eee
0x0070: 00 .
1
но бывает там стоит password - Require the client to supply an unencrypted password for authentication =)



tgoop.com/python_programming_challenges/35
Create:
Last Update:

После моего доклада на python fwdays обещал рассказать как пользоваться tcpdump:

Andrii Soldatenko, [18.05.20 13:15]
tcpdump example:
1. Я запустил postgresql в докере и пробросли порт в систему (5432)
f9284723a810 postgres "docker-entrypoint.s…" 2 days ago Up 2 days 0.0.0.0:5432->5432
2. запускаем tcpdump:

sudo tcpdump -i lo0 -nX dst port 5432
важный параметр:
-X print data of each packet in hex and ascii

3. Логинимся
PGPASSWORD=postgres psql -U postgres -h localhost
4. То что видим в tcpdump output (некоторые пакеты я пропустил):
13:09:25.020387 IP6 ::1.62337 > ::1.5432: Flags [P.], seq 8:92, ack 2, win 6371, options [nop,nop,TS val 962074756 ecr 962074756], length 84
0x0000: 6004 334d 0074 0640 0000 0000 0000 0000 `.3M.t.@........
0x0010: 0000 0000 0000 0001 0000 0000 0000 0000 ................
0x0020: 0000 0000 0000 0001 f381 1538 3b74 c631 ...........8;t.1
0x0030: b72a e9e7 8018 18e3 007c 0000 0101 080a .*.......|......
0x0040: 3958 1884 3958 1884 0000 0054 0003 0000 9X..9X.....T....
0x0050: 7573 6572 0070 6f73 7467 7265 7300 6461 user.postgres.da
0x0060: 7461 6261 7365 0070 6f73 7467 7265 7300 tabase.postgres.
0x0070: 6170 706c 6963 6174 696f 6e5f 6e61 6d65 application_name
0x0080: 0070 7371 6c00 636c 6965 6e74 5f65 6e63 .psql.client_enc
0x0090: 6f64 696e 6700 5554 4638 0000 oding.UTF8..
1

13:09:25.022436 IP6 ::1.62337 > ::1.5432: Flags [P.], seq 92:133, ack 15, win 6371, options [nop,nop,TS val 962074758 ecr 962074758], length 41
0x0000: 6004 334d 0049 0640 0000 0000 0000 0000 `.3M.I.@........
0x0010: 0000 0000 0000 0001 0000 0000 0000 0000 ................
0x0020: 0000 0000 0000 0001 f381 1538 3b74 c685 ...........8;t..
0x0030: b72a e9f4 8018 18e3 0051 0000 0101 080a .*.......Q......
0x0040: 3958 1886 3958 1886 7000 0000 286d 6435 9X..9X..p...(md5
0x0050: 6234 3339 6532 3464 3065 6231 3861 3635 b439e24d0eb18a65
0x0060: 6431 6563 3039 6438 3231 3333 3665 6565 d1ec09d821336eee
0x0070: 00 .
1
Далее все завист от того как настроен ваш сервер БД (https://www.postgresql.org/docs/9.1/auth-pg-hba-conf.html)
у меня это md5 - Require the client to supply an MD5-encrypted password for authentication. See Section 19.3.2 for details.
13:09:25.022436 IP6 ::1.62337 > ::1.5432: Flags [P.], seq 92:133, ack 15, win 6371, options [nop,nop,TS val 962074758 ecr 962074758], length 41
0x0000: 6004 334d 0049 0640 0000 0000 0000 0000 `.3M.I.@........
0x0010: 0000 0000 0000 0001 0000 0000 0000 0000 ................
0x0020: 0000 0000 0000 0001 f381 1538 3b74 c685 ...........8;t..
0x0030: b72a e9f4 8018 18e3 0051 0000 0101 080a .*.......Q......
0x0040: 3958 1886 3958 1886 7000 0000 286d 6435 9X..9X..p...(md5
0x0050: 6234 3339 6532 3464 3065 6231 3861 3635 b439e24d0eb18a65
0x0060: 6431 6563 3039 6438 3231 3333 3665 6565 d1ec09d821336eee
0x0070: 00 .
1
но бывает там стоит password - Require the client to supply an unencrypted password for authentication =)

BY 🇺🇦 Python Programming Сhallenges


Share with your friend now:
tgoop.com/python_programming_challenges/35

View MORE
Open in Telegram


Telegram News

Date: |

Telegram message that reads: "Bear Market Screaming Therapy Group. You are only allowed to send screaming voice notes. Everything else = BAN. Text pics, videos, stickers, gif = BAN. Anything other than screaming = BAN. You think you are smart = BAN. Private channels are only accessible to subscribers and don’t appear in public searches. To join a private channel, you need to receive a link from the owner (administrator). A private channel is an excellent solution for companies and teams. You can also use this type of channel to write down personal notes, reflections, etc. By the way, you can make your private channel public at any moment. To delete a channel with over 1,000 subscribers, you need to contact user support The visual aspect of channels is very critical. In fact, design is the first thing that a potential subscriber pays attention to, even though unconsciously. Telegram Channels requirements & features
from us


Telegram 🇺🇦 Python Programming Сhallenges
FROM American