mirror of
https://github.com/Gallopsled/pwntools.git
synced 2026-11-09 10:09:36 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a50265eb30 | ||
|
|
f34783b1f9 | ||
|
|
76de9302ef | ||
|
|
c578d5661d | ||
|
|
22d441c200 | ||
|
|
fcc9642250 | ||
|
|
9c6ca14eeb | ||
|
|
f7193293cc | ||
|
|
5b0c6922e7 | ||
|
|
33524d74a5 | ||
|
|
2456186f7c | ||
|
|
714ae6ab69 | ||
|
|
c3083d8d92 | ||
|
|
56869f0e47 | ||
|
|
2b843891f4 | ||
|
|
d8a2359100 | ||
|
|
dd9bbd0e51 | ||
|
|
5babddd95c | ||
|
|
3720314f4d | ||
|
|
0129fdd4af | ||
|
|
215b2e6920 | ||
|
|
e0af5e864f | ||
|
|
5a23b22761 | ||
|
|
6f510a3270 | ||
|
|
ff2f4f5bf2 | ||
|
|
f49f931ee8 | ||
|
|
b75b4aa2f0 | ||
|
|
9e0d96b4b6 | ||
|
|
2116bf3118 | ||
|
|
ec314ddf71 | ||
|
|
c0056b71d7 | ||
|
|
92e01a7dca | ||
|
|
fb1178418b | ||
|
|
8fdfd95df6 | ||
|
|
2808b5cd57 | ||
|
|
d2b9e48cf0 | ||
|
|
138fecf524 | ||
|
|
8d78806ded | ||
|
|
1566c903ad | ||
|
|
e6dc71c6a8 | ||
|
|
53b2b0d2e7 | ||
|
|
e3690538e7 | ||
|
|
ecd6d235cd | ||
|
|
d2423f7117 | ||
|
|
9243ae7f26 | ||
|
|
fe700b08fb | ||
|
|
b784d3a683 | ||
|
|
cebd26d85f | ||
|
|
58a846c84d | ||
|
|
c6b855dd65 | ||
|
|
5d2798750d | ||
|
|
977f3f7314 | ||
|
|
47e967238c | ||
|
|
460c42be90 | ||
|
|
d1a6051360 | ||
|
|
544ae930c7 | ||
|
|
dce8fde0b6 | ||
|
|
b0e1ce334e | ||
|
|
75000ba16a | ||
|
|
8ffac64fdc | ||
|
|
6f127e7305 | ||
|
|
b2130e319c | ||
|
|
64f97dfc36 | ||
|
|
c15afc592a | ||
|
|
1b55c988b0 | ||
|
|
b3694ab6cb | ||
|
|
7e4477c08b | ||
|
|
587f7492b8 | ||
|
|
78be10fdf5 | ||
|
|
4ac9aa3d1d | ||
|
|
78326b3cf7 | ||
|
|
1869148ab8 | ||
|
|
7f17166aef | ||
|
|
6c14bc4f0f | ||
|
|
4cb67a857e | ||
|
|
94bb5fde0f | ||
|
|
a5f4758cbc | ||
|
|
cf6be82831 | ||
|
|
7db624bc28 | ||
|
|
24e9501811 | ||
|
|
224ddb411b | ||
|
|
f5062f7b2d | ||
|
|
e625fc28f3 | ||
|
|
3e58f35da2 | ||
|
|
915fdef9df | ||
|
|
d01256ef2b | ||
|
|
e5c8b8c288 | ||
|
|
5fa4fcd051 | ||
|
|
4a4b4dcc40 | ||
|
|
239e4e4752 | ||
|
|
3a033135fb | ||
|
|
32762bfdb0 | ||
|
|
547905fae4 | ||
|
|
dec0e1d71f | ||
|
|
0d56697583 | ||
|
|
c03d08b1c4 | ||
|
|
aeee34f62b | ||
|
|
3f1dc93245 | ||
|
|
20e9fc2f53 | ||
|
|
c54ad5647d | ||
|
|
010c17dd6f | ||
|
|
734f91efdd | ||
|
|
d5e02f27ac | ||
|
|
9609374e97 | ||
|
|
daa87d6438 | ||
|
|
3eac01ed89 | ||
|
|
3ecd151f2b | ||
|
|
bf10bd70f8 | ||
|
|
00bbef79bd | ||
|
|
97ef2d3a74 | ||
|
|
1ee1488897 | ||
|
|
afa7753f87 | ||
|
|
39dd2c3fe3 | ||
|
|
59fe841fe5 | ||
|
|
e6cd97945b | ||
|
|
bb29050756 | ||
|
|
c9fb770507 | ||
|
|
cb5c619da9 | ||
|
|
8a099d3c2f | ||
|
|
71d44f89ca | ||
|
|
f5711289ce | ||
|
|
ef8d51f518 | ||
|
|
96127c3eaf | ||
|
|
431cbddcf9 | ||
|
|
1ba45e7de8 | ||
|
|
3473400619 | ||
|
|
67002e3758 | ||
|
|
b486169389 | ||
|
|
ab512f7bae | ||
|
|
f43fd912f6 | ||
|
|
79e4a269c4 | ||
|
|
927d69986c | ||
|
|
d0a49dbf76 | ||
|
|
1bd049a7bb | ||
|
|
19eed571a5 | ||
|
|
351031958d | ||
|
|
7a44b2cae0 | ||
|
|
0cb5fcb9cc | ||
|
|
db8ab632ca | ||
|
|
1acebdc0ec | ||
|
|
61968df85c | ||
|
|
323ccd08f8 | ||
|
|
ec00cb3f90 | ||
|
|
5befb2f01d | ||
|
|
0dc0a9acc0 | ||
|
|
774ed3b85e | ||
|
|
3123ffe6a7 | ||
|
|
bb7653144c | ||
|
|
c117ec436a | ||
|
|
dd62e5527e | ||
|
|
dc2be3ae0c | ||
|
|
af7fb665ca | ||
|
|
e827c8b9f0 | ||
|
|
b0d3e42686 | ||
|
|
68627b0c03 | ||
|
|
0b82b7c82f | ||
|
|
27d8a7d615 | ||
|
|
03ff7a568d | ||
|
|
6bd621d7f3 | ||
|
|
c6154e81bf | ||
|
|
674943747d | ||
|
|
8a2a6adeb4 | ||
|
|
c13791d403 | ||
|
|
859f884214 | ||
|
|
bf04f1a66d | ||
|
|
6a094ec4b0 | ||
|
|
24a9f92a7b | ||
|
|
218eb308e8 | ||
|
|
2a7d7251ef | ||
|
|
187258792b | ||
|
|
7950e75d48 | ||
|
|
fec31f3382 | ||
|
|
566ec386eb | ||
|
|
7c8b05539d | ||
|
|
ada8a9bdd0 | ||
|
|
c8a21cabd3 | ||
|
|
435b646880 | ||
|
|
f3d0654f97 | ||
|
|
e94b071234 | ||
|
|
fd7794b3d4 | ||
|
|
591e4012e1 | ||
|
|
1679232515 | ||
|
|
40cb4e9034 | ||
|
|
007d0a9b28 | ||
|
|
616d2eb61c | ||
|
|
ddb83dfa38 | ||
|
|
5a15d03224 | ||
|
|
cbb54fb74b | ||
|
|
a72ff4acb0 | ||
|
|
495a11bbd9 | ||
|
|
1ca5cc9467 | ||
|
|
08e9c029ae | ||
|
|
7a492c6ab3 | ||
|
|
7b5ba5cdc2 | ||
|
|
30a3ed454c | ||
|
|
57f0ebd762 | ||
|
|
da4a5c4e30 | ||
|
|
d9e1118f0b | ||
|
|
b8c826e057 | ||
|
|
292b81af17 | ||
|
|
5359ea76ed | ||
|
|
c3c06a3486 | ||
|
|
1c99aadaef | ||
|
|
58967ddfe0 | ||
|
|
c89bed2555 | ||
|
|
c627115b85 | ||
|
|
c7e9778007 | ||
|
|
90056fbeca | ||
|
|
60df8107c0 | ||
|
|
76f366d181 | ||
|
|
9fe9152617 | ||
|
|
7467402ecf | ||
|
|
5fe760e70b | ||
|
|
59a75055cf | ||
|
|
c336932ccf | ||
|
|
b666e9eee1 | ||
|
|
9023b383af | ||
|
|
0d25ca35e1 | ||
|
|
7dc76c745f | ||
|
|
80e12c7031 | ||
|
|
b7609ae4a3 | ||
|
|
8970156e8a | ||
|
|
8e704e72d3 | ||
|
|
f4159bdad4 | ||
|
|
c09091055f | ||
|
|
26e6bce81a | ||
|
|
6af09645e7 | ||
|
|
338fbeba7a | ||
|
|
8da0827c25 | ||
|
|
146348f514 | ||
|
|
fe6619b336 | ||
|
|
1fbff016f9 | ||
|
|
eeedb2c10b | ||
|
|
5ae13e8c8c | ||
|
|
20cb04984a | ||
|
|
2a4a633e23 | ||
|
|
3d03a75975 | ||
|
|
67473560c7 | ||
|
|
ac67b97c4d | ||
|
|
fc31b51436 | ||
|
|
93080627b9 | ||
|
|
6c794022d5 | ||
|
|
6cb9c1fce8 | ||
|
|
1cb0502157 | ||
|
|
e1b3c27867 | ||
|
|
532f910f9f | ||
|
|
c14f1a40d0 | ||
|
|
1854095ee2 | ||
|
|
76413fc91c | ||
|
|
1f8f294fa3 | ||
|
|
75b422a046 | ||
|
|
799f9a4f21 | ||
|
|
b53ec5e3ce | ||
|
|
9604f7847e | ||
|
|
a28ae524ce | ||
|
|
6e1e96d1c1 | ||
|
|
d67cb152ed | ||
|
|
aa1f79201b | ||
|
|
1e6f207956 | ||
|
|
c888a8cbe0 | ||
|
|
9f9d884790 | ||
|
|
39bc5808ea | ||
|
|
b507bd7ed9 | ||
|
|
31f7c61c1f | ||
|
|
2a73356c78 | ||
|
|
758a9549c7 | ||
|
|
2255b7f546 | ||
|
|
cd8f8d3f8d | ||
|
|
25c84daa8a | ||
|
|
8a3a577394 | ||
|
|
90f23df80b | ||
|
|
a208251d5f | ||
|
|
aadf40980d | ||
|
|
14b2f29d17 | ||
|
|
68085012f1 | ||
|
|
5fdc08451d | ||
|
|
f3b5a14fb5 | ||
|
|
63dfed74c6 | ||
|
|
c7c5019b01 | ||
|
|
3ff283cbef | ||
|
|
9859f54a21 | ||
|
|
3ff7a9e940 | ||
|
|
7860eecf02 | ||
|
|
5c4def05b2 | ||
|
|
e50b978398 | ||
|
|
d689805690 | ||
|
|
953e73aa37 | ||
|
|
ee9f9fa7de | ||
|
|
35789287d8 | ||
|
|
7a1ab829eb | ||
|
|
46a1c44fc9 | ||
|
|
899baec704 | ||
|
|
932cb57bf9 | ||
|
|
6a61617c73 | ||
|
|
6944b664e8 | ||
|
|
ab8879afa3 | ||
|
|
d580c0cfd1 | ||
|
|
515f678f2d | ||
|
|
c3afdd681d | ||
|
|
5d537a6189 | ||
|
|
9ba966ddba | ||
|
|
6ea5722f5b | ||
|
|
4e24f665b8 | ||
|
|
34cedc96d8 | ||
|
|
e8065440c2 | ||
|
|
de34906b4c | ||
|
|
1bcf962049 | ||
|
|
e89a9b66ac | ||
|
|
fcbf37860e | ||
|
|
64acece61b | ||
|
|
bb9004c298 | ||
|
|
712295f3c5 | ||
|
|
cca1083f0b | ||
|
|
9dacd1b5d9 | ||
|
|
d9f5a5b009 | ||
|
|
74a5876c0d | ||
|
|
9d6b4881fe | ||
|
|
91025408a4 | ||
|
|
b53e58a840 | ||
|
|
438096f97f | ||
|
|
7bab49e7b9 | ||
|
|
eab9eb1890 | ||
|
|
1061684baa | ||
|
|
8f5fec40fc | ||
|
|
a962666752 | ||
|
|
71a6a373a0 | ||
|
|
3eb738f048 | ||
|
|
29828c3f45 | ||
|
|
412d345964 | ||
|
|
b088f46988 | ||
|
|
8f3839d69e | ||
|
|
5a81e71368 | ||
|
|
1577263334 | ||
|
|
7ad5a4e34e | ||
|
|
513682373e | ||
|
|
df7c1fef9d | ||
|
|
559ffa7c9e | ||
|
|
2512026b3c | ||
|
|
518ed71488 | ||
|
|
26d60cbf63 | ||
|
|
b234b319df | ||
|
|
6577f24d3a | ||
|
|
4a7ff431b9 | ||
|
|
716c67d993 | ||
|
|
91768424ba | ||
|
|
af2f8b4bf4 | ||
|
|
9ed8ab6d4f | ||
|
|
19f7268701 | ||
|
|
e4d919d6bf | ||
|
|
93d9a2cb5e | ||
|
|
69f8cc2c47 | ||
|
|
ab0ac00c73 | ||
|
|
d87ab3ac65 | ||
|
|
23cd5cb819 | ||
|
|
47d5cf7da1 | ||
|
|
a7263688db | ||
|
|
630c4651fa | ||
|
|
54c47b3daa | ||
|
|
11e6a2d9a7 | ||
|
|
9c29c82a69 | ||
|
|
bb25140807 | ||
|
|
ebbe917713 | ||
|
|
b62804eff6 | ||
|
|
ec98dc1246 | ||
|
|
92ad1a4933 | ||
|
|
7cd3c7b300 | ||
|
|
3e163e9cf2 | ||
|
|
267c6cc15a | ||
|
|
5831796f6f | ||
|
|
c438893d7e | ||
|
|
3e33180655 | ||
|
|
e09543c098 | ||
|
|
1a94acab67 | ||
|
|
6263a347bd | ||
|
|
a344047348 | ||
|
|
4aa96b48ba | ||
|
|
6f2598aee0 | ||
|
|
3f42ce8636 | ||
|
|
901f3eddb1 | ||
|
|
5180230f04 | ||
|
|
1ab07de033 | ||
|
|
5936d0f565 | ||
|
|
e3fd03458a | ||
|
|
55016fb416 | ||
|
|
08b316098b | ||
|
|
a27cb1c168 | ||
|
|
d923729dfb | ||
|
|
db75ecb897 | ||
|
|
0dc2949790 | ||
|
|
89a848b51f | ||
|
|
672b4dd090 | ||
|
|
094e44fd65 | ||
|
|
b83db46c34 | ||
|
|
40c1796fc4 | ||
|
|
984d54d9b2 | ||
|
|
3cbc527deb | ||
|
|
1482fb7545 | ||
|
|
7ed6f5fe6b | ||
|
|
fd5a7fea68 | ||
|
|
fda1821fd9 | ||
|
|
f7568b47b3 | ||
|
|
2ccd36ca7f | ||
|
|
9062360041 | ||
|
|
3f9c192a5e | ||
|
|
b8e902b611 | ||
|
|
8055ec98ce |
No files matched your search
@@ -4,6 +4,11 @@ Thanks for contributing to Pwntools!
|
||||
|
||||
When reporting an issue, be sure that you are running the latest released version of pwntools (`pip install --upgrade pwntools`).
|
||||
|
||||
Please verify that your issue occurs on 64-bit Ubuntu 14.04. You can use the Dockerfile in `extra/docker/Dockerfile` to save time.
|
||||
Please verify that your issue occurs on 64-bit Ubuntu 14.04. You can use the Dockerfile on `docker.io` for quick testing.
|
||||
|
||||
```
|
||||
$ docker pull pwntools/pwntools:stable
|
||||
$ docker run -it pwntools/pwntools:stable
|
||||
```
|
||||
|
||||
If possible, provide a proof-of-concept which demonstrates the problem. Include any binaries or scripts necessary to reproduce the issue, and please include the full debug output via setting the environment variable `PWNLIB_DEBUG=1`.
|
||||
@@ -11,6 +11,8 @@ docs/build
|
||||
build
|
||||
MANIFEST
|
||||
dist
|
||||
venv
|
||||
.vscode
|
||||
*.egg-info
|
||||
*.core
|
||||
.coverage
|
||||
|
||||
+17
-9
@@ -1,10 +1,9 @@
|
||||
sudo: false
|
||||
dist: xenial
|
||||
language: python
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- gcc-multilib
|
||||
- gcc-4.6-arm-linux-gnueabihf
|
||||
- lib32stdc++6
|
||||
- ash
|
||||
- bash
|
||||
@@ -14,14 +13,22 @@ addons:
|
||||
- zsh
|
||||
- pandoc
|
||||
- gdb
|
||||
- binutils
|
||||
- qemu-user-static
|
||||
- binutils-multiarch
|
||||
- binutils-aarch64-linux-gnu
|
||||
- binutils-arm-linux-gnueabihf
|
||||
- binutils-mips-linux-gnu
|
||||
- binutils-powerpc-linux-gnu
|
||||
cache:
|
||||
- pip
|
||||
- directories:
|
||||
- usr
|
||||
- /home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/
|
||||
- /home/travis/virtualenv/python2.7.9/bin/
|
||||
- /home/travis/virtualenv/python2.7.15/lib/python2.7/site-packages/
|
||||
- /home/travis/virtualenv/python2.7.15/bin/
|
||||
python:
|
||||
- "2.7"
|
||||
- "2.7.15"
|
||||
- "3.6"
|
||||
before_install:
|
||||
- echo $-
|
||||
- source travis/install.sh
|
||||
@@ -30,13 +37,14 @@ before_install:
|
||||
install:
|
||||
- pip install --upgrade pip
|
||||
- pip install --upgrade appdirs # https://github.com/ActiveState/appdirs/issues/89#issuecomment-282326570
|
||||
- python setup.py egg_info # pypa/pip#6275
|
||||
- pip install --upgrade --editable .
|
||||
- pip install --upgrade --requirement docs/requirements.txt
|
||||
before_script:
|
||||
- PWNLIB_NOTERM=1 python -c 'from pwn import *; print pwnlib.term.term_mode'
|
||||
- PWNLIB_NOTERM=1 python -c 'from pwn import *; print pwnlib.term.term_mode'
|
||||
- PWNLIB_NOTERM=1 python -c 'from pwn import *; print pwnlib.term.term_mode'
|
||||
- PWNLIB_NOTERM=1 python -c 'from pwn import *; print pwnlib.term.term_mode'
|
||||
- PWNLIB_NOTERM=1 python -c 'from pwn import *; print(pwnlib.term.term_mode)'
|
||||
- PWNLIB_NOTERM=1 python -c 'from pwn import *; print(pwnlib.term.term_mode)'
|
||||
- PWNLIB_NOTERM=1 python -c 'from pwn import *; print(pwnlib.term.term_mode)'
|
||||
- PWNLIB_NOTERM=1 python -c 'from pwn import *; print(pwnlib.term.term_mode)'
|
||||
script:
|
||||
- PWNLIB_NOTERM=1 coverage run -m sphinx -b doctest docs/source docs/build/doctest
|
||||
after_success:
|
||||
|
||||
+202
-10
@@ -9,9 +9,20 @@ The table below shows which release corresponds to each branch, and what date th
|
||||
|
||||
| Version | Branch | Release Date |
|
||||
| ---------------- | -------- | ---------------------- |
|
||||
| [3.9.0](#390) | `dev` | Sep 8, 2017 (planned)
|
||||
| [3.8.0](#380) | `beta` | Jul 28, 2017 (planned)
|
||||
| [3.7.0](#370) | `stable` | Jun 19, 2017
|
||||
| [4.2.0](#420) | `dev` | Feb 10, 2020 (planned)
|
||||
| [4.1.0](#410) | `beta` | Jan 30, 2020 (planned)
|
||||
| [4.0.0](#400) | `stable` | Jan 09, 2020
|
||||
| [3.13.0](#3130) | | Nov 5, 2019
|
||||
| [3.12.1](#3121) | | Sept 17, 2018
|
||||
| [3.12.0](#3120) | | Feb 22, 2018
|
||||
| [3.11.0](#3110) | | Jan 3, 2018
|
||||
| [3.10.0](#3100) | | Oct 25, 2017
|
||||
| [3.9.2](#392) | | Oct 5, 2017
|
||||
| [3.9.1](#391) | | Sep 28, 2017
|
||||
| [3.9.0](#390) | | Sep 11, 2017
|
||||
| [3.8.0](#380) | | Jul 29, 2017
|
||||
| [3.7.1](#371) | | Jul 14, 2017
|
||||
| [3.7.0](#370) | | Jun 19, 2017
|
||||
| [3.6.1](#361) | | May 12, 2017
|
||||
| [3.6.0](#360) | | May 8, 2017
|
||||
| [3.5.1](#351) | | Apr 15, 2017
|
||||
@@ -34,19 +45,200 @@ The table below shows which release corresponds to each branch, and what date th
|
||||
| [3.0.0](#300) | | Aug 20, 2016
|
||||
| [2.2.0](#220) | | Jan 5, 2015
|
||||
|
||||
## 4.2.0 (`dev`)
|
||||
|
||||
To be released on Feb 10, 2020.
|
||||
|
||||
## 4.1.0 (`beta`)
|
||||
|
||||
To be released on Jan 30, 2020.
|
||||
|
||||
- [#1316][1316] Fix connect shellcraft in python 3
|
||||
- [#1323][1323] Fix issues related with debugging
|
||||
- [#1001][1001] Enhance `unlock_bootloader` with better status messages
|
||||
- [#1389][1389] remove old dependencies
|
||||
- [#1241][1241] Launch QEMU with sysroot if specified
|
||||
- [#1218][1218] Support for FileStructure exploitation
|
||||
|
||||
[1241]: https://github.com/Gallopsled/pwntools/pulls/1218
|
||||
[1218]: https://github.com/Gallopsled/pwntools/pulls/1218
|
||||
|
||||
## 4.0.0 (`stable`)
|
||||
|
||||
- **Python 3 support! <3**
|
||||
- [#1402][1402] Fix serialtube in python 3
|
||||
- [#1391][1391] Fix process.libs
|
||||
- [#1317][1317] Tubes with `context.encoding`
|
||||
- [#1216][1216] Improve format string generator
|
||||
- [#1285][1285] Add freebsd generic syscall templates
|
||||
- [76413f][76413f] Add pwnlib.adb.bootimg for 'ANDROID!' format boot.img images
|
||||
- [#1202][1202] Docker: Kill 14 layers in pwntools base images
|
||||
- [#1182][1182] shellcraft.dupio() for mips
|
||||
|
||||
[1391]: https://github.com/Gallopsled/pwntools/pulls/1391
|
||||
[1317]: https://github.com/Gallopsled/pwntools/pulls/1317
|
||||
[1285]: https://github.com/Gallopsled/pwntools/pulls/1285
|
||||
[1216]: https://github.com/Gallopsled/pwntools/pulls/1216
|
||||
[1202]: https://github.com/Gallopsled/pwntools/pulls/1202
|
||||
[1182]: https://github.com/Gallopsled/pwntools/pulls/1182
|
||||
[76413f]: https://github.com/Gallopsled/pwntools/commit/76413f
|
||||
|
||||
## 3.13.0
|
||||
|
||||
- [#1204][1204] Reduce ROP cache filename length
|
||||
- [#1175][1175] Fix nested SSH connectors
|
||||
- [#1355][1355] Fix 'break' syscall
|
||||
- [#1277][1277] Fix timeout parameter passing in sendlineafter and other similar functions
|
||||
- [#1292][1292] Provide correct arch name to gdb for sparc64
|
||||
|
||||
[1175]: https://github.com/Gallopsled/pwntools/pulls/1175
|
||||
[1204]: https://github.com/Gallopsled/pwntools/pulls/1355
|
||||
[1277]: https://github.com/Gallopsled/pwntools/pulls/1277
|
||||
[1292]: https://github.com/Gallopsled/pwntools/pulls/1292
|
||||
[1355]: https://github.com/Gallopsled/pwntools/pulls/1355
|
||||
|
||||
## 3.12.1
|
||||
|
||||
- [#1104][1104] Add `DynELF.dump()` for dumping remote ELF files
|
||||
- [#1101][1101] Set `context.os` via `context.binary`, useful for Android exploitation
|
||||
- [5fdc08][5fdc08] Work around broken `pidof` on Android
|
||||
- [63dfed][63dfed] Print warning when Corefile deletion fails instead of throwing an exception
|
||||
- [#1094][1094] Make hexdump output alignment more consistent
|
||||
- [#1096][1096] `flat()` and `fit()` are now the same function
|
||||
|
||||
[1104]: https://github.com/Gallopsled/pwntools/pull/1104
|
||||
[1101]: https://github.com/Gallopsled/pwntools/pull/1101
|
||||
[1094]: https://github.com/Gallopsled/pwntools/pull/1094
|
||||
[1096]: https://github.com/Gallopsled/pwntools/pull/1096
|
||||
[5fdc08]: https://github.com/Gallopsled/pwntools/commit/5fdc08
|
||||
[63dfed]: https://github.com/Gallopsled/pwntools/commit/63dfed
|
||||
|
||||
## 3.12.2
|
||||
|
||||
- [1242][1242] Use IntervalTree 2.xx, disallow use of 3.xx
|
||||
- [1243][1243] Fix a typo that caused an exception when executing a binary with `process()` which returns `-ENOEXEC` and the system does not have `qemu-user` binaries installed.
|
||||
|
||||
[1242]: https://github.com/Gallopsled/pwntools/pull/1242
|
||||
[1243]: https://github.com/Gallopsled/pwntools/pull/1243
|
||||
|
||||
## 3.12.1
|
||||
|
||||
- [#1198][1198] More compatibility fixes for pyelftools==0.25, and pin Sphinx<1.8.0 since it causes testing errors
|
||||
- [#1191][1191] Fix compatibility with pyelftools==0.25
|
||||
- [#1159][1159] Fix check for `/proc/.../status`
|
||||
- [#1162][1162] Fix broken package versions
|
||||
- [#1150][1150] Fix exception raised when a cache file is missing
|
||||
- [#1156][1156] Fix ROP gadget selection logic involving `int` and `syscall` instructions
|
||||
- [#1152][1152] Fix QEMU LD_PREFIX calculation (wrong parameter passed)
|
||||
- [#1155][1155] Use Ubuntu Trusty for all CI builds
|
||||
- [#1131][1131] Add "libc-" to libc prefixes in `process` tubes
|
||||
- [#1125][1125] Fix a typo
|
||||
- [#1121][1121] Fix tests which were broken by an upstream Sphinx change
|
||||
|
||||
[1159]: https://github.com/Gallopsled/pwntools/pull/1159
|
||||
[1162]: https://github.com/Gallopsled/pwntools/pull/1162
|
||||
[1150]: https://github.com/Gallopsled/pwntools/pull/1150
|
||||
[1156]: https://github.com/Gallopsled/pwntools/pull/1156
|
||||
[1152]: https://github.com/Gallopsled/pwntools/pull/1152
|
||||
[1155]: https://github.com/Gallopsled/pwntools/pull/1155
|
||||
[1131]: https://github.com/Gallopsled/pwntools/pull/1131
|
||||
[1125]: https://github.com/Gallopsled/pwntools/pull/1125
|
||||
[1121]: https://github.com/Gallopsled/pwntools/pull/1121
|
||||
|
||||
## 3.12.0
|
||||
|
||||
- [#1083][1083] Better error messages for `gdb` when `LD_PRELOAD` is incorrect
|
||||
- [#1085][1085] Add support for extracting Android `BOOTLDR!` images
|
||||
- [#1075][1075] Add support for detecting GNU Screen for `run_in_new_terminal`
|
||||
- [#1074][1074] Add support for running `pwntools-gdb` wrapper script instead of `gdb`
|
||||
- [#1068][1068] Work around very old OpenSSL versions which don't have sha256 support *AND* don't exit with an error code when trying to use it
|
||||
- [#1067][1067] Add `pwnlib.tubes.server` module, which adds a reusable `server` listener
|
||||
- [#1063][1063] Add support for labels in `fit()`, allowing dynamic contents to be injected. (This feature is really cool, check out the pull request!)
|
||||
|
||||
[1083]: https://github.com/Gallopsled/pwntools/pull/1083
|
||||
[1085]: https://github.com/Gallopsled/pwntools/pull/1085
|
||||
[1075]: https://github.com/Gallopsled/pwntools/pull/1075
|
||||
[1074]: https://github.com/Gallopsled/pwntools/pull/1074
|
||||
[1068]: https://github.com/Gallopsled/pwntools/pull/1068
|
||||
[1067]: https://github.com/Gallopsled/pwntools/pull/1067
|
||||
[1063]: https://github.com/Gallopsled/pwntools/pull/1063
|
||||
|
||||
## 3.11.0
|
||||
|
||||
- [#1044][1044] Enhancements to ROP
|
||||
+ Much better support for 64-bit Intel (amd64) ROP
|
||||
+ ROP gadget selection is optimized to favor multi-pops instead of multiple single-pop gadgets
|
||||
+ Added support for blacklisting byte values in ROP gadget addresses
|
||||
- [#1049][1049] Enhancements to `cyclic`
|
||||
+ `context` now has two additional attributes, `cyclic_alphabet` and `cyclic_length`, which correspond to the arguments `alphabet` and `n` to `cyclic()` and `cyclic_find()` and related routines.
|
||||
+ The motivation for this change is to allow setting the `alphabet` globally, so that any padding / patterns generated internally to pwntools can be controlled. The specific motivation is blacklisting values in ROP padding.
|
||||
- [#1052][1052] Enhancements for detecting `QEMU_LD_PREFIX` used by QEMU user-mode emulation for sysroots
|
||||
- [#1035][1035] Minor documentation changes
|
||||
- [#1032][1032] Enhancements to `pwn template`
|
||||
- [#1031][1031] More accurate `Coredump.fault_addr` on amd64
|
||||
- [#1084][1084] Fix broken tests due to `ftp.debian.org` going down
|
||||
|
||||
[1044]: https://github.com/Gallopsled/pwntools/pull/1044
|
||||
[1049]: https://github.com/Gallopsled/pwntools/pull/1049
|
||||
[1052]: https://github.com/Gallopsled/pwntools/pull/1052
|
||||
[1035]: https://github.com/Gallopsled/pwntools/pull/1035
|
||||
[1032]: https://github.com/Gallopsled/pwntools/pull/1032
|
||||
[1031]: https://github.com/Gallopsled/pwntools/pull/1031
|
||||
[1084]: https://github.com/Gallopsled/pwntools/pull/1084
|
||||
|
||||
## 3.10.0
|
||||
|
||||
- [#1007][1007] Add support for setting a `gdbinit` file in the context
|
||||
- [#1055][1055] Fixes for `Corefile` stack parsing, speed up `ELF.string()`
|
||||
- [#1057][1057] Fix a variable name typo in `DynELF` logging which results in an exception being thrown
|
||||
- [#1058][1058] Fix an edge case in `ssh_process.exe`
|
||||
|
||||
[1007]: https://github.com/Gallopsled/pwntools/pull/1007
|
||||
[1055]: https://github.com/Gallopsled/pwntools/pull/1055
|
||||
[1057]: https://github.com/Gallopsled/pwntools/pull/1057
|
||||
[1058]: https://github.com/Gallopsled/pwntools/pull/1058
|
||||
|
||||
## 3.9.2
|
||||
|
||||
- [#1043][1043] Do not attempt to populate the libraries used by statically-linked binaries
|
||||
|
||||
[1043]: https://github.com/Gallopsled/pwntools/pull/1043
|
||||
|
||||
## 3.9.1
|
||||
|
||||
- [#1038][1038] Fix an issue with `process()` where glibc would buffer data internally, causing a hang on `select()`
|
||||
- [#1036][1036] Fix Travis CI logging verbosity
|
||||
- [#1029][1029] Fix some `unicode` issues when using the `readline` command history in `tube.interactive()`
|
||||
|
||||
[1038]: https://github.com/Gallopsled/pwntools/pull/1038
|
||||
[1036]: https://github.com/Gallopsled/pwntools/pull/1036
|
||||
[1029]: https://github.com/Gallopsled/pwntools/pull/1029
|
||||
|
||||
## 3.9.0
|
||||
|
||||
To be released on Sep 8, 2017.
|
||||
- [#1003][1003] Make `concat_all` faster while also simplifying it's logic
|
||||
- [#1014][1014] Fix for overwritten env when parsing core file
|
||||
- [#1023][1023] Fixes to Travis CI
|
||||
|
||||
[1003]: https://github.com/Gallopsled/pwntools/pull/1003
|
||||
[1014]: https://github.com/Gallopsled/pwntools/pull/1014
|
||||
[1023]: https://github.com/Gallopsled/pwntools/pull/1023
|
||||
|
||||
## 3.8.0
|
||||
|
||||
To be released on Jul 28, 2017.
|
||||
|
||||
- [#981][981] Fixed RELRO detection logic
|
||||
- [#986][986] Enhancements to DynELF for controlling usage of LibcDB
|
||||
- A few documentation fixes
|
||||
- A few fixes for the Docker image
|
||||
|
||||
[981]: https://github.com/Gallopsled/pwntools/issues/981
|
||||
[986]: https://github.com/Gallopsled/pwntools/issues/986
|
||||
[981]: https://github.com/Gallopsled/pwntools/pull/981
|
||||
[986]: https://github.com/Gallopsled/pwntools/pull/986
|
||||
|
||||
## 3.7.1
|
||||
|
||||
- [#998][998] Fix a bug where integer values could not be set in `.pwn.conf`.
|
||||
|
||||
[998]: https://github.com/Gallopsled/pwntools/pull/998
|
||||
|
||||
## 3.7.0
|
||||
|
||||
@@ -54,8 +246,8 @@ To be released on Jul 28, 2017.
|
||||
- [#952][952] A few small fixes were made to `pwn template`, and the CRC database was updated.
|
||||
- [5c72d62c][5c72d62c] Updated the CRC database
|
||||
|
||||
[933]: https://github.com/Gallopsled/pwntools/issues/933
|
||||
[952]: https://github.com/Gallopsled/pwntools/issues/952
|
||||
[933]: https://github.com/Gallopsled/pwntools/pull/933
|
||||
[952]: https://github.com/Gallopsled/pwntools/pull/952
|
||||
[5c72d62c]: https://github.com/Gallopsled/pwntools/commit/5c72d62c
|
||||
|
||||
## 3.6.1
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||

|
||||
|
||||
[](https://docs.pwntools.com/)
|
||||
[](https://pypi.python.org/pypi/pwntools/)
|
||||
[](https://pypi.python.org/pypi/pwntools/)
|
||||
[](https://travis-ci.org/Gallopsled/pwntools)
|
||||
[](https://coveralls.io/github/Gallopsled/pwntools?branch=dev)
|
||||
[](https://twitter.com/pwntools)
|
||||
[](http://choosealicense.com/licenses/mit/)
|
||||
|
||||
pwntools is a CTF framework and exploit development library. Written in Python, it is designed for rapid prototyping and development, and intended to make exploit writing as simple as possible.
|
||||
Pwntools is a CTF framework and exploit development library. Written in Python, it is designed for rapid prototyping and development, and intended to make exploit writing as simple as possible.
|
||||
|
||||
```python
|
||||
from pwn import *
|
||||
@@ -32,15 +32,15 @@ To get you started, we've provided some example solutions for past CTF challenge
|
||||
|
||||
# Installation
|
||||
|
||||
pwntools is best supported on 64-bit Ubuntu 12.04 and 14.04, but most functionality should work on any Posix-like distribution (Debian, Arch, FreeBSD, OSX, etc.). Python 2.7 is required.
|
||||
Pwntools is best supported on 64-bit Ubuntu LTE releases (12.04, 14.04, 16.04 and 18.04). Most functionality should work on any Posix-like distribution (Debian, Arch, FreeBSD, OSX, etc.). Python >= 2.7 is required (Python 3 suggested as best).
|
||||
|
||||
Most of the functionality of pwntools is self-contained and Python-only. You should be able to get running quickly with
|
||||
|
||||
```sh
|
||||
apt-get update
|
||||
apt-get install python2.7 python-pip python-dev git libssl-dev libffi-dev build-essential
|
||||
pip install --upgrade pip
|
||||
pip install --upgrade pwntools
|
||||
apt-get install python3 python3-pip python3-dev git libssl-dev libffi-dev build-essential
|
||||
python3 -m pip install --upgrade pip
|
||||
python3 -m pip install --upgrade git+https://github.com/Gallopsled/pwntools.git@dev3
|
||||
```
|
||||
|
||||
However, some of the features (assembling/disassembling foreign architectures) require non-Python dependencies. For more information, see the [complete installation instructions here](https://docs.pwntools.com/en/stable/install.html).
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ def main(args):
|
||||
doc2dash.__main__.main.main( \
|
||||
[ os.path.join(dstdir, "html"), "-d", dstdir, "-n", name, \
|
||||
"-f", "-I", "index.html"], "doc2dash", False)
|
||||
except SystemExit,e:
|
||||
except SystemExit as e:
|
||||
pass
|
||||
|
||||
# Insert a link to the online version.
|
||||
|
||||
+13
-12
@@ -1,16 +1,17 @@
|
||||
sphinxcontrib-napoleon
|
||||
sphinxcontrib-autoprogram==0.1.2
|
||||
isort
|
||||
paramiko>=1.15.2
|
||||
mako>=1.0.0
|
||||
pyelftools>=0.2.3
|
||||
capstone
|
||||
ropgadget>=5.3
|
||||
coveralls
|
||||
doc2dash
|
||||
isort
|
||||
mako>=1.0.0
|
||||
paramiko>=1.15.2
|
||||
pip>=6.0.8
|
||||
pyelftools>=0.2.3
|
||||
pygments>=2.0
|
||||
pyserial>=2.7
|
||||
requests>=2.5.1
|
||||
pip>=6.0.8
|
||||
tox>=1.8.1
|
||||
pygments>=2.0
|
||||
ropgadget>=5.3
|
||||
sphinx
|
||||
sphinx_rtd_theme
|
||||
doc2dash
|
||||
coveralls
|
||||
sphinxcontrib-napoleon
|
||||
sphinxcontrib-autoprogram
|
||||
tox>=1.8.1
|
||||
@@ -1,5 +1,6 @@
|
||||
.. testsetup:: *
|
||||
|
||||
from pprint import pprint
|
||||
from pwn import *
|
||||
adb = pwnlib.adb
|
||||
|
||||
|
||||
+2
-1
@@ -6,6 +6,7 @@
|
||||
from pwnlib.asm import *
|
||||
from pwnlib import shellcraft
|
||||
from pwnlib.tubes.process import process
|
||||
from pwnlib.util.fiddling import unhex
|
||||
|
||||
|
||||
:mod:`pwnlib.asm` --- Assembler functions
|
||||
@@ -15,7 +16,7 @@
|
||||
:members:
|
||||
|
||||
Internal Functions
|
||||
=========================================
|
||||
-----------------------------------------
|
||||
|
||||
These are only included so that their tests are run.
|
||||
|
||||
|
||||
+75
-30
@@ -12,6 +12,8 @@
|
||||
# serve to show the default.
|
||||
|
||||
import os
|
||||
import doctest
|
||||
import six
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
@@ -24,8 +26,6 @@ sys.path.insert(0, os.path.abspath('../..'))
|
||||
|
||||
import pwnlib
|
||||
|
||||
# -- General configuration -----------------------------------------------------
|
||||
|
||||
# If your documentation needs a minimal Sphinx version, state it here.
|
||||
#needs_sphinx = '1.0'
|
||||
|
||||
@@ -44,6 +44,23 @@ extensions = [
|
||||
'sphinxcontrib.napoleon'
|
||||
]
|
||||
|
||||
# Disable "info" logging directly to stdout by Sphinx
|
||||
import logging
|
||||
|
||||
class SphinxPwnlibFilter(logging.Filter):
|
||||
def filter(self, record):
|
||||
if record.name.startswith('pwn'):
|
||||
return False
|
||||
if record.name.startswith('paramiko'):
|
||||
return False
|
||||
return True
|
||||
|
||||
log_filter = SphinxPwnlibFilter()
|
||||
|
||||
for i, handler in enumerate(logging.root.handlers):
|
||||
print("Filtering Sphinx handler", handler)
|
||||
handler.addFilter(log_filter)
|
||||
|
||||
# Napoleon settings
|
||||
napoleon_use_ivar = True
|
||||
napoleon_use_rtype = False
|
||||
@@ -52,9 +69,9 @@ doctest_global_setup = '''
|
||||
import sys, os
|
||||
os.environ['PWNLIB_NOTERM'] = '1'
|
||||
os.environ['PWNLIB_RANDOMIZE'] = '0'
|
||||
import pwnlib
|
||||
import pwnlib, logging
|
||||
pwnlib.context.context.reset_local()
|
||||
pwnlib.context.ContextType.defaults['log_level'] = 'ERROR'
|
||||
pwnlib.context.ContextType.defaults['log_level'] = logging.ERROR
|
||||
pwnlib.context.ContextType.defaults['randomize'] = False
|
||||
pwnlib.util.fiddling.default_style = {}
|
||||
pwnlib.term.text.when = 'never'
|
||||
@@ -296,13 +313,13 @@ texinfo_documents = [
|
||||
branch = release
|
||||
|
||||
try:
|
||||
git_branch = subprocess.check_output('git describe --tags', shell = True)
|
||||
git_branch = subprocess.check_output('git describe --tags', shell = True, universal_newlines = True)
|
||||
except subprocess.CalledProcessError:
|
||||
git_branch = '-'
|
||||
|
||||
try:
|
||||
if '-' in git_branch:
|
||||
branch = subprocess.check_output('git rev-parse HEAD', shell = True).strip()[:10]
|
||||
branch = subprocess.check_output('git rev-parse HEAD', shell = True, universal_newlines = True).strip()[:10]
|
||||
except subprocess.CalledProcessError:
|
||||
pass
|
||||
|
||||
@@ -330,11 +347,11 @@ def linkcode_resolve(domain, info):
|
||||
else:
|
||||
filename = info['module'].replace('.', '/') + '.py'
|
||||
|
||||
if isinstance(val, (types.ModuleType, types.ClassType, types.MethodType, types.FunctionType, types.TracebackType, types.FrameType, types.CodeType)):
|
||||
if isinstance(val, (types.ModuleType, types.MethodType, types.FunctionType, types.TracebackType, types.FrameType, types.CodeType) + six.class_types):
|
||||
try:
|
||||
lines, first = inspect.getsourcelines(val)
|
||||
filename += '#L%d-%d' % (first, first + len(lines) - 1)
|
||||
except IOError:
|
||||
except (IOError, TypeError):
|
||||
pass
|
||||
|
||||
return "https://github.com/Gallopsled/pwntools/blob/%s/%s" % (branch, filename)
|
||||
@@ -363,27 +380,25 @@ from sphinx.util.inspect import safe_getmembers, safe_getattr
|
||||
def dont_skip_any_doctests(app, what, name, obj, skip, options):
|
||||
return False
|
||||
|
||||
# Test non-exported members
|
||||
class ModuleDocumenter(sphinx.ext.autodoc.ModuleDocumenter):
|
||||
def get_object_members(self, want_all):
|
||||
if want_all:
|
||||
# if not hasattr(self.object, '__all__'):
|
||||
# for implicit module members, check __module__ to avoid
|
||||
# documenting imported objects
|
||||
return True, safe_getmembers(self.object)
|
||||
# else:
|
||||
# memberlist = self.object.__all__
|
||||
# # Sometimes __all__ is broken...
|
||||
# if not isinstance(memberlist, (list, tuple)) or not \
|
||||
# all(isinstance(entry, string_types) for entry in memberlist):
|
||||
# self.directive.warn(
|
||||
# '__all__ should be a list of strings, not %r '
|
||||
# '(in module %s) -- ignoring __all__' %
|
||||
# (memberlist, self.fullname))
|
||||
# # fall back to all members
|
||||
# return True, safe_getmembers(self.object)
|
||||
else:
|
||||
memberlist = self.options.members or []
|
||||
def get_object_members_all(self, want_all):
|
||||
if want_all:
|
||||
# if not hasattr(self.object, '__all__'):
|
||||
# for implicit module members, check __module__ to avoid
|
||||
# documenting imported objects
|
||||
return True, safe_getmembers(self.object)
|
||||
# else:
|
||||
# memberlist = self.object.__all__
|
||||
# # Sometimes __all__ is broken...
|
||||
# if not isinstance(memberlist, (list, tuple)) or not \
|
||||
# all(isinstance(entry, string_types) for entry in memberlist):
|
||||
# self.directive.warn(
|
||||
# '__all__ should be a list of strings, not %r '
|
||||
# '(in module %s) -- ignoring __all__' %
|
||||
# (memberlist, self.fullname))
|
||||
# # fall back to all members
|
||||
# return True, safe_getmembers(self.object)
|
||||
else:
|
||||
memberlist = self.options.members or []
|
||||
ret = []
|
||||
for mname in memberlist:
|
||||
try:
|
||||
@@ -395,8 +410,38 @@ class ModuleDocumenter(sphinx.ext.autodoc.ModuleDocumenter):
|
||||
safe_getattr(self.object, '__name__', '???'), mname))
|
||||
return False, ret
|
||||
|
||||
class _DummyClass(object): pass
|
||||
|
||||
class Py2OutputChecker(_DummyClass, doctest.OutputChecker):
|
||||
def check_output(self, want, got, optionflags):
|
||||
sup = super(Py2OutputChecker, self).check_output
|
||||
if sup(want, got, optionflags):
|
||||
return True
|
||||
try:
|
||||
rly_want = pwnlib.util.safeeval.const(want)
|
||||
if sup(repr(rly_want), got, optionflags):
|
||||
return True
|
||||
rly_got = pwnlib.util.safeeval.const(got)
|
||||
if rly_want == rly_got:
|
||||
return True
|
||||
except ValueError:
|
||||
pass
|
||||
rly_want = ' '.join(x[:2].replace('b"','"').replace("b'","'")+x[2:] for x in want.replace('\n','\n ').split(' ')).replace('\n ','\n')
|
||||
if sup(rly_want, got, optionflags):
|
||||
return True
|
||||
rly_want = ' '.join(x[:2].replace('b"',' "').replace("b'"," '")+x[2:] for x in want.replace('\n','\n ').split(' ')).replace('\n ','\n')
|
||||
return sup(rly_want, got, optionflags)
|
||||
|
||||
def py2_doctest_init(self, checker=None, verbose=None, optionflags=0):
|
||||
if checker is None:
|
||||
checker = Py2OutputChecker()
|
||||
doctest.DocTestRunner.__init__(self, checker, verbose, optionflags)
|
||||
|
||||
if 'doctest' in sys.argv:
|
||||
def setup(app):
|
||||
app.connect('autodoc-skip-member', dont_skip_any_doctests)
|
||||
|
||||
sphinx.ext.autodoc.ModuleDocumenter = ModuleDocumenter
|
||||
if sys.version_info[:1] < (3,):
|
||||
import sphinx.ext.doctest
|
||||
sphinx.ext.doctest.SphinxDocTestRunner.__init__ = py2_doctest_init
|
||||
sphinx.ext.autodoc.ModuleDocumenter.get_object_members = get_object_members_all
|
||||
@@ -8,7 +8,7 @@
|
||||
:mod:`pwnlib.context` --- Setting runtime variables
|
||||
=====================================================
|
||||
|
||||
Many settings in ``pwntools`` are controlled via the global variable :data:`.context, such as the selected target operating system, architecture, and bit-width.
|
||||
Many settings in ``pwntools`` are controlled via the global variable :data:`.context`, such as the selected target operating system, architecture, and bit-width.
|
||||
|
||||
In general, exploits will start with something like:
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
.. testsetup:: *
|
||||
|
||||
from glob import glob
|
||||
from pwn import *
|
||||
|
||||
:mod:`pwnlib.elf.corefile` --- Core Files
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
from pwn import *
|
||||
from glob import glob
|
||||
from pwnlib.elf.maps import CAT_PROC_MAPS_EXIT
|
||||
|
||||
:mod:`pwnlib.elf.elf` --- ELF Files
|
||||
===========================================================
|
||||
|
||||
@@ -13,7 +13,7 @@ Which imports a bazillion things into the global namespace to make your life eas
|
||||
|
||||
This is a quick list of most of the objects and routines imported, in rough order of importance and frequency of use.
|
||||
|
||||
- :obj:`.context`
|
||||
- :mod:`pwnlib.context`
|
||||
- :data:`pwnlib.context.context`
|
||||
- Responsible for most of the pwntools convenience settings
|
||||
- Set `context.log_level = 'debug'` when troubleshooting your exploit
|
||||
|
||||
@@ -57,9 +57,11 @@ Each of the ``pwntools`` modules is documented here.
|
||||
flag
|
||||
fmtstr
|
||||
gdb
|
||||
libcdb
|
||||
log
|
||||
memleak
|
||||
protocols
|
||||
qemu
|
||||
replacements
|
||||
rop
|
||||
rop/*
|
||||
|
||||
+34
-34
@@ -27,14 +27,14 @@ This exposes a standard interface to talk to processes, sockets, serial ports,
|
||||
and all manner of things, along with some nifty helpers for common tasks.
|
||||
For example, remote connections via :mod:`pwnlib.tubes.remote`.
|
||||
|
||||
>>> conn = remote('ftp.debian.org',21)
|
||||
>>> conn = remote('ftp.ubuntu.com',21)
|
||||
>>> conn.recvline() # doctest: +ELLIPSIS
|
||||
'220 ...'
|
||||
>>> conn.send('USER anonymous\r\n')
|
||||
>>> conn.recvuntil(' ', drop=True)
|
||||
'331'
|
||||
b'220 ...'
|
||||
>>> conn.send(b'USER anonymous\r\n')
|
||||
>>> conn.recvuntil(b' ', drop=True)
|
||||
b'331'
|
||||
>>> conn.recvline()
|
||||
'Please specify the password.\r\n'
|
||||
b'Please specify the password.\r\n'
|
||||
>>> conn.close()
|
||||
|
||||
It's also easy to spin up a listener
|
||||
@@ -42,20 +42,20 @@ It's also easy to spin up a listener
|
||||
>>> l = listen()
|
||||
>>> r = remote('localhost', l.lport)
|
||||
>>> c = l.wait_for_connection()
|
||||
>>> r.send('hello')
|
||||
>>> r.send(b'hello')
|
||||
>>> c.recv()
|
||||
'hello'
|
||||
b'hello'
|
||||
|
||||
Interacting with processes is easy thanks to :mod:`pwnlib.tubes.process`.
|
||||
|
||||
::
|
||||
|
||||
>>> sh = process('/bin/sh')
|
||||
>>> sh.sendline('sleep 3; echo hello world;')
|
||||
>>> sh.sendline(b'sleep 3; echo hello world;')
|
||||
>>> sh.recvline(timeout=1)
|
||||
''
|
||||
b''
|
||||
>>> sh.recvline(timeout=5)
|
||||
'hello world\n'
|
||||
b'hello world\n'
|
||||
>>> sh.close()
|
||||
|
||||
Not only can you interact with processes programmatically, but you can
|
||||
@@ -74,14 +74,14 @@ a ``process`` tube.
|
||||
|
||||
>>> shell = ssh('bandit0', 'bandit.labs.overthewire.org', password='bandit0', port=2220)
|
||||
>>> shell['whoami']
|
||||
'bandit0'
|
||||
b'bandit0'
|
||||
>>> shell.download_file('/etc/motd')
|
||||
>>> sh = shell.run('sh')
|
||||
>>> sh.sendline('sleep 3; echo hello world;') # doctest: +SKIP
|
||||
>>> sh.sendline(b'sleep 3; echo hello world;') # doctest: +SKIP
|
||||
>>> sh.recvline(timeout=1)
|
||||
''
|
||||
b''
|
||||
>>> sh.recvline(timeout=5)
|
||||
'hello world\n'
|
||||
b'hello world\n'
|
||||
>>> shell.close()
|
||||
|
||||
Packing Integers
|
||||
@@ -97,13 +97,13 @@ unpacking codes, and littering your code with helper routines.
|
||||
>>> import struct
|
||||
>>> p32(0xdeadbeef) == struct.pack('I', 0xdeadbeef)
|
||||
True
|
||||
>>> leet = '37130000'.decode('hex')
|
||||
>>> u32('abcd') == struct.unpack('I', 'abcd')[0]
|
||||
>>> leet = unhex('37130000')
|
||||
>>> u32(b'abcd') == struct.unpack('I', b'abcd')[0]
|
||||
True
|
||||
|
||||
The packing/unpacking operations are defined for many common bit-widths.
|
||||
|
||||
>>> u8('A') == 0x41
|
||||
>>> u8(b'A') == 0x41
|
||||
True
|
||||
|
||||
Setting the Target Architecture and OS
|
||||
@@ -112,9 +112,9 @@ Setting the Target Architecture and OS
|
||||
The target architecture can generally be specified as an argument to the routine that requires it.
|
||||
|
||||
>>> asm('nop')
|
||||
'\x90'
|
||||
b'\x90'
|
||||
>>> asm('nop', arch='arm')
|
||||
'\x00\xf0 \xe3'
|
||||
b'\x00\xf0 \xe3'
|
||||
|
||||
However, it can also be set once in the global ``context``. The operating system, word size, and endianness can also be set here.
|
||||
|
||||
@@ -126,10 +126,10 @@ However, it can also be set once in the global ``context``. The operating syste
|
||||
Additionally, you can use a shorthand to set all of the values at once.
|
||||
|
||||
>>> asm('nop')
|
||||
'\x90'
|
||||
b'\x90'
|
||||
>>> context(arch='arm', os='linux', endian='big', word_size=32)
|
||||
>>> asm('nop')
|
||||
'\xe3 \xf0\x00'
|
||||
b'\xe3 \xf0\x00'
|
||||
|
||||
.. doctest::
|
||||
:hide:
|
||||
@@ -158,12 +158,12 @@ Assembly and Disassembly
|
||||
Never again will you need to run some already-assembled pile of shellcode
|
||||
from the internet! The :mod:`pwnlib.asm` module is full of awesome.
|
||||
|
||||
>>> asm('mov eax, 0').encode('hex')
|
||||
>>> enhex(asm('mov eax, 0'))
|
||||
'b800000000'
|
||||
|
||||
But if you do, it's easy to suss out!
|
||||
|
||||
>>> print disasm('6a0258cd80ebf9'.decode('hex'))
|
||||
>>> print(disasm(unhex('6a0258cd80ebf9')))
|
||||
0: 6a 02 push 0x2
|
||||
2: 58 pop eax
|
||||
3: cd 80 int 0x80
|
||||
@@ -176,7 +176,7 @@ loaded with useful time-saving shellcodes.
|
||||
Let's say that we want to `setreuid(getuid(), getuid())` followed by `dup`ing
|
||||
file descriptor 4 to `stdin`, `stdout`, and `stderr`, and then pop a shell!
|
||||
|
||||
>>> asm(shellcraft.setreuid() + shellcraft.dupsh(4)).encode('hex') # doctest: +ELLIPSIS
|
||||
>>> enhex(asm(shellcraft.setreuid() + shellcraft.dupsh(4))) # doctest: +ELLIPSIS
|
||||
'6a3158cd80...'
|
||||
|
||||
|
||||
@@ -188,10 +188,10 @@ Never write another hexdump, thanks to :mod:`pwnlib.util.fiddling`.
|
||||
|
||||
Find offsets in your buffer that cause a crash, thanks to :mod:`pwnlib.cyclic`.
|
||||
|
||||
>>> print cyclic(20)
|
||||
>>> print(cyclic(20).decode())
|
||||
aaaabaaacaaadaaaeaaa
|
||||
>>> # Assume EIP = 0x62616166 ('faab' which is pack(0x62616166)) at crash time
|
||||
>>> print cyclic_find('faab')
|
||||
>>> # Assume EIP = 0x62616166 (b'faab' which is pack(0x62616166)) at crash time
|
||||
>>> print(cyclic_find(b'faab'))
|
||||
120
|
||||
|
||||
ELF Manipulation
|
||||
@@ -200,22 +200,22 @@ ELF Manipulation
|
||||
Stop hard-coding things! Look them up at runtime with :mod:`pwnlib.elf`.
|
||||
|
||||
>>> e = ELF('/bin/cat')
|
||||
>>> print hex(e.address) #doctest: +SKIP
|
||||
>>> print(hex(e.address)) #doctest: +SKIP
|
||||
0x400000
|
||||
>>> print hex(e.symbols['write']) #doctest: +SKIP
|
||||
>>> print(hex(e.symbols['write'])) #doctest: +SKIP
|
||||
0x401680
|
||||
>>> print hex(e.got['write']) #doctest: +SKIP
|
||||
>>> print(hex(e.got['write'])) #doctest: +SKIP
|
||||
0x60b070
|
||||
>>> print hex(e.plt['write']) #doctest: +SKIP
|
||||
>>> print(hex(e.plt['write'])) #doctest: +SKIP
|
||||
0x401680
|
||||
|
||||
You can even patch and save the files.
|
||||
|
||||
>>> e = ELF('/bin/cat')
|
||||
>>> e.read(e.address, 4)
|
||||
'\x7fELF'
|
||||
b'\x7fELF'
|
||||
>>> e.asm(e.address, 'ret')
|
||||
>>> e.save('/tmp/quiet-cat')
|
||||
>>> disasm(file('/tmp/quiet-cat','rb').read(1))
|
||||
>>> disasm(open('/tmp/quiet-cat','rb').read(1))
|
||||
' 0: c3 ret'
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
.. testsetup:: *
|
||||
|
||||
from pwn import *
|
||||
from pwnlib.libcdb import *
|
||||
|
||||
:mod:`pwnlib.libcdb` --- Libc Database
|
||||
===========================================
|
||||
|
||||
.. automodule:: pwnlib.libcdb
|
||||
:members:
|
||||
@@ -0,0 +1,10 @@
|
||||
.. testsetup:: *
|
||||
|
||||
from pwn import *
|
||||
|
||||
|
||||
:mod:`pwnlib.qemu` --- QEMU Utilities
|
||||
==========================================
|
||||
|
||||
.. automodule:: pwnlib.qemu
|
||||
:members:
|
||||
@@ -3,3 +3,9 @@
|
||||
|
||||
.. automodule:: pwnlib.term
|
||||
:members:
|
||||
|
||||
Term Modules
|
||||
-------------------
|
||||
|
||||
.. toctree::
|
||||
term/readline
|
||||
@@ -0,0 +1,9 @@
|
||||
.. testsetup:: *
|
||||
|
||||
from pwnlib.tubes.buffer import *
|
||||
|
||||
:mod:`pwnlib.tubes.buffer` --- buffer implementation for tubes
|
||||
==============================================================
|
||||
|
||||
.. automodule:: pwnlib.tubes.buffer
|
||||
:members:
|
||||
@@ -1,6 +1,7 @@
|
||||
.. testsetup:: *
|
||||
|
||||
from pwn import *
|
||||
from pwnlib.tubes.server import server
|
||||
|
||||
:mod:`pwnlib.tubes.sock` --- Sockets
|
||||
===========================================================
|
||||
@@ -23,3 +24,9 @@
|
||||
.. autoclass:: pwnlib.tubes.listen.listen
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
.. automodule:: pwnlib.tubes.server
|
||||
|
||||
.. autoclass:: pwnlib.tubes.server.server
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -1,5 +1,6 @@
|
||||
.. testsetup:: *
|
||||
|
||||
from pwn import *
|
||||
from pwnlib.util.cyclic import *
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
.. testsetup:: *
|
||||
|
||||
from pwnlib.util.getdents import *
|
||||
from pwnlib.util.fiddling import unhex
|
||||
|
||||
|
||||
:mod:`pwnlib.util.getdents` --- Linux binary directory listing
|
||||
==============================================================
|
||||
|
||||
.. automodule:: pwnlib.util.getdents
|
||||
:members:
|
||||
@@ -1,5 +1,6 @@
|
||||
.. testsetup:: *
|
||||
|
||||
from pprint import pprint
|
||||
from pwnlib.util.misc import *
|
||||
import os, subprocess
|
||||
os.chdir("..")
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
.. testsetup:: *
|
||||
|
||||
from pwnlib.util.proc import *
|
||||
from pwnlib.tubes.process import process
|
||||
import os, sys
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
CFLAGS := -Wno-unused-result -Wno-format-security
|
||||
TARGETS := printf.mips printf.mips64 printf.mipsel printf.mips64el printf.arm printf.aarch64 \
|
||||
printf.ppc printf.ppc64 printf.sparc64 printf.native printf.native32
|
||||
|
||||
.PHONY: run
|
||||
run: all
|
||||
./exploit.py
|
||||
|
||||
.PHONY: all
|
||||
all: $(TARGETS)
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f $(TARGETS)
|
||||
|
||||
# mips variants
|
||||
%.mips: %.c
|
||||
mips-linux-gnu-gcc $(CFLAGS) -static -Os -o "$@" $^
|
||||
%.mipsel: %.c
|
||||
mipsel-linux-gnu-gcc $(CFLAGS) -static -Os -o "$@" $^
|
||||
%.mips64: %.c
|
||||
mips64-linux-gnuabi64-gcc $(CFLAGS) -static -Os -o "$@" $^
|
||||
%.mips64el: %.c
|
||||
mips64el-linux-gnuabi64-gcc $(CFLAGS) -static -Os -o "$@" $^
|
||||
|
||||
# arm variants
|
||||
%.arm: %.c
|
||||
arm-linux-gnueabi-gcc $(CFLAGS) -static -Os -o "$@" $^
|
||||
%.aarch64: %.c
|
||||
aarch64-linux-gnu-gcc $(CFLAGS) -static -Os -o "$@" $^
|
||||
|
||||
# ppc variants
|
||||
%.ppc: %.c
|
||||
powerpc-linux-gnu-gcc $(CFLAGS) -static -Os -o "$@" $^
|
||||
%.ppc64: %.c
|
||||
powerpc64-linux-gnu-gcc $(CFLAGS) -static -Os -o "$@" $^
|
||||
|
||||
# sparc variants
|
||||
%.sparc64: %.c
|
||||
sparc64-linux-gnu-gcc $(CFLAGS) -static -Os -o "$@" $^
|
||||
|
||||
# native variants
|
||||
%.native: %.c
|
||||
gcc $(CFLAGS) -o "$@" $^
|
||||
%.native32: %.c
|
||||
i686-linux-gnu-gcc $(CFLAGS) -o "$@" $^
|
||||
|
||||
# install deps on ubuntu xenial
|
||||
.PHONY: install-apt
|
||||
install-apt:
|
||||
apt-get install -y make gcc-mips64el-linux-gnuabi64 gcc-sparc64-linux-gnu gcc-powerpc64-linux-gnu gcc-powerpc-linux-gnu gcc-arm-linux-gnueabi gcc-aarch64-linux-gnu gcc-mips64-linux-gnuabi64 gcc-mipsel-linux-gnu gcc-mips64el-linux-gnuabi64 gcc-mips-linux-gnu gcc-i686-linux-gnu gcc
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env python2
|
||||
from pwn import *
|
||||
|
||||
@context.quiet
|
||||
def exec_fmt(payload):
|
||||
p = context.binary.process()
|
||||
p.sendline(payload)
|
||||
return p.recvall()
|
||||
|
||||
def exploit(binary):
|
||||
context.binary = ELF(binary)
|
||||
autofmt = FmtStr(exec_fmt)
|
||||
offset = autofmt.offset
|
||||
with context.binary.process() as p:
|
||||
addr = unpack(p.recv(context.bytes))
|
||||
payload = fmtstr_payload(offset, {addr: p32(0x1337babe)})
|
||||
p.sendline(payload)
|
||||
p.recvuntil("DONE")
|
||||
print hex(u32(p.recv(4)))
|
||||
|
||||
binaries = [
|
||||
"printf.mips",
|
||||
"printf.mips64",
|
||||
"printf.mipsel",
|
||||
"printf.mips64el",
|
||||
"printf.native",
|
||||
"printf.native32",
|
||||
"printf.ppc",
|
||||
"printf.ppc64",
|
||||
"printf.sparc64",
|
||||
"printf.arm",
|
||||
"printf.aarch64",
|
||||
]
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
binaries = sys.argv[1:]
|
||||
|
||||
for binary in binaries:
|
||||
exploit(binary)
|
||||
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
@@ -0,0 +1,29 @@
|
||||
#ifdef _FORTIFY_SOURCE
|
||||
#undef _FORTIFY_SOURCE
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/mman.h>
|
||||
#define MEMORY_ADDRESS ((void*)0x11110000)
|
||||
#define MEMORY_SIZE 1024
|
||||
#define TARGET ((int *) 0x11110100)
|
||||
int main(int argc, char const *argv[])
|
||||
{
|
||||
char buff[1024];
|
||||
void *ptr = NULL;
|
||||
int *my_var = TARGET;
|
||||
ptr = mmap(MEMORY_ADDRESS, MEMORY_SIZE, PROT_READ|PROT_WRITE, MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE, 0, 0);
|
||||
if(ptr != MEMORY_ADDRESS)
|
||||
{
|
||||
perror("mmap");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
*my_var = 0x41414141;
|
||||
write(1, &my_var, sizeof(int *));
|
||||
scanf("%s", buff);
|
||||
dprintf(2, buff);
|
||||
write(1, "DONE", 4);
|
||||
write(1, my_var, sizeof(int));
|
||||
return 0;
|
||||
}
|
||||
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
subdirs=xenial stable $(wildcard */)
|
||||
makefiles=$(wildcard */Makefile)
|
||||
tags=stable beta dev
|
||||
tags=base stable beta dev
|
||||
|
||||
all: $(makefiles) $(subdirs)
|
||||
|
||||
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
xenial
|
||||
@@ -6,21 +6,21 @@
|
||||
FROM kalilinux/kali-linux-docker
|
||||
MAINTAINER Maintainer Gallopsled et al.
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y build-essential
|
||||
RUN apt-get install -y git
|
||||
RUN apt-get install -y libssl-dev
|
||||
RUN apt-get install -y libffi-dev
|
||||
RUN apt-get install -y python2.7
|
||||
RUN apt-get install -y python-pip
|
||||
RUN apt-get install -y python-dev
|
||||
RUN pip install --upgrade pip
|
||||
RUN python -m pip install --upgrade pwntools
|
||||
RUN PWNLIB_NOTERM=1 pwn update
|
||||
|
||||
RUN apt-get install -y sudo
|
||||
RUN useradd -m pwntools
|
||||
RUN passwd --delete --unlock pwntools
|
||||
RUN echo "pwntools ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/pwntools
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y \
|
||||
build-essential \
|
||||
git \
|
||||
libssl-dev \
|
||||
libffi-dev \
|
||||
python2.7 \
|
||||
python-pip \
|
||||
python-dev \
|
||||
&& pip install --upgrade pip \
|
||||
&& python -m pip install --upgrade pwntools \
|
||||
&& PWNLIB_NOTERM=1 pwn update \
|
||||
&& apt-get install -y sudo \
|
||||
&& useradd -m pwntools \
|
||||
&& passwd --delete --unlock pwntools \
|
||||
&& echo "pwntools ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/pwntools
|
||||
USER pwntools
|
||||
WORKDIR /home/pwntools
|
||||
@@ -1,6 +1,6 @@
|
||||
all: Dockerfile
|
||||
|
||||
Dockerfile: ../stable/Dockerfile FORCE
|
||||
Dockerfile: ../xenial/Dockerfile FORCE
|
||||
sed "s|ubuntu:xenial|kalilinux/kali-linux-docker|" < "$<" > "$@"
|
||||
|
||||
FORCE:
|
||||
|
||||
@@ -6,21 +6,21 @@
|
||||
FROM ubuntu:precise
|
||||
MAINTAINER Maintainer Gallopsled et al.
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y build-essential
|
||||
RUN apt-get install -y git
|
||||
RUN apt-get install -y libssl-dev
|
||||
RUN apt-get install -y libffi-dev
|
||||
RUN apt-get install -y python2.7
|
||||
RUN apt-get install -y python-pip
|
||||
RUN apt-get install -y python-dev
|
||||
RUN pip install --upgrade pip
|
||||
RUN python -m pip install --upgrade pwntools
|
||||
RUN PWNLIB_NOTERM=1 pwn update
|
||||
|
||||
RUN apt-get install -y sudo
|
||||
RUN useradd -m pwntools
|
||||
RUN passwd --delete --unlock pwntools
|
||||
RUN echo "pwntools ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/pwntools
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y \
|
||||
build-essential \
|
||||
git \
|
||||
libssl-dev \
|
||||
libffi-dev \
|
||||
python2.7 \
|
||||
python-pip \
|
||||
python-dev \
|
||||
&& pip install --upgrade pip \
|
||||
&& python -m pip install --upgrade pwntools \
|
||||
&& PWNLIB_NOTERM=1 pwn update \
|
||||
&& apt-get install -y sudo \
|
||||
&& useradd -m pwntools \
|
||||
&& passwd --delete --unlock pwntools \
|
||||
&& echo "pwntools ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/pwntools
|
||||
USER pwntools
|
||||
WORKDIR /home/pwntools
|
||||
@@ -1,26 +1,6 @@
|
||||
############################################################
|
||||
# Dockerfile to build Pwntools container
|
||||
# Based on Ubuntu
|
||||
############################################################
|
||||
FROM pwntools/pwntools:base
|
||||
|
||||
FROM ubuntu:xenial
|
||||
MAINTAINER Maintainer Gallopsled et al.
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y build-essential
|
||||
RUN apt-get install -y git
|
||||
RUN apt-get install -y libssl-dev
|
||||
RUN apt-get install -y libffi-dev
|
||||
RUN apt-get install -y python2.7
|
||||
RUN apt-get install -y python-pip
|
||||
RUN apt-get install -y python-dev
|
||||
RUN pip install --upgrade pip
|
||||
RUN python -m pip install --upgrade pwntools
|
||||
USER root
|
||||
RUN pip install --upgrade git+https://github.com/Gallopsled/pwntools@stable
|
||||
RUN PWNLIB_NOTERM=1 pwn update
|
||||
|
||||
RUN apt-get install -y sudo
|
||||
RUN useradd -m pwntools
|
||||
RUN passwd --delete --unlock pwntools
|
||||
RUN echo "pwntools ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/pwntools
|
||||
USER pwntools
|
||||
WORKDIR /home/pwntools
|
||||
@@ -1,8 +0,0 @@
|
||||
all: Dockerfile
|
||||
|
||||
Dockerfile: ../xenial/Dockerfile FORCE
|
||||
cp "$<" "$@"
|
||||
|
||||
FORCE:
|
||||
|
||||
.PHONY: all
|
||||
@@ -6,21 +6,21 @@
|
||||
FROM ubuntu:trusty
|
||||
MAINTAINER Maintainer Gallopsled et al.
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y build-essential
|
||||
RUN apt-get install -y git
|
||||
RUN apt-get install -y libssl-dev
|
||||
RUN apt-get install -y libffi-dev
|
||||
RUN apt-get install -y python2.7
|
||||
RUN apt-get install -y python-pip
|
||||
RUN apt-get install -y python-dev
|
||||
RUN pip install --upgrade pip
|
||||
RUN python -m pip install --upgrade pwntools
|
||||
RUN PWNLIB_NOTERM=1 pwn update
|
||||
|
||||
RUN apt-get install -y sudo
|
||||
RUN useradd -m pwntools
|
||||
RUN passwd --delete --unlock pwntools
|
||||
RUN echo "pwntools ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/pwntools
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y \
|
||||
build-essential \
|
||||
git \
|
||||
libssl-dev \
|
||||
libffi-dev \
|
||||
python2.7 \
|
||||
python-pip \
|
||||
python-dev \
|
||||
&& pip install --upgrade pip \
|
||||
&& python -m pip install --upgrade pwntools \
|
||||
&& PWNLIB_NOTERM=1 pwn update \
|
||||
&& apt-get install -y sudo \
|
||||
&& useradd -m pwntools \
|
||||
&& passwd --delete --unlock pwntools \
|
||||
&& echo "pwntools ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/pwntools
|
||||
USER pwntools
|
||||
WORKDIR /home/pwntools
|
||||
@@ -6,21 +6,21 @@
|
||||
FROM ubuntu:xenial
|
||||
MAINTAINER Maintainer Gallopsled et al.
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y build-essential
|
||||
RUN apt-get install -y git
|
||||
RUN apt-get install -y libssl-dev
|
||||
RUN apt-get install -y libffi-dev
|
||||
RUN apt-get install -y python2.7
|
||||
RUN apt-get install -y python-pip
|
||||
RUN apt-get install -y python-dev
|
||||
RUN pip install --upgrade pip
|
||||
RUN python -m pip install --upgrade pwntools
|
||||
RUN PWNLIB_NOTERM=1 pwn update
|
||||
|
||||
RUN apt-get install -y sudo
|
||||
RUN useradd -m pwntools
|
||||
RUN passwd --delete --unlock pwntools
|
||||
RUN echo "pwntools ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/pwntools
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y \
|
||||
build-essential \
|
||||
git \
|
||||
libssl-dev \
|
||||
libffi-dev \
|
||||
python2.7 \
|
||||
python-pip \
|
||||
python-dev \
|
||||
&& pip install --upgrade pip \
|
||||
&& python -m pip install --upgrade pwntools \
|
||||
&& PWNLIB_NOTERM=1 pwn update \
|
||||
&& apt-get install -y sudo \
|
||||
&& useradd -m pwntools \
|
||||
&& passwd --delete --unlock pwntools \
|
||||
&& echo "pwntools ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/pwntools
|
||||
USER pwntools
|
||||
WORKDIR /home/pwntools
|
||||
+6
-10
@@ -21,7 +21,7 @@ import pwnlib
|
||||
from pwnlib import *
|
||||
from pwnlib.asm import *
|
||||
from pwnlib.context import Thread
|
||||
from pwnlib.context import context
|
||||
from pwnlib.context import context, LocalContext
|
||||
from pwnlib.dynelf import DynELF
|
||||
from pwnlib.encoders import *
|
||||
from pwnlib.elf.corefile import Core, Corefile, Coredump
|
||||
@@ -43,6 +43,7 @@ from pwnlib.tubes.listen import listen
|
||||
from pwnlib.tubes.process import process, PTY, PIPE, STDOUT
|
||||
from pwnlib.tubes.remote import remote, tcp, udp, connect
|
||||
from pwnlib.tubes.serialtube import serialtube
|
||||
from pwnlib.tubes.server import server
|
||||
from pwnlib.tubes.ssh import ssh
|
||||
from pwnlib.tubes.tube import tube
|
||||
from pwnlib.ui import *
|
||||
@@ -66,15 +67,8 @@ from pwnlib.util.web import *
|
||||
|
||||
# Promote these modules, so that "from pwn import *" will let you access them
|
||||
|
||||
try:
|
||||
import cPickle as pickle
|
||||
except ImportError:
|
||||
import pickle
|
||||
|
||||
try:
|
||||
from cStringIO import StringIO
|
||||
except ImportError:
|
||||
from StringIO import StringIO
|
||||
from six.moves import cPickle as pickle, cStringIO as StringIO
|
||||
from six import BytesIO
|
||||
|
||||
error = log.error
|
||||
warning = log.warning
|
||||
@@ -82,3 +76,5 @@ warn = log.warning
|
||||
info = log.info
|
||||
debug = log.debug
|
||||
success = log.success
|
||||
|
||||
__all__ = [x for x in globals().keys() if x != '__name__']
|
||||
+60
-7
@@ -1,5 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
|
||||
from pwnlib.context import LocalContext
|
||||
from pwnlib.context import context
|
||||
@@ -45,10 +46,18 @@ class ABI(object):
|
||||
(32, 'arm', 'linux'): linux_arm,
|
||||
(32, 'thumb', 'linux'): linux_arm,
|
||||
(32, 'mips', 'linux'): linux_mips,
|
||||
(32, 'i386', 'windows'): windows_i386,
|
||||
(64, 'amd64', 'windows'): windows_amd64,
|
||||
(32, 'powerpc', 'linux'): linux_ppc,
|
||||
(64, 'powerpc', 'linux'): linux_ppc64,
|
||||
(32, 'i386', 'freebsd'): freebsd_i386,
|
||||
(64, 'aarch64', 'freebsd'): freebsd_aarch64,
|
||||
(64, 'amd64', 'freebsd'): freebsd_amd64,
|
||||
(32, 'arm', 'freebsd'): freebsd_arm,
|
||||
(32, 'thumb', 'freebsd'): freebsd_arm,
|
||||
(32, 'mips', 'freebsd'): freebsd_mips,
|
||||
(32, 'powerpc', 'freebsd'): freebsd_ppc,
|
||||
(64, 'powerpc', 'freebsd'): freebsd_ppc64,
|
||||
(32, 'i386', 'windows'): windows_i386,
|
||||
(64, 'amd64', 'windows'): windows_amd64,
|
||||
}[(context.bits, context.arch, context.os)]
|
||||
|
||||
@staticmethod
|
||||
@@ -67,6 +76,15 @@ class ABI(object):
|
||||
(64, 'aarch64', 'linux'): linux_aarch64_syscall,
|
||||
(32, 'powerpc', 'linux'): linux_ppc_syscall,
|
||||
(64, 'powerpc', 'linux'): linux_ppc64_syscall,
|
||||
(32, 'i386', 'freebsd'): freebsd_i386_syscall,
|
||||
(64, 'amd64', 'freebsd'): freebsd_amd64_syscall,
|
||||
(64, 'aarch64', 'freebsd'): freebsd_aarch64_syscall,
|
||||
(32, 'arm', 'freebsd'): freebsd_arm_syscall,
|
||||
(32, 'thumb', 'freebsd'): freebsd_arm_syscall,
|
||||
(32, 'mips', 'freebsd'): freebsd_mips_syscall,
|
||||
(64, 'aarch64', 'freebsd'): freebsd_aarch64_syscall,
|
||||
(32, 'powerpc', 'freebsd'): freebsd_ppc_syscall,
|
||||
(64, 'powerpc', 'freebsd'): freebsd_ppc64_syscall,
|
||||
}[(context.bits, context.arch, context.os)]
|
||||
|
||||
@staticmethod
|
||||
@@ -81,6 +99,11 @@ class ABI(object):
|
||||
(32, 'arm', 'linux'): linux_arm_sigreturn,
|
||||
(32, 'thumb', 'linux'): linux_arm_sigreturn,
|
||||
(64, 'aarch64', 'linux'): linux_aarch64_sigreturn,
|
||||
(32, 'i386', 'freebsd'): freebsd_i386_sigreturn,
|
||||
(64, 'amd64', 'freebsd'): freebsd_amd64_sigreturn,
|
||||
(32, 'arm', 'freebsd'): freebsd_arm_sigreturn,
|
||||
(32, 'thumb', 'freebsd'): freebsd_arm_sigreturn,
|
||||
(64, 'aarch64', 'freebsd'): freebsd_aarch64_sigreturn,
|
||||
}[(context.bits, context.arch, context.os)]
|
||||
|
||||
class SyscallABI(ABI):
|
||||
@@ -101,6 +124,7 @@ class SigreturnABI(SyscallABI):
|
||||
returns = False
|
||||
|
||||
|
||||
# System V ABI used by many UNIXes
|
||||
linux_i386 = ABI('esp', [], 4, 0)
|
||||
linux_amd64 = ABI('rsp', ['rdi','rsi','rdx','rcx','r8','r9'], 8, 0)
|
||||
linux_arm = ABI('sp', ['r0', 'r1', 'r2', 'r3'], 8, 0)
|
||||
@@ -109,6 +133,14 @@ linux_mips = ABI('$sp', ['$a0','$a1','$a2','$a3'], 4, 0)
|
||||
linux_ppc = ABI('sp', ['r3', 'r4', 'r5', 'r6', 'r7', 'r8', 'r9', 'r10'], 4, 0)
|
||||
linux_ppc64 = ABI('sp', ['r3', 'r4', 'r5', 'r6', 'r7', 'r8', 'r9', 'r10'], 8, 0)
|
||||
|
||||
sysv_i386 = linux_i386
|
||||
sysv_amd64 = linux_amd64
|
||||
sysv_arm = linux_arm
|
||||
sysv_aarch64 = linux_aarch64
|
||||
sysv_mips = linux_mips
|
||||
sysv_ppc = linux_ppc
|
||||
sysv_ppc64 = linux_ppc64
|
||||
|
||||
linux_i386_syscall = SyscallABI('esp', ['eax', 'ebx', 'ecx', 'edx', 'esi', 'edi', 'ebp'], 4, 0)
|
||||
linux_amd64_syscall = SyscallABI('rsp', ['rax', 'rdi', 'rsi', 'rdx', 'r10', 'r8', 'r9'], 8, 0)
|
||||
linux_arm_syscall = SyscallABI('sp', ['r7', 'r0', 'r1', 'r2', 'r3', 'r4', 'r5', 'r6'], 4, 0)
|
||||
@@ -122,10 +154,31 @@ linux_amd64_sigreturn = SigreturnABI('rsp', ['rax'], 4, 0)
|
||||
linux_arm_sigreturn = SigreturnABI('sp', ['r7'], 4, 0)
|
||||
linux_aarch64_sigreturn = SigreturnABI('sp', ['x8'], 16, 0)
|
||||
|
||||
sysv_i386_sigreturn = linux_i386_sigreturn
|
||||
sysv_amd64_sigreturn = linux_amd64_sigreturn
|
||||
sysv_arm_sigreturn = linux_arm_sigreturn
|
||||
sysv_aarch64_sigreturn = linux_aarch64_sigreturn
|
||||
|
||||
freebsd_i386 = sysv_i386
|
||||
freebsd_amd64 = sysv_amd64
|
||||
freebsd_arm = sysv_arm
|
||||
freebsd_aarch64 = sysv_aarch64
|
||||
freebsd_mips = sysv_mips
|
||||
freebsd_ppc = sysv_ppc
|
||||
freebsd_ppc64 = sysv_ppc64
|
||||
|
||||
freebsd_i386_syscall = SyscallABI('esp', ['eax'], 4, 0)
|
||||
freebsd_amd64_syscall = SyscallABI('rsp', ['rax','rdi','rsi','rdx','rcx','r8','r9'], 8, 0)
|
||||
freebsd_arm_syscall = SyscallABI('sp', ['r7', 'r0', 'r1', 'r2', 'r3'], 8, 0)
|
||||
freebsd_aarch64_syscall = SyscallABI('sp', ['x8', 'x0', 'x1', 'x2', 'x3'], 16, 0)
|
||||
freebsd_mips_syscall = SyscallABI('$sp', ['$v0','$a0','$a1','$a2','$a3'], 4, 0)
|
||||
freebsd_ppc_syscall = SyscallABI('sp', ['r0', 'r3', 'r4', 'r5', 'r6', 'r7', 'r8', 'r9', 'r10'], 4, 0)
|
||||
freebsd_ppc64_syscall = SyscallABI('sp', ['r0', 'r3', 'r4', 'r5', 'r6', 'r7', 'r8', 'r9', 'r10'], 8, 0)
|
||||
|
||||
freebsd_i386_sigreturn = sysv_i386_sigreturn
|
||||
freebsd_amd64_sigreturn = sysv_amd64_sigreturn
|
||||
freebsd_arm_sigreturn = sysv_arm_sigreturn
|
||||
freebsd_aarch64_sigreturn = sysv_aarch64_sigreturn
|
||||
|
||||
windows_i386 = ABI('esp', [], 4, 0)
|
||||
windows_amd64 = ABI('rsp', ['rcx','rdx','r8','r9'], 32, 32)
|
||||
|
||||
# Fake ABIs used by SROP
|
||||
linux_i386_srop = ABI('esp', ['eax'], 4, 0)
|
||||
linux_amd64_srop = ABI('rsp', ['rax'], 4, 0)
|
||||
linux_arm_srop = ABI('sp', ['r7'], 4, 0)
|
||||
@@ -2,3 +2,5 @@ from __future__ import absolute_import
|
||||
|
||||
from pwnlib.adb.adb import *
|
||||
from pwnlib.adb.protocol import Client
|
||||
from pwnlib.adb.bootimg import BootImage
|
||||
from pwnlib.adb.bootloader import BootloaderImage
|
||||
+43
-27
@@ -35,25 +35,26 @@ the :mod:`pwnlib.adb` module.
|
||||
.. code-block:: python
|
||||
|
||||
# Get a process listing
|
||||
print adb.process(['ps']).recvall()
|
||||
print(adb.process(['ps']).recvall())
|
||||
|
||||
# Fetch properties
|
||||
print adb.properties.ro.build.fingerprint
|
||||
print(adb.properties.ro.build.fingerprint)
|
||||
|
||||
# Read and write files
|
||||
print adb.read('/proc/version')
|
||||
print(adb.read('/proc/version'))
|
||||
adb.write('/data/local/tmp/foo', 'my data')
|
||||
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
|
||||
import functools
|
||||
import glob
|
||||
import logging
|
||||
import os
|
||||
import platform
|
||||
import re
|
||||
import shutil
|
||||
import six
|
||||
import stat
|
||||
import tempfile
|
||||
import time
|
||||
@@ -75,9 +76,9 @@ def adb(argv, *a, **kw):
|
||||
r"""Returns the output of an ADB subcommand.
|
||||
|
||||
>>> adb.adb(['get-serialno'])
|
||||
'emulator-5554\n'
|
||||
b'emulator-5554\n'
|
||||
"""
|
||||
if isinstance(argv, (str, unicode)):
|
||||
if isinstance(argv, (bytes, six.text_type)):
|
||||
argv = [argv]
|
||||
|
||||
log.debug("$ " + ' '.join(context.adb + argv))
|
||||
@@ -328,7 +329,7 @@ class AdbDevice(Device):
|
||||
kwargs['port'] = 'emulator'
|
||||
|
||||
for field in fields[2:]:
|
||||
k,v = field.split(':')
|
||||
k,v = field.split(':', 1)
|
||||
kwargs[k] = v
|
||||
|
||||
return AdbDevice(serial, type, **kwargs)
|
||||
@@ -355,7 +356,6 @@ class AdbDevice(Device):
|
||||
|
||||
if name not in g:
|
||||
raise AttributeError('%r object has no attribute %r' % (type(self).__name__,name))
|
||||
|
||||
value = g[name]
|
||||
|
||||
if not hasattr(value, '__call__'):
|
||||
@@ -415,7 +415,7 @@ def wait_for_device(kick=False):
|
||||
@with_device
|
||||
def disable_verity():
|
||||
"""Disables dm-verity on the device."""
|
||||
with log.waitfor("Disabling dm-verity on %s" % context.device) as w:
|
||||
with log.waitfor("Disabling dm-verity on %s" % context.device):
|
||||
root()
|
||||
|
||||
with AdbClient() as c:
|
||||
@@ -433,7 +433,7 @@ def disable_verity():
|
||||
@with_device
|
||||
def remount():
|
||||
"""Remounts the filesystem as writable."""
|
||||
with log.waitfor("Remounting filesystem on %s" % context.device) as w:
|
||||
with log.waitfor("Remounting filesystem on %s" % context.device):
|
||||
disable_verity()
|
||||
root()
|
||||
|
||||
@@ -486,7 +486,7 @@ def pull(remote_path, local_path=None):
|
||||
Example:
|
||||
|
||||
>>> _=adb.pull('/proc/version', './proc-version')
|
||||
>>> print read('./proc-version') # doctest: +ELLIPSIS
|
||||
>>> print(read('./proc-version').decode('utf-8')) # doctest: +ELLIPSIS
|
||||
Linux version ...
|
||||
"""
|
||||
if local_path is None:
|
||||
@@ -520,7 +520,7 @@ def push(local_path, remote_path):
|
||||
>>> adb.push('./filename', '/data/local/tmp')
|
||||
'/data/local/tmp/filename'
|
||||
>>> adb.read('/data/local/tmp/filename')
|
||||
'contents'
|
||||
b'contents'
|
||||
>>> adb.push('./filename', '/does/not/exist')
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
@@ -573,7 +573,7 @@ def read(path, target=None, callback=None):
|
||||
|
||||
Examples:
|
||||
|
||||
>>> print adb.read('/proc/version') # doctest: +ELLIPSIS
|
||||
>>> print(adb.read('/proc/version').decode('utf-8')) # doctest: +ELLIPSIS
|
||||
Linux version ...
|
||||
>>> adb.read('/does/not/exist')
|
||||
Traceback (most recent call last):
|
||||
@@ -593,7 +593,7 @@ def read(path, target=None, callback=None):
|
||||
|
||||
@context.quietfunc
|
||||
@with_device
|
||||
def write(path, data=''):
|
||||
def write(path, data=b''):
|
||||
"""Create a file on the device with the provided contents.
|
||||
|
||||
Arguments:
|
||||
@@ -602,7 +602,7 @@ def write(path, data=''):
|
||||
|
||||
Examples:
|
||||
|
||||
>>> adb.write('/dev/null', 'data')
|
||||
>>> adb.write('/dev/null', b'data')
|
||||
>>> adb.write('/data/local/tmp/')
|
||||
"""
|
||||
with tempfile.NamedTemporaryFile() as temp:
|
||||
@@ -650,7 +650,7 @@ def mkdir(path):
|
||||
|
||||
# Any output at all is an error
|
||||
if result:
|
||||
log.error(result)
|
||||
log.error(result.rstrip().decode('utf-8'))
|
||||
|
||||
@context.quietfunc
|
||||
@with_device
|
||||
@@ -746,12 +746,12 @@ def unlink(path, recursive=False):
|
||||
if isdir(path) and c.list(path) and not recursive:
|
||||
log.error("Cannot delete non-empty directory %r without recursive=True" % path)
|
||||
|
||||
flags = '-rf' if recursive else '-r'
|
||||
flags = '-rf' if recursive else '-f'
|
||||
|
||||
output = c.execute(['rm', flags, path]).recvall()
|
||||
|
||||
if output:
|
||||
log.error(output)
|
||||
log.error(output.decode('utf-8'))
|
||||
|
||||
@with_device
|
||||
def process(argv, *a, **kw):
|
||||
@@ -765,10 +765,10 @@ def process(argv, *a, **kw):
|
||||
Examples:
|
||||
|
||||
>>> adb.root()
|
||||
>>> print adb.process(['cat','/proc/version']).recvall() # doctest: +ELLIPSIS
|
||||
>>> print(adb.process(['cat','/proc/version']).recvall().decode('utf-8')) # doctest: +ELLIPSIS
|
||||
Linux version ...
|
||||
"""
|
||||
if isinstance(argv, (str, unicode)):
|
||||
if isinstance(argv, (bytes, six.text_type)):
|
||||
argv = [argv]
|
||||
|
||||
message = "Starting %s process %r" % ('Android', argv[0])
|
||||
@@ -820,10 +820,13 @@ echo $PATH | while read -d: directory; do
|
||||
[ -x "$directory/{name}" ] || continue;
|
||||
echo -n "$directory/{name}\\x00";
|
||||
done
|
||||
[ -x "{name}" ] && echo -n "$PWD/{name}\\x00"
|
||||
'''.format(name=name)
|
||||
|
||||
which_cmd = which_cmd.strip()
|
||||
data = process(['sh','-c', which_cmd], *a, **kw).recvall()
|
||||
if not hasattr(data, 'encode'):
|
||||
data = data.decode('utf-8')
|
||||
result = []
|
||||
|
||||
for path in data.split('\x00'):
|
||||
@@ -852,7 +855,7 @@ def whoami():
|
||||
def forward(port):
|
||||
"""Sets up a port to forward to the device."""
|
||||
tcp_port = 'tcp:%s' % port
|
||||
start_forwarding = adb(['forward', tcp_port, tcp_port])
|
||||
adb(['forward', tcp_port, tcp_port])
|
||||
atexit.register(lambda: adb(['forward', '--remove', tcp_port]))
|
||||
|
||||
@context.quietfunc
|
||||
@@ -880,9 +883,16 @@ def logcat(stream=False):
|
||||
def pidof(name):
|
||||
"""Returns a list of PIDs for the named process."""
|
||||
with context.quiet:
|
||||
io = process(['pidof', name])
|
||||
data = io.recvall().split()
|
||||
return list(map(int, data))
|
||||
# Older devices have a broken 'pidof', apparently.
|
||||
# Try pgrep first.
|
||||
io = process(['pgrep', name])
|
||||
data = io.recvall()
|
||||
|
||||
if 'not found' in data:
|
||||
io = process(['pidof', name])
|
||||
data = io.recvall()
|
||||
|
||||
return list(map(int, data.split()))
|
||||
|
||||
@with_device
|
||||
def proc_exe(pid):
|
||||
@@ -905,11 +915,17 @@ def getprop(name=None):
|
||||
"""
|
||||
with context.quiet:
|
||||
if name:
|
||||
return process(['getprop', name]).recvall().strip()
|
||||
result = process(['getprop', name]).recvall().strip()
|
||||
if not hasattr(result, 'encode'):
|
||||
result = result.decode('utf-8')
|
||||
return result
|
||||
|
||||
|
||||
result = process(['getprop']).recvall()
|
||||
|
||||
if not hasattr(result, 'encode'):
|
||||
result = result.decode('utf-8')
|
||||
|
||||
expr = r'\[([^\]]+)\]: \[(.*)\]'
|
||||
|
||||
props = {}
|
||||
@@ -1049,7 +1065,7 @@ class Kernel(object):
|
||||
'Nexus 7': 'oem uart-on',
|
||||
}
|
||||
|
||||
with log.waitfor('Enabling kernel UART') as w:
|
||||
with log.waitfor('Enabling kernel UART'):
|
||||
|
||||
if model not in known_commands:
|
||||
log.error("Device UART is unsupported.")
|
||||
@@ -1089,7 +1105,7 @@ class Property(object):
|
||||
self.__dict__['_name'] = name
|
||||
|
||||
def __str__(self):
|
||||
return getprop(self._name).strip()
|
||||
return str(getprop(self._name)).strip()
|
||||
|
||||
def __repr__(self):
|
||||
return repr(str(self))
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
from __future__ import division
|
||||
|
||||
import ctypes
|
||||
|
||||
BOOT_MAGIC = b"ANDROID!"
|
||||
BOOT_MAGIC_SIZE = 8
|
||||
BOOT_NAME_SIZE = 16
|
||||
BOOT_ARGS_SIZE = 512
|
||||
BOOT_EXTRA_ARGS_SIZE = 1024
|
||||
|
||||
|
||||
class boot_img_hdr(ctypes.Structure):
|
||||
_fields_ = [
|
||||
('magic', ctypes.c_char * BOOT_MAGIC_SIZE),
|
||||
|
||||
('kernel_size', ctypes.c_uint32),
|
||||
('kernel_addr', ctypes.c_uint32),
|
||||
|
||||
('ramdisk_size', ctypes.c_uint32),
|
||||
('ramdisk_addr', ctypes.c_uint32),
|
||||
|
||||
('second_size', ctypes.c_uint32),
|
||||
('second_addr', ctypes.c_uint32),
|
||||
|
||||
('tags_addr', ctypes.c_uint32),
|
||||
('page_size', ctypes.c_uint32),
|
||||
('unused', ctypes.c_uint32),
|
||||
|
||||
('os_version', ctypes.c_uint32),
|
||||
|
||||
('name', ctypes.c_char * BOOT_NAME_SIZE),
|
||||
('cmdline', ctypes.c_char * BOOT_ARGS_SIZE),
|
||||
('id', ctypes.c_char * 8),
|
||||
|
||||
('extra_cmdline', ctypes.c_char * BOOT_EXTRA_ARGS_SIZE),
|
||||
]
|
||||
|
||||
class BootImage(object):
|
||||
def __init__(self, data):
|
||||
self.data = data
|
||||
self.header = boot_img_hdr.from_buffer_copy(data)
|
||||
|
||||
PAGE = self.page_size
|
||||
|
||||
# The kernel starts at the beginning of the second page.
|
||||
self.kernel = self.data[PAGE:PAGE+self.kernel_size]
|
||||
|
||||
def __getattr__(self, name):
|
||||
value = getattr(self.header, name, None)
|
||||
if value is not None:
|
||||
return value
|
||||
return getattr(super(BootImage, self), name)
|
||||
@@ -0,0 +1,124 @@
|
||||
from __future__ import unicode_literals
|
||||
from __future__ import division
|
||||
|
||||
import ctypes
|
||||
import io
|
||||
import os
|
||||
import sys
|
||||
|
||||
from pwnlib.log import getLogger
|
||||
|
||||
log = getLogger(__name__)
|
||||
|
||||
class img_info(ctypes.Structure):
|
||||
_fields_ = [
|
||||
('name', ctypes.c_char * 64),
|
||||
('size', ctypes.c_uint32)
|
||||
]
|
||||
|
||||
class bootloader_images_header(ctypes.Structure):
|
||||
_fields_ = [
|
||||
('magic', ctypes.c_char * 8),
|
||||
('num_images', ctypes.c_uint32),
|
||||
('start_offset', ctypes.c_uint32),
|
||||
('bootldr_size', ctypes.c_uint32),
|
||||
]
|
||||
|
||||
BOOTLDR_MAGIC = b'BOOTLDR!'
|
||||
|
||||
class BootloaderImage(object):
|
||||
def __init__(self, data):
|
||||
"""Android Bootloader image
|
||||
|
||||
Arguments:
|
||||
data(str): Binary data from the image file.
|
||||
"""
|
||||
self.data = data
|
||||
self.header = bootloader_images_header.from_buffer_copy(data)
|
||||
|
||||
if self.magic != BOOTLDR_MAGIC:
|
||||
log.error("Incorrect magic (%r, expected %r)" % (self.magic, BOOTLDR_MAGIC))
|
||||
|
||||
if(self.bootldr_size > len(data)):
|
||||
log.warn_once("Bootloader is supposed to be %#x bytes, only have %#x",
|
||||
self.bootldr_size,
|
||||
len(data))
|
||||
|
||||
if(self.num_images >= 0x100):
|
||||
old = self.num_images
|
||||
self.num_images = 1
|
||||
log.warn_once("Bootloader num_images (%#x) appears corrupted, truncating to 1",
|
||||
old)
|
||||
|
||||
imgarray = ctypes.ARRAY(img_info, self.num_images)
|
||||
self.img_info = imgarray.from_buffer_copy(data, ctypes.sizeof(self.header))
|
||||
|
||||
def extract(self, index_or_name):
|
||||
"""extract(index_or_name) -> bytes
|
||||
|
||||
Extract the contents of an image.
|
||||
|
||||
Arguments:
|
||||
index_or_name(str,int): Either an image index or name.
|
||||
|
||||
Returns:
|
||||
Contents of the image.
|
||||
"""
|
||||
if isinstance(index_or_name, int):
|
||||
index = index_or_name
|
||||
else:
|
||||
for i in range(len(self.img_info)):
|
||||
if self.img_info[i].name == index_or_name:
|
||||
index = i
|
||||
break
|
||||
else:
|
||||
raise ValueError("Invalid img name: %r" % index_or_name)
|
||||
|
||||
if index >= len(self.img_info):
|
||||
raise ValueError("index out of range (%s, max %s)" % (index, len(self.img_info)))
|
||||
|
||||
offset = self.start_offset
|
||||
|
||||
for i in range(index):
|
||||
offset += self.img_info[i].size
|
||||
|
||||
return self.data[offset:offset + self.img_info[index].size]
|
||||
|
||||
def extract_all(self, path):
|
||||
"""extract_all(path)
|
||||
|
||||
Extracts all images to the provided path. The filenames are taken
|
||||
from the image name, with '.img' appended.
|
||||
"""
|
||||
if not os.path.isdir(path):
|
||||
raise ValueError("%r does not exist or is not a directory" % path)
|
||||
|
||||
for img in self.img_info:
|
||||
imgpath = os.path.join(path, img.name + '.img')
|
||||
with open(imgpath, 'wb+') as f:
|
||||
data = self.extract(img.name)
|
||||
f.write(data)
|
||||
|
||||
def __str__(self):
|
||||
rv = []
|
||||
rv.append("Bootloader")
|
||||
rv.append(" Magic: %r" % self.magic)
|
||||
rv.append(" Offset: %#x" % self.start_offset)
|
||||
rv.append(" Size: %#x" % self.bootldr_size)
|
||||
rv.append(" Images: %s" % self.num_images)
|
||||
for img in self.img_info:
|
||||
rv.append(" Name: %s" % img.name)
|
||||
rv.append(" Size: %#x" % img.size)
|
||||
rv.append(" Data: %r..." % self.extract(img.name)[:32])
|
||||
return '\n'.join(rv)
|
||||
|
||||
def __getattr__(self, name):
|
||||
value = getattr(self.header, name, None)
|
||||
if value is not None:
|
||||
return value
|
||||
return getattr(super(BootImage, self), name)
|
||||
|
||||
if __name__ == '__main__':
|
||||
# Easy sanity checking
|
||||
b = BootloaderImage(open(sys.argv[1], 'rb').read())
|
||||
print(b)
|
||||
+14
-3
@@ -23,7 +23,7 @@ this way.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ python -c 'from pwn import *; print args' A=1 B=Hello HOST=1.2.3.4 DEBUG
|
||||
$ python -c 'from pwn import *; print(args)' A=1 B=Hello HOST=1.2.3.4 DEBUG
|
||||
defaultdict(<type 'str'>, {'A': '1', 'HOST': '1.2.3.4', 'B': 'Hello'})
|
||||
|
||||
This is very useful for conditional code, for example determining whether to
|
||||
@@ -37,10 +37,21 @@ not specified evaluate to an empty string.
|
||||
else:
|
||||
io = process('./pwnable')
|
||||
|
||||
Arguments can also be accessed directly with the dot operator, e.g.:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
if args.REMOTE:
|
||||
...
|
||||
|
||||
Any undefined arguments evaluate to an empty string, ``''``.
|
||||
|
||||
The full list of supported "magic arguments" and their effects are listed
|
||||
below.
|
||||
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
|
||||
import collections
|
||||
import logging
|
||||
@@ -75,7 +86,7 @@ def isident(s):
|
||||
Helper function to check whether a string is a valid identifier,
|
||||
as passed in on the command-line.
|
||||
"""
|
||||
first = string.uppercase + '_'
|
||||
first = string.ascii_uppercase + '_'
|
||||
body = string.digits + first
|
||||
if not s:
|
||||
return False
|
||||
@@ -184,7 +195,7 @@ def initialize():
|
||||
value = 'True'
|
||||
|
||||
if '=' in arg:
|
||||
arg, value = arg.split('=')
|
||||
arg, value = arg.split('=', 1)
|
||||
|
||||
if arg in hooks:
|
||||
sys.argv.remove(orig)
|
||||
|
||||
+61
-53
@@ -16,39 +16,38 @@ Assembly
|
||||
To assemble code, simply invoke :func:`asm` on the code to assemble.
|
||||
|
||||
>>> asm('mov eax, 0')
|
||||
'\xb8\x00\x00\x00\x00'
|
||||
b'\xb8\x00\x00\x00\x00'
|
||||
|
||||
Additionally, you can use constants as defined in the :mod:`pwnlib.constants`
|
||||
module.
|
||||
|
||||
>>> asm('mov eax, SYS_execve')
|
||||
'\xb8\x0b\x00\x00\x00'
|
||||
b'\xb8\x0b\x00\x00\x00'
|
||||
|
||||
Finally, :func:`asm` is used to assemble shellcode provided by ``pwntools``
|
||||
in the :mod:`shellcraft` module.
|
||||
|
||||
>>> asm(shellcraft.nop())
|
||||
'\x90'
|
||||
b'\x90'
|
||||
|
||||
Disassembly
|
||||
------------------------
|
||||
|
||||
To disassemble code, simply invoke :func:`disasm` on the bytes to disassemble.
|
||||
|
||||
>>> disasm('\xb8\x0b\x00\x00\x00')
|
||||
' 0: b8 0b 00 00 00 mov eax,0xb'
|
||||
>>> disasm(b'\xb8\x0b\x00\x00\x00')
|
||||
' 0: b8 0b 00 00 00 mov eax, 0xb'
|
||||
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
|
||||
import errno
|
||||
import os
|
||||
import platform
|
||||
import re
|
||||
import shutil
|
||||
import string
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
from collections import defaultdict
|
||||
from glob import glob
|
||||
@@ -90,7 +89,7 @@ def dpkg_search_for_binutils(arch, util):
|
||||
|
||||
try:
|
||||
filename = 'bin/%s*linux*-%s' % (arch, util)
|
||||
output = subprocess.check_output(['dpkg','-S',filename])
|
||||
output = subprocess.check_output(['dpkg','-S',filename], universal_newlines = True)
|
||||
for line in output.strip().splitlines():
|
||||
package, path = line.split(':', 1)
|
||||
packages.append(package)
|
||||
@@ -160,7 +159,6 @@ def which_binutils(util):
|
||||
Exception: Could not find 'as' installed for ContextType(arch = 'msp430')
|
||||
"""
|
||||
arch = context.arch
|
||||
bits = context.bits
|
||||
|
||||
# Fix up pwntools vs Debian triplet naming, and account
|
||||
# for 'thumb' being its own pwntools architecture.
|
||||
@@ -244,7 +242,7 @@ def _assembler():
|
||||
if not checked_assembler_version[gas]:
|
||||
checked_assembler_version[gas] = True
|
||||
result = subprocess.check_output([gas, '--version','/dev/null'],
|
||||
stderr=subprocess.STDOUT)
|
||||
stderr=subprocess.STDOUT, universal_newlines=True)
|
||||
version = re.search(r' (\d\.\d+)', result).group(1)
|
||||
if version < '2.19':
|
||||
log.warn_once('Your binutils version is too old and may not work!\n' + \
|
||||
@@ -364,7 +362,8 @@ def _run(cmd, stdin = None):
|
||||
cmd,
|
||||
stdin = subprocess.PIPE,
|
||||
stdout = subprocess.PIPE,
|
||||
stderr = subprocess.PIPE
|
||||
stderr = subprocess.PIPE,
|
||||
universal_newlines = True
|
||||
)
|
||||
stdout, stderr = proc.communicate(stdin)
|
||||
exitcode = proc.wait()
|
||||
@@ -409,8 +408,6 @@ def cpp(shellcode):
|
||||
>>> cpp("SYS_setresuid", os = "freebsd")
|
||||
'311\n'
|
||||
"""
|
||||
arch = context.arch
|
||||
os = context.os
|
||||
code = _include_header() + shellcode
|
||||
cmd = [
|
||||
'cpp',
|
||||
@@ -474,7 +471,7 @@ def make_elf_from_assembly(assembly,
|
||||
>>> sc += shellcraft.echo('Hello\n')
|
||||
>>> sc += 'mov rsp, rbp; pop rbp; ret'
|
||||
>>> solib = make_elf_from_assembly(sc, shared=1)
|
||||
>>> subprocess.check_output(['echo', 'World'], env={'LD_PRELOAD': solib})
|
||||
>>> subprocess.check_output(['echo', 'World'], env={'LD_PRELOAD': solib}, universal_newlines = True)
|
||||
'Hello\nWorld\n'
|
||||
|
||||
The same thing can be done with :func:`.make_elf`, though the sizes
|
||||
@@ -507,7 +504,7 @@ def make_elf_from_assembly(assembly,
|
||||
result = asm(assembly, vma = vma, shared = shared, extract = False, **kwargs)
|
||||
|
||||
if not extract:
|
||||
os.chmod(result, 0755)
|
||||
os.chmod(result, 0o755)
|
||||
else:
|
||||
with open(result, 'rb') as io:
|
||||
result = io.read()
|
||||
@@ -540,12 +537,12 @@ def make_elf(data,
|
||||
execve('/bin/sh',...).
|
||||
|
||||
>>> context.clear(arch='i386')
|
||||
>>> bin_sh = '6a68682f2f2f73682f62696e89e331c96a0b5899cd80'.decode('hex')
|
||||
>>> bin_sh = unhex('6a68682f2f2f73682f62696e89e331c96a0b5899cd80')
|
||||
>>> filename = make_elf(bin_sh, extract=False)
|
||||
>>> p = process(filename)
|
||||
>>> p.sendline('echo Hello; exit')
|
||||
>>> p.sendline(b'echo Hello; exit')
|
||||
>>> p.recvline()
|
||||
'Hello\n'
|
||||
b'Hello\n'
|
||||
"""
|
||||
retval = None
|
||||
|
||||
@@ -562,7 +559,7 @@ def make_elf(data,
|
||||
assembler = _assembler()
|
||||
linker = _linker()
|
||||
code = _arch_header()
|
||||
code += '.string "%s"' % ''.join('\\x%02x' % ord(c) for c in data)
|
||||
code += '.string "%s"' % ''.join('\\x%02x' % c for c in bytearray(data))
|
||||
code += '\n'
|
||||
|
||||
log.debug("Building ELF:\n" + code)
|
||||
@@ -573,7 +570,7 @@ def make_elf(data,
|
||||
step3 = path.join(tmpdir, 'step3-elf')
|
||||
|
||||
try:
|
||||
with open(step1, 'wb+') as f:
|
||||
with open(step1, 'w') as f:
|
||||
f.write(code)
|
||||
|
||||
_run(assembler + ['-o', step2, step1])
|
||||
@@ -594,11 +591,11 @@ def make_elf(data,
|
||||
_run([which_binutils('strip'), '--strip-unneeded', step3])
|
||||
|
||||
if not extract:
|
||||
os.chmod(step3, 0755)
|
||||
os.chmod(step3, 0o755)
|
||||
retval = step3
|
||||
|
||||
else:
|
||||
with open(step3, 'r') as f:
|
||||
with open(step3, 'rb') as f:
|
||||
retval = f.read()
|
||||
except Exception:
|
||||
log.exception("An error occurred while building an ELF:\n%s" % code)
|
||||
@@ -614,7 +611,7 @@ def asm(shellcode, vma = 0, extract = True, shared = False):
|
||||
Runs :func:`cpp` over a given shellcode and then assembles it into bytes.
|
||||
|
||||
To see which architectures or operating systems are supported,
|
||||
look in :mod:`pwnlib.contex`.
|
||||
look in :mod:`pwnlib.context`.
|
||||
|
||||
Assembling shellcode requires that the GNU assembler is installed
|
||||
for the target architecture.
|
||||
@@ -633,13 +630,13 @@ def asm(shellcode, vma = 0, extract = True, shared = False):
|
||||
Examples:
|
||||
|
||||
>>> asm("mov eax, SYS_select", arch = 'i386', os = 'freebsd')
|
||||
'\xb8]\x00\x00\x00'
|
||||
b'\xb8]\x00\x00\x00'
|
||||
>>> asm("mov eax, SYS_select", arch = 'amd64', os = 'linux')
|
||||
'\xb8\x17\x00\x00\x00'
|
||||
b'\xb8\x17\x00\x00\x00'
|
||||
>>> asm("mov rax, SYS_select", arch = 'amd64', os = 'linux')
|
||||
'H\xc7\xc0\x17\x00\x00\x00'
|
||||
b'H\xc7\xc0\x17\x00\x00\x00'
|
||||
>>> asm("mov r0, #SYS_select", arch = 'arm', os = 'linux', bits=32)
|
||||
'R\x00\xa0\xe3'
|
||||
b'R\x00\xa0\xe3'
|
||||
"""
|
||||
result = ''
|
||||
|
||||
@@ -687,10 +684,11 @@ def asm(shellcode, vma = 0, extract = True, shared = False):
|
||||
|
||||
_run(linker + ldflags)
|
||||
|
||||
elif file(step2,'rb').read(4) == '\x7fELF':
|
||||
elif open(step2,'rb').read(4) == b'\x7fELF':
|
||||
# Sanity check for seeing if the output has relocations
|
||||
relocs = subprocess.check_output(
|
||||
[which_binutils('readelf'), '-r', step2]
|
||||
[which_binutils('readelf'), '-r', step2],
|
||||
universal_newlines = True
|
||||
).strip()
|
||||
if extract and len(relocs.split('\n')) > 1:
|
||||
log.error('Shellcode contains relocations:\n%s' % relocs)
|
||||
@@ -702,7 +700,7 @@ def asm(shellcode, vma = 0, extract = True, shared = False):
|
||||
|
||||
_run(objcopy + [step3, step4])
|
||||
|
||||
with open(step4) as fd:
|
||||
with open(step4, 'rb') as fd:
|
||||
result = fd.read()
|
||||
|
||||
except Exception:
|
||||
@@ -722,9 +720,6 @@ def disasm(data, vma = 0, byte = True, offset = True, instructions = True):
|
||||
To see which architectures are supported,
|
||||
look in :mod:`pwnlib.contex`.
|
||||
|
||||
To support all these architecture, we bundle the GNU objcopy
|
||||
and objdump with pwntools.
|
||||
|
||||
Arguments:
|
||||
data(str): Bytestring to disassemble.
|
||||
vma(int): Passed through to the --adjust-vma argument of objdump
|
||||
@@ -736,26 +731,28 @@ def disasm(data, vma = 0, byte = True, offset = True, instructions = True):
|
||||
|
||||
Examples:
|
||||
|
||||
>>> print disasm('b85d000000'.decode('hex'), arch = 'i386')
|
||||
0: b8 5d 00 00 00 mov eax,0x5d
|
||||
>>> print disasm('b85d000000'.decode('hex'), arch = 'i386', byte = 0)
|
||||
0: mov eax,0x5d
|
||||
>>> print disasm('b85d000000'.decode('hex'), arch = 'i386', byte = 0, offset = 0)
|
||||
mov eax,0x5d
|
||||
>>> print disasm('b817000000'.decode('hex'), arch = 'amd64')
|
||||
0: b8 17 00 00 00 mov eax,0x17
|
||||
>>> print disasm('48c7c017000000'.decode('hex'), arch = 'amd64')
|
||||
0: 48 c7 c0 17 00 00 00 mov rax,0x17
|
||||
>>> print disasm('04001fe552009000'.decode('hex'), arch = 'arm')
|
||||
>>> print(disasm(unhex('b85d000000'), arch = 'i386'))
|
||||
0: b8 5d 00 00 00 mov eax, 0x5d
|
||||
>>> print(disasm(unhex('b85d000000'), arch = 'i386', byte = 0))
|
||||
0: mov eax, 0x5d
|
||||
>>> print(disasm(unhex('b85d000000'), arch = 'i386', byte = 0, offset = 0))
|
||||
mov eax, 0x5d
|
||||
>>> print(disasm(unhex('b817000000'), arch = 'amd64'))
|
||||
0: b8 17 00 00 00 mov eax, 0x17
|
||||
>>> print(disasm(unhex('48c7c017000000'), arch = 'amd64'))
|
||||
0: 48 c7 c0 17 00 00 00 mov rax, 0x17
|
||||
>>> print(disasm(unhex('04001fe552009000'), arch = 'arm'))
|
||||
0: e51f0004 ldr r0, [pc, #-4] ; 0x4
|
||||
4: 00900052 addseq r0, r0, r2, asr r0
|
||||
>>> print disasm('4ff00500'.decode('hex'), arch = 'thumb', bits=32)
|
||||
>>> print(disasm(unhex('4ff00500'), arch = 'thumb', bits=32))
|
||||
0: f04f 0005 mov.w r0, #5
|
||||
>>> print(disasm(unhex('656664676665400F18A4000000000051'), byte=0, arch='amd64'))
|
||||
0: gs data16 fs data16 rex nop/reserved BYTE PTR gs:[eax+eax*1+0x0]
|
||||
f: push rcx
|
||||
"""
|
||||
result = ''
|
||||
|
||||
arch = context.arch
|
||||
os = context.os
|
||||
|
||||
tmpdir = tempfile.mkdtemp(prefix = 'pwn-disasm-')
|
||||
step1 = path.join(tmpdir, 'step1')
|
||||
@@ -772,6 +769,9 @@ def disasm(data, vma = 0, byte = True, offset = True, instructions = True):
|
||||
'--rename-section', '.data=.text',
|
||||
]
|
||||
|
||||
if not byte:
|
||||
objdump += ['--no-show-raw-insn']
|
||||
|
||||
if arch == 'thumb':
|
||||
objcopy += ['--prefix-symbol=$t.']
|
||||
else:
|
||||
@@ -779,10 +779,10 @@ def disasm(data, vma = 0, byte = True, offset = True, instructions = True):
|
||||
|
||||
try:
|
||||
|
||||
with open(step1, 'w') as fd:
|
||||
with open(step1, 'wb') as fd:
|
||||
fd.write(data)
|
||||
|
||||
res = _run(objcopy + [step1, step2])
|
||||
_run(objcopy + [step1, step2])
|
||||
|
||||
output0 = _run(objdump + [step2])
|
||||
output1 = output0.split('<.text>:\n')
|
||||
@@ -798,14 +798,22 @@ def disasm(data, vma = 0, byte = True, offset = True, instructions = True):
|
||||
|
||||
|
||||
lines = []
|
||||
pattern = '^( *[0-9a-f]+: *)((?:[0-9a-f]+ )+ *)(.*)'
|
||||
pattern = '^( *[0-9a-f]+: *)', '((?:[0-9a-f]+ )+ *)', '(.*)'
|
||||
if not byte:
|
||||
pattern = pattern[::2]
|
||||
pattern = ''.join(pattern)
|
||||
for line in result.splitlines():
|
||||
try:
|
||||
o, b, i = re.search(pattern, line).groups()
|
||||
except:
|
||||
match = re.search(pattern, line)
|
||||
if not match:
|
||||
lines.append(line)
|
||||
continue
|
||||
|
||||
groups = match.groups()
|
||||
if byte:
|
||||
o, b, i = groups
|
||||
else:
|
||||
o, i = groups
|
||||
|
||||
line = ''
|
||||
|
||||
if offset:
|
||||
@@ -816,4 +824,4 @@ def disasm(data, vma = 0, byte = True, offset = True, instructions = True):
|
||||
line += i
|
||||
lines.append(line)
|
||||
|
||||
return '\n'.join(lines)
|
||||
return re.sub(',([^ ])', r', \1', '\n'.join(lines))
|
||||
@@ -3,6 +3,7 @@ Analogous to atexit, this module allows the programmer to register functions to
|
||||
be run if an unhandled exception occurs.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
|
||||
import sys
|
||||
import threading
|
||||
|
||||
@@ -8,6 +8,7 @@ This module also fixes a the issue that exceptions raised by an exit handler is
|
||||
printed twice when the standard :mod:`atexit` is used.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
|
||||
import sys
|
||||
import threading
|
||||
|
||||
+16
-11
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env python2
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
@@ -29,8 +30,8 @@ parser.add_argument(
|
||||
"-o","--output",
|
||||
metavar='file',
|
||||
help="Output file (defaults to stdout)",
|
||||
type=argparse.FileType('w'),
|
||||
default=sys.stdout
|
||||
type=argparse.FileType('wb'),
|
||||
default=getattr(sys.stdout, 'buffer', sys.stdout)
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
@@ -45,14 +46,14 @@ parser.add_argument(
|
||||
parser.add_argument(
|
||||
'-v', '--avoid',
|
||||
action='append',
|
||||
help = 'Encode the shellcode to avoid the listed bytes (provided as hex; default: 000a)'
|
||||
help = 'Encode the shellcode to avoid the listed bytes (provided as hex)'
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'-n', '--newline',
|
||||
dest='avoid',
|
||||
action='append_const',
|
||||
const='\n',
|
||||
const='0a',
|
||||
help = 'Encode the shellcode to avoid newlines'
|
||||
)
|
||||
|
||||
@@ -60,7 +61,7 @@ parser.add_argument(
|
||||
'-z', '--zero',
|
||||
dest='avoid',
|
||||
action='append_const',
|
||||
const='\x00',
|
||||
const='00',
|
||||
help = 'Encode the shellcode to avoid NULL bytes'
|
||||
)
|
||||
|
||||
@@ -83,7 +84,7 @@ parser.add_argument(
|
||||
'--infile',
|
||||
help="Specify input file",
|
||||
default=sys.stdin,
|
||||
type=file
|
||||
type=argparse.FileType('r')
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
@@ -103,10 +104,11 @@ def main(args):
|
||||
data = '\n'.join(args.lines) or args.infile.read()
|
||||
output = asm(data.replace(';', '\n'))
|
||||
fmt = args.format or ('hex' if tty else 'raw')
|
||||
formatters = {'r':str, 'h':enhex, 's':repr}
|
||||
formatters = {'r':bytes, 'h':enhex, 's':repr}
|
||||
|
||||
if args.avoid:
|
||||
output = encode(output, args.avoid)
|
||||
avoid = unhex(''.join(args.avoid))
|
||||
output = encode(output, avoid)
|
||||
|
||||
if args.debug:
|
||||
proc = gdb.debug_shellcode(output, arch=context.arch)
|
||||
@@ -120,13 +122,16 @@ def main(args):
|
||||
|
||||
if fmt[0] == 'e':
|
||||
args.output.write(make_elf(output))
|
||||
try: os.fchmod(args.output.fileno(), 0700)
|
||||
try: os.fchmod(args.output.fileno(), 0o700)
|
||||
except OSError: pass
|
||||
else:
|
||||
args.output.write(formatters[fmt[0]](output))
|
||||
output = formatters[fmt[0]](output)
|
||||
if not hasattr(output, 'decode'):
|
||||
output = output.encode('ascii')
|
||||
args.output.write(output)
|
||||
|
||||
if tty and fmt is not 'raw':
|
||||
args.output.write('\n')
|
||||
args.output.write(b'\n')
|
||||
|
||||
if __name__ == '__main__':
|
||||
pwnlib.commandline.common.main(__file__)
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env python2
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
@@ -14,7 +15,7 @@ parser = common.parser_commands.add_parser(
|
||||
parser.add_argument(
|
||||
'elf',
|
||||
nargs='*',
|
||||
type=file,
|
||||
type=argparse.FileType('rb'),
|
||||
help='Files to check'
|
||||
)
|
||||
parser.add_argument(
|
||||
@@ -22,7 +23,7 @@ parser.add_argument(
|
||||
nargs='*',
|
||||
dest='elf2',
|
||||
metavar='elf',
|
||||
type=file,
|
||||
type=argparse.FileType('rb'),
|
||||
help='File to check (for compatibility with checksec.sh)'
|
||||
)
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import sys
|
||||
import pwnlib
|
||||
from pwnlib.context import context
|
||||
|
||||
choices = map(str, [16,32,64])
|
||||
choices = list(map(str, [16,32,64]))
|
||||
choices += list(context.oses)
|
||||
choices += list(context.architectures)
|
||||
choices += list(context.endiannesses)
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#!/usr/bin/env python2
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
|
||||
import argparse
|
||||
import functools
|
||||
import os
|
||||
import re
|
||||
|
||||
@@ -63,7 +65,7 @@ p.add_argument(
|
||||
def main(args):
|
||||
if args.exact:
|
||||
# This is the simple case
|
||||
print cpp(args.exact).strip()
|
||||
print(cpp(args.exact).strip())
|
||||
else:
|
||||
# New we search in the right module.
|
||||
# But first: We find the right module
|
||||
@@ -117,7 +119,7 @@ def main(args):
|
||||
|
||||
# Output all matching constants
|
||||
for _, k in sorted(out):
|
||||
print '#define %s %s' % (k.ljust(maxlen), cpp(k).strip())
|
||||
print('#define %s %s' % (k.ljust(maxlen), cpp(k).strip()))
|
||||
|
||||
# If we are in match_mode, then try to find a combination of
|
||||
# constants that yield the exact given value
|
||||
@@ -134,9 +136,9 @@ def main(args):
|
||||
|
||||
out = [(v, k) for v, k in out if mask & v == v]
|
||||
|
||||
if reduce(lambda x, cur: x | cur[0], good, 0) == constant:
|
||||
print
|
||||
print '(%s) == %s' % (' | '.join(k for v, k in good), args.constant)
|
||||
if functools.reduce(lambda x, cur: x | cur[0], good, 0) == constant:
|
||||
print('')
|
||||
print('(%s) == %s' % (' | '.join(k for v, k in good), args.constant))
|
||||
|
||||
if __name__ == '__main__':
|
||||
pwnlib.commandline.common.main(__file__)
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env python2
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
|
||||
import argparse
|
||||
import string
|
||||
@@ -81,7 +82,7 @@ def main(args):
|
||||
log.critical('Given pattern does not exist in cyclic pattern')
|
||||
sys.exit(1)
|
||||
else:
|
||||
print offset
|
||||
print(offset)
|
||||
else:
|
||||
want = args.count
|
||||
result = cyclic(want, alphabet, subsize)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env python2
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
@@ -13,7 +14,7 @@ parser = common.parser_commands.add_parser(
|
||||
)
|
||||
parser.add_argument(
|
||||
'-x', metavar='GDBSCRIPT',
|
||||
type=file,
|
||||
type=argparse.FileType('r'),
|
||||
help='Execute GDB commands from this file.'
|
||||
)
|
||||
parser.add_argument(
|
||||
@@ -30,13 +31,25 @@ parser.add_argument(
|
||||
help = 'The os/architecture/endianness/bits the shellcode will run in (default: linux/i386), choose from: %s' % common.choices,
|
||||
)
|
||||
parser.add_argument(
|
||||
'--exec', type=file, dest='executable',
|
||||
'--exec',
|
||||
|
||||
# NOTE: Type cannot be "file" because we may be referring to a remote
|
||||
# file, or a file on an Android device.
|
||||
type=str,
|
||||
|
||||
dest='executable',
|
||||
help='File to debug'
|
||||
)
|
||||
parser.add_argument(
|
||||
'--process', metavar='PROCESS_NAME',
|
||||
help='Name of the process to attach to (e.g. "bash")'
|
||||
)
|
||||
parser.add_argument(
|
||||
'--sysroot', metavar='SYSROOT',
|
||||
type=str,
|
||||
default='',
|
||||
help="GDB sysroot path"
|
||||
)
|
||||
|
||||
def main(args):
|
||||
gdbscript = ''
|
||||
@@ -47,23 +60,46 @@ def main(args):
|
||||
context.device = adb.wait_for_device()
|
||||
|
||||
if args.executable:
|
||||
context.binary = ELF(args.executable.name)
|
||||
target = context.binary.path
|
||||
if os.path.exists(args.executable):
|
||||
context.binary = ELF(args.executable)
|
||||
target = context.binary.path
|
||||
|
||||
# This path does nothing, but avoids the "print_usage()"
|
||||
# path below.
|
||||
elif context.os == 'android':
|
||||
target = args.executable
|
||||
elif args.pid:
|
||||
target = int(args.pid)
|
||||
elif args.process:
|
||||
if context.os == 'android':
|
||||
target = adb.pidof(process)
|
||||
target = adb.pidof(args.process)
|
||||
else:
|
||||
target = pidof(process)
|
||||
target = pidof(args.process)
|
||||
|
||||
# pidof() returns a list
|
||||
if not target:
|
||||
log.error("Could not find a PID for %r", args.process)
|
||||
|
||||
target = target[0]
|
||||
|
||||
# pidof will sometimes return all PIDs, including init
|
||||
if target == 1:
|
||||
log.error("Got PID 1 from pidof. Check the process name, or use --pid 1 to debug init")
|
||||
else:
|
||||
parser.print_usage()
|
||||
return 1
|
||||
|
||||
if args.pid or args.process:
|
||||
gdb.attach(target, gdbscript=gdbscript)
|
||||
pid = gdb.attach(target, gdbscript=gdbscript, sysroot=args.sysroot)
|
||||
|
||||
# Since we spawned the gdbserver process, and process registers an
|
||||
# atexit handler to close itself, gdbserver will be terminated when
|
||||
# we exit. This will manifest as a "remote connected ended" or
|
||||
# similar error message. Hold it open for the user.
|
||||
log.info("GDB connection forwarding will terminate when you press enter")
|
||||
pause()
|
||||
else:
|
||||
gdb.debug(target, gdbscript=gdbscript).interactive()
|
||||
gdb.debug(target, gdbscript=gdbscript, sysroot=args.sysroot).interactive()
|
||||
|
||||
if __name__ == '__main__':
|
||||
pwnlib.commandline.common.main(__file__)
|
||||
@@ -1,6 +1,8 @@
|
||||
#!/usr/bin/env python2
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
|
||||
import argparse
|
||||
from pwn import *
|
||||
from pwnlib.commandline import common
|
||||
|
||||
@@ -11,7 +13,7 @@ parser = common.parser_commands.add_parser(
|
||||
parser.add_argument(
|
||||
'elf',
|
||||
nargs='+',
|
||||
type=file,
|
||||
type=argparse.FileType('rb'),
|
||||
help='Files to check'
|
||||
)
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env python2
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import string
|
||||
@@ -20,7 +22,7 @@ parser.add_argument(
|
||||
'hex',
|
||||
metavar = 'hex',
|
||||
nargs = '*',
|
||||
help = 'Hex-string to disasemble. If none are supplied, then it uses stdin in non-hex mode.'
|
||||
help = 'Hex-string to disassemble. If none are supplied, then it uses stdin in non-hex mode.'
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
@@ -59,14 +61,14 @@ parser.add_argument(
|
||||
|
||||
def main(args):
|
||||
if len(args.hex) > 0:
|
||||
dat = ''.join(args.hex)
|
||||
dat = dat.translate(None, string.whitespace)
|
||||
if not set(string.hexdigits) >= set(dat):
|
||||
print "This is not a hex string"
|
||||
dat = ''.join(args.hex).encode('utf-8', 'surrogateescape')
|
||||
dat = dat.translate(None, string.whitespace.encode('ascii'))
|
||||
if not set(string.hexdigits.encode('ascii')) >= set(dat):
|
||||
print("This is not a hex string")
|
||||
exit(-1)
|
||||
dat = dat.decode('hex')
|
||||
dat = unhex(dat)
|
||||
else:
|
||||
dat = sys.stdin.read()
|
||||
dat = getattr(sys.stdin, 'buffer', sys.stdin).read()
|
||||
|
||||
|
||||
if args.color:
|
||||
@@ -79,17 +81,16 @@ def main(args):
|
||||
instrs = disasm(dat, vma=safeeval.const(args.address), byte=False, offset=False)
|
||||
# instrs = highlight(instrs, PwntoolsLexer(), TerminalFormatter())
|
||||
|
||||
split = lambda x: x.splitlines()
|
||||
for o,b,i in zip(*list(map(split, (offsets, bytes, instrs)))):
|
||||
for o,b,i in zip(*map(str.splitlines, (offsets, bytes, instrs))):
|
||||
b = b.replace('00', text.red('00'))
|
||||
b = b.replace('0a', text.red('0a'))
|
||||
i = highlight(i.strip(), PwntoolsLexer(), TerminalFormatter()).strip()
|
||||
i = i.replace(',',', ')
|
||||
|
||||
print o,b,i
|
||||
print(o,b,i)
|
||||
return
|
||||
|
||||
print disasm(dat, vma=safeeval.const(args.address))
|
||||
print(disasm(dat, vma=safeeval.const(args.address)))
|
||||
|
||||
if __name__ == '__main__':
|
||||
pwnlib.commandline.common.main(__file__)
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env python2
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
|
||||
import shutil
|
||||
from argparse import ArgumentParser
|
||||
@@ -22,7 +23,7 @@ def dump(objdump, path):
|
||||
return n.name
|
||||
|
||||
def diff(a,b):
|
||||
try: return check_output(['diff',a,b])
|
||||
try: return check_output(['diff',a,b], universal_newlines=True)
|
||||
except CalledProcessError as e:
|
||||
return e.output
|
||||
|
||||
@@ -55,7 +56,7 @@ def main(a):
|
||||
shutil.copy(y.path, name)
|
||||
y = dump(objdump, name)
|
||||
|
||||
print diff(x, y)
|
||||
print(diff(x, y))
|
||||
|
||||
if __name__ == '__main__':
|
||||
pwnlib.commandline.common.main(__file__)
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python2
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
import pwnlib
|
||||
@@ -15,7 +15,6 @@ p = common.parser_commands.add_parser(
|
||||
help = 'Patch an ELF file'
|
||||
)
|
||||
|
||||
p = argparse.ArgumentParser()
|
||||
p.add_argument('elf',help="File to patch")
|
||||
p.add_argument('offset',help="Offset to patch in virtual address (hex encoded)")
|
||||
p.add_argument('bytes',help='Bytes to patch (hex encoded)')
|
||||
@@ -32,7 +31,7 @@ def main(a):
|
||||
elf = ELF(a.elf)
|
||||
|
||||
elf.write(offset, bytes)
|
||||
sys.stdout.write(elf.get_data())
|
||||
getattr(sys.stdout, 'buffer', sys.stdout).write(elf.get_data())
|
||||
|
||||
if __name__ == '__main__':
|
||||
pwnlib.commandline.common.main(__file__)
|
||||
@@ -1,7 +1,8 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, print_function
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import errno
|
||||
|
||||
from pwnlib.commandline import common
|
||||
|
||||
@@ -24,24 +25,24 @@ def main(args):
|
||||
if 0x100000000 - value < 0x200:
|
||||
value = 0x100000000 - value
|
||||
|
||||
if value not in os.errno.errorcode:
|
||||
print "No errno for %s" % value
|
||||
if value not in errno.errorcode:
|
||||
print("No errno for %s" % value)
|
||||
return
|
||||
|
||||
name = os.errno.errorcode[value]
|
||||
name = errno.errorcode[value]
|
||||
|
||||
except ValueError:
|
||||
name = args.error.upper()
|
||||
|
||||
if not hasattr(os.errno, name):
|
||||
print "No errno for %s" % name
|
||||
if not hasattr(errno, name):
|
||||
print("No errno for %s" % name)
|
||||
return
|
||||
|
||||
value = getattr(os.errno, name)
|
||||
value = getattr(errno, name)
|
||||
|
||||
|
||||
print '#define', name, value
|
||||
print os.strerror(value)
|
||||
print('#define', name, value)
|
||||
print(os.strerror(value))
|
||||
|
||||
if __name__ == '__main__':
|
||||
pwnlib.commandline.common.main(__file__)
|
||||
@@ -1,10 +1,12 @@
|
||||
#!/usr/bin/env python2
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
from pwnlib.commandline import common
|
||||
from pwnlib.util.fiddling import enhex
|
||||
|
||||
parser = common.parser_commands.add_parser(
|
||||
'hex',
|
||||
@@ -16,9 +18,12 @@ parser.add_argument('data', nargs='*',
|
||||
|
||||
def main(args):
|
||||
if not args.data:
|
||||
print sys.stdin.read().encode('hex')
|
||||
print(enhex(getattr(sys.stdin, 'buffer', sys.stdin).read()))
|
||||
else:
|
||||
print ' '.join(args.data).encode('hex')
|
||||
data = ' '.join(args.data)
|
||||
if not hasattr(data, 'decode'):
|
||||
data = data.encode('utf-8', 'surrogateescape')
|
||||
print(enhex(data))
|
||||
|
||||
if __name__ == '__main__':
|
||||
pwnlib.commandline.common.main(__file__)
|
||||
@@ -46,6 +46,9 @@ commands = {
|
||||
}
|
||||
|
||||
def main():
|
||||
if len(sys.argv) < 2:
|
||||
parser.print_usage()
|
||||
sys.exit()
|
||||
args = parser.parse_args()
|
||||
with context.local(log_console = sys.stderr):
|
||||
commands[args.command](args)
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#!/usr/bin/env python2
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
import io
|
||||
|
||||
import pwnlib
|
||||
pwnlib.args.free_form = False
|
||||
@@ -21,8 +23,8 @@ parser.add_argument(
|
||||
metavar='file',
|
||||
nargs='?',
|
||||
help='File to hexdump. Reads from stdin if missing.',
|
||||
type=argparse.FileType('r'),
|
||||
default=sys.stdin
|
||||
type=argparse.FileType('rb'),
|
||||
default=getattr(sys.stdin, 'buffer', sys.stdin)
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
@@ -88,6 +90,9 @@ def main(args):
|
||||
else:
|
||||
infile.seek(skip, os.SEEK_CUR)
|
||||
|
||||
if count:
|
||||
infile = io.BytesIO(infile.read(count))
|
||||
|
||||
hl = []
|
||||
if args.highlight:
|
||||
for hs in args.highlight:
|
||||
@@ -96,7 +101,7 @@ def main(args):
|
||||
|
||||
try:
|
||||
for line in hexdump_iter(infile, width, highlight = hl, begin = offset + skip):
|
||||
print line
|
||||
print(line)
|
||||
except (KeyboardInterrupt, IOError):
|
||||
pass
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
|
||||
import argparse
|
||||
|
||||
@@ -16,8 +17,8 @@ p = common.parser_commands.add_parser(
|
||||
g = p.add_argument_group("actions")
|
||||
g.add_argument('-b', '--build-id', help="Strip build ID", action='store_true')
|
||||
g.add_argument('-p', '--patch', metavar='FUNCTION', help="Patch function", action='append')
|
||||
p.add_argument('-o', '--output', type=file, default=sys.stdout)
|
||||
p.add_argument('file', type=file)
|
||||
p.add_argument('-o', '--output', type=argparse.FileType('wb'), default=getattr(sys.stdout, 'buffer', sys.stdout))
|
||||
p.add_argument('file', type=argparse.FileType('rb'))
|
||||
|
||||
def main(args):
|
||||
if not (args.patch or args.build_id):
|
||||
@@ -32,7 +33,7 @@ def main(args):
|
||||
for offset in pwnlib.libcdb.get_build_id_offsets():
|
||||
data = elf.read(elf.address + offset + 0xC, 4)
|
||||
if data == 'GNU\x00':
|
||||
elf.write(elf.address + offset + 0x10, read('/dev/urandom', 20))
|
||||
elf.write(elf.address + offset + 0x10, os.urandom(20))
|
||||
|
||||
for function in args.patch:
|
||||
if function not in elf.symbols:
|
||||
@@ -46,7 +47,7 @@ def main(args):
|
||||
result = elf.data
|
||||
|
||||
if args.output.isatty():
|
||||
result = enhex(result)
|
||||
result = enhex(result).encode('ascii')
|
||||
|
||||
args.output.write(result)
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
@@ -24,8 +25,8 @@ parser.add_argument(
|
||||
"-o","--output",
|
||||
metavar='file',
|
||||
help="Output file (defaults to stdout)",
|
||||
type=argparse.FileType('w'),
|
||||
default=sys.stdout
|
||||
type=argparse.FileType('wb'),
|
||||
default=getattr(sys.stdout, 'buffer', sys.stdout)
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
@@ -82,7 +83,7 @@ def main(args):
|
||||
data = sys.stdin.read()
|
||||
output = data
|
||||
fmt = args.format or ('hex' if tty else 'raw')
|
||||
formatters = {'r':str, 'h':enhex, 's':repr}
|
||||
formatters = {'r':bytes, 'h':enhex, 's':repr}
|
||||
|
||||
if args.alphanumeric:
|
||||
output = alphanumeric(output)
|
||||
@@ -98,10 +99,13 @@ def main(args):
|
||||
if fmt[0] == 'e':
|
||||
sys.stdout.write(make_elf(output))
|
||||
else:
|
||||
args.output.write(formatters[fmt[0]](output))
|
||||
output = formatters[fmt[0]](output)
|
||||
if not hasattr(output, 'decode'):
|
||||
output = output.encode('ascii')
|
||||
args.output.write(output)
|
||||
|
||||
if tty and fmt is not 'raw':
|
||||
args.output.write('\n')
|
||||
if tty and fmt != 'raw':
|
||||
args.output.write(b'\n')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#!/usr/bin/env python2
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import six
|
||||
import sys
|
||||
import types
|
||||
|
||||
@@ -21,8 +23,8 @@ from pwnlib.commandline import common
|
||||
|
||||
def _string(s):
|
||||
out = []
|
||||
for c in s:
|
||||
co = ord(c)
|
||||
for co in bytearray(s):
|
||||
c = chr(co)
|
||||
if co >= 0x20 and co <= 0x7e and c not in '/$\'"`':
|
||||
out.append(c)
|
||||
else:
|
||||
@@ -45,8 +47,8 @@ p.add_argument(
|
||||
p.add_argument(
|
||||
'-o', '--out',
|
||||
metavar = 'file',
|
||||
type = argparse.FileType('w'),
|
||||
default = sys.stdout,
|
||||
type = argparse.FileType('wb'),
|
||||
default = getattr(sys.stdout, 'buffer', sys.stdout),
|
||||
help = 'Output file (default: stdout)',
|
||||
)
|
||||
|
||||
@@ -164,6 +166,12 @@ p.add_argument(
|
||||
help='List available shellcodes, optionally provide a filter'
|
||||
)
|
||||
|
||||
p.add_argument(
|
||||
'-s', '--shared',
|
||||
action='store_true',
|
||||
help='Generated ELF is a shared library'
|
||||
)
|
||||
|
||||
def get_template(name):
|
||||
func = shellcraft
|
||||
for attr in name.split('.'):
|
||||
@@ -183,7 +191,7 @@ def main(args):
|
||||
elif not args.syscalls:
|
||||
templates = filter(is_not_a_syscall_template, templates)
|
||||
|
||||
print '\n'.join(templates)
|
||||
print('\n'.join(templates))
|
||||
exit()
|
||||
|
||||
if not args.shellcode:
|
||||
@@ -238,11 +246,11 @@ def main(args):
|
||||
if not in_doctest:
|
||||
doc.append(line)
|
||||
i += 1
|
||||
print '\n'.join(doc).rstrip()
|
||||
print('\n'.join(doc).rstrip())
|
||||
exit()
|
||||
|
||||
defargs = len(func.func_defaults or ())
|
||||
reqargs = func.func_code.co_argcount - defargs
|
||||
defargs = len(six.get_function_defaults(func) or ())
|
||||
reqargs = six.get_function_code(func).co_argcount - defargs
|
||||
if len(args.args) < reqargs:
|
||||
if defargs > 0:
|
||||
log.critical('%s takes at least %d arguments' % (args.shellcode, reqargs))
|
||||
@@ -259,7 +267,7 @@ def main(args):
|
||||
pass
|
||||
|
||||
# And he strikes again!
|
||||
map(common.context_arg, args.shellcode.split('.'))
|
||||
list(map(common.context_arg, args.shellcode.split('.')))
|
||||
code = func(*args.args)
|
||||
|
||||
|
||||
@@ -277,10 +285,10 @@ def main(args):
|
||||
|
||||
code = highlight(code, PwntoolsLexer(), TerminalFormatter())
|
||||
|
||||
print code
|
||||
print(code)
|
||||
exit()
|
||||
if args.format == 'p':
|
||||
print cpp(code)
|
||||
print(cpp(code))
|
||||
exit()
|
||||
|
||||
assembly = code
|
||||
@@ -291,16 +299,16 @@ def main(args):
|
||||
|
||||
if args.format in ['e','elf']:
|
||||
args.format = 'default'
|
||||
try: os.fchmod(args.out.fileno(), 0700)
|
||||
try: os.fchmod(args.out.fileno(), 0o700)
|
||||
except OSError: pass
|
||||
|
||||
|
||||
if not args.avoid:
|
||||
code = read(make_elf_from_assembly(assembly, vma=vma))
|
||||
code = read(make_elf_from_assembly(assembly, vma=vma, shared=args.shared))
|
||||
else:
|
||||
code = asm(assembly)
|
||||
code = encode(code, args.avoid)
|
||||
code = make_elf(code, vma=vma)
|
||||
code = make_elf(code, vma=vma, shared=args.shared)
|
||||
# code = read(make_elf(encode(asm(code), args.avoid)))
|
||||
else:
|
||||
code = encode(asm(assembly), args.avoid)
|
||||
@@ -335,10 +343,12 @@ def main(args):
|
||||
elif args.format in ['i', 'hexii']:
|
||||
code = hexii(code) + '\n'
|
||||
elif args.format in ['d', 'escaped']:
|
||||
code = ''.join('\\x%02x' % ord(c) for c in code) + '\n'
|
||||
code = ''.join('\\x%02x' % c for c in bytearray(code)) + '\n'
|
||||
if not sys.stdin.isatty():
|
||||
args.out.write(sys.stdin.read())
|
||||
args.out.write(getattr(sys.stdin, 'buffer', sys.stdin).read())
|
||||
|
||||
if not hasattr(code, 'decode'):
|
||||
code = code.encode()
|
||||
args.out.write(code)
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env python2
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
|
||||
import re
|
||||
|
||||
@@ -19,6 +20,7 @@ parser.add_argument('--port', help='Remote port / SSH port', type=int)
|
||||
parser.add_argument('--user', help='SSH Username')
|
||||
parser.add_argument('--pass', help='SSH Password', dest='password')
|
||||
parser.add_argument('--path', help='Remote path of file on SSH server')
|
||||
parser.add_argument('--quiet', help='Less verbose template comments', action='store_true')
|
||||
|
||||
def main(args):
|
||||
cache = None
|
||||
@@ -49,15 +51,16 @@ def main(args):
|
||||
args.port,
|
||||
args.user,
|
||||
args.password,
|
||||
args.path)
|
||||
args.path,
|
||||
args.quiet)
|
||||
|
||||
# Fix Mako formatting bs
|
||||
output = re.sub('\n\n\n', '\n\n', output)
|
||||
|
||||
print output
|
||||
print(output)
|
||||
|
||||
if not sys.stdout.isatty():
|
||||
try: os.fchmod(sys.stdout.fileno(), 0700)
|
||||
try: os.fchmod(sys.stdout.fileno(), 0o700)
|
||||
except OSError: pass
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
#!/usr/bin/env python2
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
from string import whitespace
|
||||
|
||||
from pwnlib.commandline import common
|
||||
from pwnlib.util.fiddling import unhex
|
||||
|
||||
parser = common.parser_commands.add_parser(
|
||||
'unhex',
|
||||
@@ -18,12 +20,13 @@ parser.add_argument('hex', nargs='*',
|
||||
|
||||
def main(args):
|
||||
try:
|
||||
o = getattr(sys.stdout, 'buffer', sys.stdout)
|
||||
if not args.hex:
|
||||
s = sys.stdin.read().translate(None, whitespace)
|
||||
sys.stdout.write(s.decode('hex'))
|
||||
s = getattr(sys.stdin, 'buffer', sys.stdin).read().translate(None, whitespace.encode('ascii'))
|
||||
o.write(unhex(s))
|
||||
else:
|
||||
sys.stdout.write(''.join(args.hex).decode('hex'))
|
||||
except TypeError, e:
|
||||
o.write(unhex(''.join(args.hex)))
|
||||
except TypeError as e:
|
||||
sys.stderr.write(str(e) + '\n')
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
|
||||
import subprocess
|
||||
|
||||
@@ -24,7 +25,7 @@ p.add_argument('--pre', action='store_true', help='''
|
||||
|
||||
def main(a):
|
||||
result = pwnlib.update.perform_check(prerelease=a.pre)
|
||||
if a.install:
|
||||
if result and a.install:
|
||||
subprocess.check_call(result, shell=False)
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
+3
-2
@@ -28,8 +28,9 @@ supported by ``pwnlib.util.safeeval.expr``.
|
||||
terminal=['x-terminal-emulator', '-e']
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
|
||||
import ConfigParser
|
||||
from six.moves import configparser
|
||||
import os
|
||||
|
||||
registered_configs = {}
|
||||
@@ -49,7 +50,7 @@ def initialize():
|
||||
from pwnlib.log import getLogger
|
||||
log = getLogger(__name__)
|
||||
|
||||
c = ConfigParser.ConfigParser()
|
||||
c = configparser.ConfigParser()
|
||||
c.read(['/etc/pwn.conf', os.path.expanduser('~/.pwn.conf')])
|
||||
|
||||
for section in c.sections():
|
||||
|
||||
@@ -30,23 +30,23 @@ what happens in :mod:`pwnlib.shellcraft`.
|
||||
Example:
|
||||
|
||||
>>> with context.local(os = 'freebsd'):
|
||||
... print int(constants.SYS_stat)
|
||||
... print(int(constants.SYS_stat))
|
||||
188
|
||||
>>> with context.local(os = 'linux', arch = 'i386'):
|
||||
... print int(constants.SYS_stat)
|
||||
... print(int(constants.SYS_stat))
|
||||
106
|
||||
>>> with context.local(os = 'linux', arch = 'amd64'):
|
||||
... print int(constants.SYS_stat)
|
||||
... print(int(constants.SYS_stat))
|
||||
4
|
||||
|
||||
>>> with context.local(arch = 'i386', os = 'linux'):
|
||||
... print constants.SYS_execve + constants.PROT_WRITE
|
||||
... print(constants.SYS_execve + constants.PROT_WRITE)
|
||||
13
|
||||
>>> with context.local(arch = 'amd64', os = 'linux'):
|
||||
... print constants.SYS_execve + constants.PROT_WRITE
|
||||
... print(constants.SYS_execve + constants.PROT_WRITE)
|
||||
61
|
||||
>>> with context.local(arch = 'amd64', os = 'linux'):
|
||||
... print constants.SYS_execve + constants.PROT_WRITE
|
||||
... print(constants.SYS_execve + constants.PROT_WRITE)
|
||||
61
|
||||
|
||||
"""
|
||||
@@ -111,7 +111,7 @@ class ConstantsModule(ModuleType):
|
||||
pass
|
||||
else:
|
||||
mod = self.guess()
|
||||
if hasattr(mod, key):
|
||||
if mod is not self and hasattr(mod, key):
|
||||
return getattr(mod, key)
|
||||
|
||||
raise AttributeError("'module' object has no attribute '%s'" % key)
|
||||
@@ -124,13 +124,13 @@ class ConstantsModule(ModuleType):
|
||||
Example:
|
||||
|
||||
>>> with context.local(arch = 'i386', os = 'linux'):
|
||||
... print 13 == constants.eval('SYS_execve + PROT_WRITE')
|
||||
... print(13 == constants.eval('SYS_execve + PROT_WRITE'))
|
||||
True
|
||||
>>> with context.local(arch = 'amd64', os = 'linux'):
|
||||
... print 61 == constants.eval('SYS_execve + PROT_WRITE')
|
||||
... print(61 == constants.eval('SYS_execve + PROT_WRITE'))
|
||||
True
|
||||
>>> with context.local(arch = 'amd64', os = 'linux'):
|
||||
... print 61 == constants.eval('SYS_execve + PROT_WRITE')
|
||||
... print(61 == constants.eval('SYS_execve + PROT_WRITE'))
|
||||
True
|
||||
"""
|
||||
if not isinstance(string, str):
|
||||
|
||||
+31
-31
@@ -540,37 +540,37 @@ PRU_FLUSH_RDWR = Constant('PRU_FLUSH_RDWR',2)
|
||||
SF_NODISKIO = Constant('SF_NODISKIO',0x00000001)
|
||||
SF_MNOWAIT = Constant('SF_MNOWAIT',0x00000002)
|
||||
SF_SYNC = Constant('SF_SYNC',0x00000004)
|
||||
S_ISUID = Constant('S_ISUID',0004000)
|
||||
S_ISGID = Constant('S_ISGID',0002000)
|
||||
S_ISTXT = Constant('S_ISTXT',0001000)
|
||||
S_IRWXU = Constant('S_IRWXU',0000700)
|
||||
S_IRUSR = Constant('S_IRUSR',0000400)
|
||||
S_IWUSR = Constant('S_IWUSR',0000200)
|
||||
S_IXUSR = Constant('S_IXUSR',0000100)
|
||||
S_IREAD = Constant('S_IREAD',0000400)
|
||||
S_IWRITE = Constant('S_IWRITE',0000200)
|
||||
S_IEXEC = Constant('S_IEXEC',0000100)
|
||||
S_IRWXG = Constant('S_IRWXG',0000070)
|
||||
S_IRGRP = Constant('S_IRGRP',0000040)
|
||||
S_IWGRP = Constant('S_IWGRP',0000020)
|
||||
S_IXGRP = Constant('S_IXGRP',0000010)
|
||||
S_IRWXO = Constant('S_IRWXO',0000007)
|
||||
S_IROTH = Constant('S_IROTH',0000004)
|
||||
S_IWOTH = Constant('S_IWOTH',0000002)
|
||||
S_IXOTH = Constant('S_IXOTH',0000001)
|
||||
S_IFMT = Constant('S_IFMT',0170000)
|
||||
S_IFIFO = Constant('S_IFIFO',0010000)
|
||||
S_IFCHR = Constant('S_IFCHR',0020000)
|
||||
S_IFDIR = Constant('S_IFDIR',0040000)
|
||||
S_IFBLK = Constant('S_IFBLK',0060000)
|
||||
S_IFREG = Constant('S_IFREG',0100000)
|
||||
S_IFLNK = Constant('S_IFLNK',0120000)
|
||||
S_IFSOCK = Constant('S_IFSOCK',0140000)
|
||||
S_ISVTX = Constant('S_ISVTX',0001000)
|
||||
S_IFWHT = Constant('S_IFWHT',0160000)
|
||||
ACCESSPERMS = Constant('ACCESSPERMS',(0000700|0000070|0000007))
|
||||
ALLPERMS = Constant('ALLPERMS',(0004000|0002000|0001000|0000700|0000070|0000007))
|
||||
DEFFILEMODE = Constant('DEFFILEMODE',(0000400|0000200|0000040|0000020|0000004|0000002))
|
||||
S_ISUID = Constant('S_ISUID',0o004000)
|
||||
S_ISGID = Constant('S_ISGID',0o002000)
|
||||
S_ISTXT = Constant('S_ISTXT',0o001000)
|
||||
S_IRWXU = Constant('S_IRWXU',0o000700)
|
||||
S_IRUSR = Constant('S_IRUSR',0o000400)
|
||||
S_IWUSR = Constant('S_IWUSR',0o000200)
|
||||
S_IXUSR = Constant('S_IXUSR',0o000100)
|
||||
S_IREAD = Constant('S_IREAD',0o000400)
|
||||
S_IWRITE = Constant('S_IWRITE',0o000200)
|
||||
S_IEXEC = Constant('S_IEXEC',0o000100)
|
||||
S_IRWXG = Constant('S_IRWXG',0o000070)
|
||||
S_IRGRP = Constant('S_IRGRP',0o000040)
|
||||
S_IWGRP = Constant('S_IWGRP',0o000020)
|
||||
S_IXGRP = Constant('S_IXGRP',0o000010)
|
||||
S_IRWXO = Constant('S_IRWXO',0o000007)
|
||||
S_IROTH = Constant('S_IROTH',0o000004)
|
||||
S_IWOTH = Constant('S_IWOTH',0o000002)
|
||||
S_IXOTH = Constant('S_IXOTH',0o000001)
|
||||
S_IFMT = Constant('S_IFMT',0o170000)
|
||||
S_IFIFO = Constant('S_IFIFO',0o010000)
|
||||
S_IFCHR = Constant('S_IFCHR',0o020000)
|
||||
S_IFDIR = Constant('S_IFDIR',0o040000)
|
||||
S_IFBLK = Constant('S_IFBLK',0o060000)
|
||||
S_IFREG = Constant('S_IFREG',0o100000)
|
||||
S_IFLNK = Constant('S_IFLNK',0o120000)
|
||||
S_IFSOCK = Constant('S_IFSOCK',0o140000)
|
||||
S_ISVTX = Constant('S_ISVTX',0o001000)
|
||||
S_IFWHT = Constant('S_IFWHT',0o160000)
|
||||
ACCESSPERMS = Constant('ACCESSPERMS',(0o000700|0o000070|0o000007))
|
||||
ALLPERMS = Constant('ALLPERMS',(0o004000|0o002000|0o001000|0o000700|0o000070|0o000007))
|
||||
DEFFILEMODE = Constant('DEFFILEMODE',(0o000400|0o000200|0o000040|0o000020|0o000004|0o000002))
|
||||
S_BLKSIZE = Constant('S_BLKSIZE',512)
|
||||
UF_SETTABLE = Constant('UF_SETTABLE',0x0000ffff)
|
||||
UF_NODUMP = Constant('UF_NODUMP',0x00000001)
|
||||
|
||||
@@ -501,51 +501,51 @@ F_LOCK = Constant('F_LOCK',1)
|
||||
F_TLOCK = Constant('F_TLOCK',2)
|
||||
F_TEST = Constant('F_TEST',3)
|
||||
STAT64_HAS_BROKEN_ST_INO = Constant('STAT64_HAS_BROKEN_ST_INO',1)
|
||||
S_IFMT = Constant('S_IFMT',00170000)
|
||||
S_IFSOCK = Constant('S_IFSOCK',0140000)
|
||||
S_IFLNK = Constant('S_IFLNK',0120000)
|
||||
S_IFREG = Constant('S_IFREG',0100000)
|
||||
S_IFBLK = Constant('S_IFBLK',0060000)
|
||||
S_IFDIR = Constant('S_IFDIR',0040000)
|
||||
S_IFCHR = Constant('S_IFCHR',0020000)
|
||||
S_IFIFO = Constant('S_IFIFO',0010000)
|
||||
S_ISUID = Constant('S_ISUID',0004000)
|
||||
S_ISGID = Constant('S_ISGID',0002000)
|
||||
S_ISVTX = Constant('S_ISVTX',0001000)
|
||||
S_IRWXU = Constant('S_IRWXU',00700)
|
||||
S_IRUSR = Constant('S_IRUSR',00400)
|
||||
S_IWUSR = Constant('S_IWUSR',00200)
|
||||
S_IXUSR = Constant('S_IXUSR',00100)
|
||||
S_IRWXG = Constant('S_IRWXG',00070)
|
||||
S_IRGRP = Constant('S_IRGRP',00040)
|
||||
S_IWGRP = Constant('S_IWGRP',00020)
|
||||
S_IXGRP = Constant('S_IXGRP',00010)
|
||||
S_IRWXO = Constant('S_IRWXO',00007)
|
||||
S_IROTH = Constant('S_IROTH',00004)
|
||||
S_IWOTH = Constant('S_IWOTH',00002)
|
||||
S_IXOTH = Constant('S_IXOTH',00001)
|
||||
S_IREAD = Constant('S_IREAD',00400)
|
||||
S_IWRITE = Constant('S_IWRITE',00200)
|
||||
S_IEXEC = Constant('S_IEXEC',00100)
|
||||
S_IFMT = Constant('S_IFMT',0o0170000)
|
||||
S_IFSOCK = Constant('S_IFSOCK',0o140000)
|
||||
S_IFLNK = Constant('S_IFLNK',0o120000)
|
||||
S_IFREG = Constant('S_IFREG',0o100000)
|
||||
S_IFBLK = Constant('S_IFBLK',0o060000)
|
||||
S_IFDIR = Constant('S_IFDIR',0o040000)
|
||||
S_IFCHR = Constant('S_IFCHR',0o020000)
|
||||
S_IFIFO = Constant('S_IFIFO',0o010000)
|
||||
S_ISUID = Constant('S_ISUID',0o004000)
|
||||
S_ISGID = Constant('S_ISGID',0o002000)
|
||||
S_ISVTX = Constant('S_ISVTX',0o001000)
|
||||
S_IRWXU = Constant('S_IRWXU',0o0700)
|
||||
S_IRUSR = Constant('S_IRUSR',0o0400)
|
||||
S_IWUSR = Constant('S_IWUSR',0o0200)
|
||||
S_IXUSR = Constant('S_IXUSR',0o0100)
|
||||
S_IRWXG = Constant('S_IRWXG',0o0070)
|
||||
S_IRGRP = Constant('S_IRGRP',0o0040)
|
||||
S_IWGRP = Constant('S_IWGRP',0o0020)
|
||||
S_IXGRP = Constant('S_IXGRP',0o0010)
|
||||
S_IRWXO = Constant('S_IRWXO',0o0007)
|
||||
S_IROTH = Constant('S_IROTH',0o0004)
|
||||
S_IWOTH = Constant('S_IWOTH',0o0002)
|
||||
S_IXOTH = Constant('S_IXOTH',0o0001)
|
||||
S_IREAD = Constant('S_IREAD',0o0400)
|
||||
S_IWRITE = Constant('S_IWRITE',0o0200)
|
||||
S_IEXEC = Constant('S_IEXEC',0o0100)
|
||||
F_LINUX_SPECIFIC_BASE = Constant('F_LINUX_SPECIFIC_BASE',1024)
|
||||
O_ACCMODE = Constant('O_ACCMODE',0003)
|
||||
O_RDONLY = Constant('O_RDONLY',00)
|
||||
O_WRONLY = Constant('O_WRONLY',01)
|
||||
O_RDWR = Constant('O_RDWR',02)
|
||||
O_CREAT = Constant('O_CREAT',0100)
|
||||
O_EXCL = Constant('O_EXCL',0200)
|
||||
O_NOCTTY = Constant('O_NOCTTY',0400)
|
||||
O_TRUNC = Constant('O_TRUNC',01000)
|
||||
O_APPEND = Constant('O_APPEND',02000)
|
||||
O_NONBLOCK = Constant('O_NONBLOCK',04000)
|
||||
O_NDELAY = Constant('O_NDELAY',04000)
|
||||
O_SYNC = Constant('O_SYNC',010000)
|
||||
FASYNC = Constant('FASYNC',020000)
|
||||
O_DIRECTORY = Constant('O_DIRECTORY',040000)
|
||||
O_NOFOLLOW = Constant('O_NOFOLLOW',0100000)
|
||||
O_DIRECT = Constant('O_DIRECT',0200000)
|
||||
O_LARGEFILE = Constant('O_LARGEFILE',0400000)
|
||||
O_NOATIME = Constant('O_NOATIME',01000000)
|
||||
O_ACCMODE = Constant('O_ACCMODE',0o003)
|
||||
O_RDONLY = Constant('O_RDONLY',0o0)
|
||||
O_WRONLY = Constant('O_WRONLY',0o1)
|
||||
O_RDWR = Constant('O_RDWR',0o2)
|
||||
O_CREAT = Constant('O_CREAT',0o100)
|
||||
O_EXCL = Constant('O_EXCL',0o200)
|
||||
O_NOCTTY = Constant('O_NOCTTY',0o400)
|
||||
O_TRUNC = Constant('O_TRUNC',0o1000)
|
||||
O_APPEND = Constant('O_APPEND',0o2000)
|
||||
O_NONBLOCK = Constant('O_NONBLOCK',0o4000)
|
||||
O_NDELAY = Constant('O_NDELAY',0o4000)
|
||||
O_SYNC = Constant('O_SYNC',0o10000)
|
||||
FASYNC = Constant('FASYNC',0o20000)
|
||||
O_DIRECTORY = Constant('O_DIRECTORY',0o40000)
|
||||
O_NOFOLLOW = Constant('O_NOFOLLOW',0o100000)
|
||||
O_DIRECT = Constant('O_DIRECT',0o200000)
|
||||
O_LARGEFILE = Constant('O_LARGEFILE',0o400000)
|
||||
O_NOATIME = Constant('O_NOATIME',0o1000000)
|
||||
F_DUPFD = Constant('F_DUPFD',0)
|
||||
F_GETFD = Constant('F_GETFD',1)
|
||||
F_SETFD = Constant('F_SETFD',2)
|
||||
@@ -576,7 +576,7 @@ LOCK_MAND = Constant('LOCK_MAND',32)
|
||||
LOCK_READ = Constant('LOCK_READ',64)
|
||||
LOCK_WRITE = Constant('LOCK_WRITE',128)
|
||||
LOCK_RW = Constant('LOCK_RW',192)
|
||||
O_ASYNC = Constant('O_ASYNC',020000)
|
||||
O_ASYNC = Constant('O_ASYNC',0o20000)
|
||||
MREMAP_MAYMOVE = Constant('MREMAP_MAYMOVE',1)
|
||||
MREMAP_FIXED = Constant('MREMAP_FIXED',2)
|
||||
PROT_READ = Constant('PROT_READ',0x1)
|
||||
|
||||
@@ -634,51 +634,51 @@ F_ULOCK = Constant('F_ULOCK',0)
|
||||
F_LOCK = Constant('F_LOCK',1)
|
||||
F_TLOCK = Constant('F_TLOCK',2)
|
||||
F_TEST = Constant('F_TEST',3)
|
||||
S_IFMT = Constant('S_IFMT',00170000)
|
||||
S_IFSOCK = Constant('S_IFSOCK',0140000)
|
||||
S_IFLNK = Constant('S_IFLNK',0120000)
|
||||
S_IFREG = Constant('S_IFREG',0100000)
|
||||
S_IFBLK = Constant('S_IFBLK',0060000)
|
||||
S_IFDIR = Constant('S_IFDIR',0040000)
|
||||
S_IFCHR = Constant('S_IFCHR',0020000)
|
||||
S_IFIFO = Constant('S_IFIFO',0010000)
|
||||
S_ISUID = Constant('S_ISUID',0004000)
|
||||
S_ISGID = Constant('S_ISGID',0002000)
|
||||
S_ISVTX = Constant('S_ISVTX',0001000)
|
||||
S_IRWXU = Constant('S_IRWXU',00700)
|
||||
S_IRUSR = Constant('S_IRUSR',00400)
|
||||
S_IWUSR = Constant('S_IWUSR',00200)
|
||||
S_IXUSR = Constant('S_IXUSR',00100)
|
||||
S_IRWXG = Constant('S_IRWXG',00070)
|
||||
S_IRGRP = Constant('S_IRGRP',00040)
|
||||
S_IWGRP = Constant('S_IWGRP',00020)
|
||||
S_IXGRP = Constant('S_IXGRP',00010)
|
||||
S_IRWXO = Constant('S_IRWXO',00007)
|
||||
S_IROTH = Constant('S_IROTH',00004)
|
||||
S_IWOTH = Constant('S_IWOTH',00002)
|
||||
S_IXOTH = Constant('S_IXOTH',00001)
|
||||
S_IREAD = Constant('S_IREAD',00400)
|
||||
S_IWRITE = Constant('S_IWRITE',00200)
|
||||
S_IEXEC = Constant('S_IEXEC',00100)
|
||||
S_IFMT = Constant('S_IFMT',0o0170000)
|
||||
S_IFSOCK = Constant('S_IFSOCK',0o140000)
|
||||
S_IFLNK = Constant('S_IFLNK',0o120000)
|
||||
S_IFREG = Constant('S_IFREG',0o100000)
|
||||
S_IFBLK = Constant('S_IFBLK',0o060000)
|
||||
S_IFDIR = Constant('S_IFDIR',0o040000)
|
||||
S_IFCHR = Constant('S_IFCHR',0o020000)
|
||||
S_IFIFO = Constant('S_IFIFO',0o010000)
|
||||
S_ISUID = Constant('S_ISUID',0o004000)
|
||||
S_ISGID = Constant('S_ISGID',0o002000)
|
||||
S_ISVTX = Constant('S_ISVTX',0o001000)
|
||||
S_IRWXU = Constant('S_IRWXU',0o0700)
|
||||
S_IRUSR = Constant('S_IRUSR',0o0400)
|
||||
S_IWUSR = Constant('S_IWUSR',0o0200)
|
||||
S_IXUSR = Constant('S_IXUSR',0o0100)
|
||||
S_IRWXG = Constant('S_IRWXG',0o0070)
|
||||
S_IRGRP = Constant('S_IRGRP',0o0040)
|
||||
S_IWGRP = Constant('S_IWGRP',0o0020)
|
||||
S_IXGRP = Constant('S_IXGRP',0o0010)
|
||||
S_IRWXO = Constant('S_IRWXO',0o0007)
|
||||
S_IROTH = Constant('S_IROTH',0o0004)
|
||||
S_IWOTH = Constant('S_IWOTH',0o0002)
|
||||
S_IXOTH = Constant('S_IXOTH',0o0001)
|
||||
S_IREAD = Constant('S_IREAD',0o0400)
|
||||
S_IWRITE = Constant('S_IWRITE',0o0200)
|
||||
S_IEXEC = Constant('S_IEXEC',0o0100)
|
||||
F_LINUX_SPECIFIC_BASE = Constant('F_LINUX_SPECIFIC_BASE',1024)
|
||||
O_ACCMODE = Constant('O_ACCMODE',0003)
|
||||
O_RDONLY = Constant('O_RDONLY',00)
|
||||
O_WRONLY = Constant('O_WRONLY',01)
|
||||
O_RDWR = Constant('O_RDWR',02)
|
||||
O_CREAT = Constant('O_CREAT',01000)
|
||||
O_TRUNC = Constant('O_TRUNC',02000)
|
||||
O_EXCL = Constant('O_EXCL',04000)
|
||||
O_NOCTTY = Constant('O_NOCTTY',010000)
|
||||
O_NONBLOCK = Constant('O_NONBLOCK',00004)
|
||||
O_APPEND = Constant('O_APPEND',00010)
|
||||
O_NDELAY = Constant('O_NDELAY',00004)
|
||||
O_SYNC = Constant('O_SYNC',040000)
|
||||
FASYNC = Constant('FASYNC',020000)
|
||||
O_DIRECTORY = Constant('O_DIRECTORY',0100000)
|
||||
O_NOFOLLOW = Constant('O_NOFOLLOW',0200000)
|
||||
O_LARGEFILE = Constant('O_LARGEFILE',0400000)
|
||||
O_DIRECT = Constant('O_DIRECT',02000000)
|
||||
O_NOATIME = Constant('O_NOATIME',04000000)
|
||||
O_ACCMODE = Constant('O_ACCMODE',0o003)
|
||||
O_RDONLY = Constant('O_RDONLY',0o0)
|
||||
O_WRONLY = Constant('O_WRONLY',0o1)
|
||||
O_RDWR = Constant('O_RDWR',0o2)
|
||||
O_CREAT = Constant('O_CREAT',0o1000)
|
||||
O_TRUNC = Constant('O_TRUNC',0o2000)
|
||||
O_EXCL = Constant('O_EXCL',0o4000)
|
||||
O_NOCTTY = Constant('O_NOCTTY',0o10000)
|
||||
O_NONBLOCK = Constant('O_NONBLOCK',0o0004)
|
||||
O_APPEND = Constant('O_APPEND',0o0010)
|
||||
O_NDELAY = Constant('O_NDELAY',0o0004)
|
||||
O_SYNC = Constant('O_SYNC',0o40000)
|
||||
FASYNC = Constant('FASYNC',0o20000)
|
||||
O_DIRECTORY = Constant('O_DIRECTORY',0o100000)
|
||||
O_NOFOLLOW = Constant('O_NOFOLLOW',0o200000)
|
||||
O_LARGEFILE = Constant('O_LARGEFILE',0o400000)
|
||||
O_DIRECT = Constant('O_DIRECT',0o2000000)
|
||||
O_NOATIME = Constant('O_NOATIME',0o4000000)
|
||||
F_DUPFD = Constant('F_DUPFD',0)
|
||||
F_GETFD = Constant('F_GETFD',1)
|
||||
F_SETFD = Constant('F_SETFD',2)
|
||||
@@ -706,7 +706,7 @@ LOCK_MAND = Constant('LOCK_MAND',32)
|
||||
LOCK_READ = Constant('LOCK_READ',64)
|
||||
LOCK_WRITE = Constant('LOCK_WRITE',128)
|
||||
LOCK_RW = Constant('LOCK_RW',192)
|
||||
O_ASYNC = Constant('O_ASYNC',020000)
|
||||
O_ASYNC = Constant('O_ASYNC',0o20000)
|
||||
MREMAP_MAYMOVE = Constant('MREMAP_MAYMOVE',1)
|
||||
MREMAP_FIXED = Constant('MREMAP_FIXED',2)
|
||||
PROT_READ = Constant('PROT_READ',0x1)
|
||||
|
||||
@@ -892,51 +892,51 @@ F_ULOCK = Constant('F_ULOCK',0)
|
||||
F_LOCK = Constant('F_LOCK',1)
|
||||
F_TLOCK = Constant('F_TLOCK',2)
|
||||
F_TEST = Constant('F_TEST',3)
|
||||
S_IFMT = Constant('S_IFMT',00170000)
|
||||
S_IFSOCK = Constant('S_IFSOCK',0140000)
|
||||
S_IFLNK = Constant('S_IFLNK',0120000)
|
||||
S_IFREG = Constant('S_IFREG',0100000)
|
||||
S_IFBLK = Constant('S_IFBLK',0060000)
|
||||
S_IFDIR = Constant('S_IFDIR',0040000)
|
||||
S_IFCHR = Constant('S_IFCHR',0020000)
|
||||
S_IFIFO = Constant('S_IFIFO',0010000)
|
||||
S_ISUID = Constant('S_ISUID',0004000)
|
||||
S_ISGID = Constant('S_ISGID',0002000)
|
||||
S_ISVTX = Constant('S_ISVTX',0001000)
|
||||
S_IRWXU = Constant('S_IRWXU',00700)
|
||||
S_IRUSR = Constant('S_IRUSR',00400)
|
||||
S_IWUSR = Constant('S_IWUSR',00200)
|
||||
S_IXUSR = Constant('S_IXUSR',00100)
|
||||
S_IRWXG = Constant('S_IRWXG',00070)
|
||||
S_IRGRP = Constant('S_IRGRP',00040)
|
||||
S_IWGRP = Constant('S_IWGRP',00020)
|
||||
S_IXGRP = Constant('S_IXGRP',00010)
|
||||
S_IRWXO = Constant('S_IRWXO',00007)
|
||||
S_IROTH = Constant('S_IROTH',00004)
|
||||
S_IWOTH = Constant('S_IWOTH',00002)
|
||||
S_IXOTH = Constant('S_IXOTH',00001)
|
||||
S_IREAD = Constant('S_IREAD',00400)
|
||||
S_IWRITE = Constant('S_IWRITE',00200)
|
||||
S_IEXEC = Constant('S_IEXEC',00100)
|
||||
S_IFMT = Constant('S_IFMT',0o0170000)
|
||||
S_IFSOCK = Constant('S_IFSOCK',0o140000)
|
||||
S_IFLNK = Constant('S_IFLNK',0o120000)
|
||||
S_IFREG = Constant('S_IFREG',0o100000)
|
||||
S_IFBLK = Constant('S_IFBLK',0o060000)
|
||||
S_IFDIR = Constant('S_IFDIR',0o040000)
|
||||
S_IFCHR = Constant('S_IFCHR',0o020000)
|
||||
S_IFIFO = Constant('S_IFIFO',0o010000)
|
||||
S_ISUID = Constant('S_ISUID',0o004000)
|
||||
S_ISGID = Constant('S_ISGID',0o002000)
|
||||
S_ISVTX = Constant('S_ISVTX',0o001000)
|
||||
S_IRWXU = Constant('S_IRWXU',0o0700)
|
||||
S_IRUSR = Constant('S_IRUSR',0o0400)
|
||||
S_IWUSR = Constant('S_IWUSR',0o0200)
|
||||
S_IXUSR = Constant('S_IXUSR',0o0100)
|
||||
S_IRWXG = Constant('S_IRWXG',0o0070)
|
||||
S_IRGRP = Constant('S_IRGRP',0o0040)
|
||||
S_IWGRP = Constant('S_IWGRP',0o0020)
|
||||
S_IXGRP = Constant('S_IXGRP',0o0010)
|
||||
S_IRWXO = Constant('S_IRWXO',0o0007)
|
||||
S_IROTH = Constant('S_IROTH',0o0004)
|
||||
S_IWOTH = Constant('S_IWOTH',0o0002)
|
||||
S_IXOTH = Constant('S_IXOTH',0o0001)
|
||||
S_IREAD = Constant('S_IREAD',0o0400)
|
||||
S_IWRITE = Constant('S_IWRITE',0o0200)
|
||||
S_IEXEC = Constant('S_IEXEC',0o0100)
|
||||
F_LINUX_SPECIFIC_BASE = Constant('F_LINUX_SPECIFIC_BASE',1024)
|
||||
O_ACCMODE = Constant('O_ACCMODE',0003)
|
||||
O_RDONLY = Constant('O_RDONLY',00)
|
||||
O_WRONLY = Constant('O_WRONLY',01)
|
||||
O_RDWR = Constant('O_RDWR',02)
|
||||
O_CREAT = Constant('O_CREAT',0100)
|
||||
O_EXCL = Constant('O_EXCL',0200)
|
||||
O_NOCTTY = Constant('O_NOCTTY',0400)
|
||||
O_TRUNC = Constant('O_TRUNC',01000)
|
||||
O_APPEND = Constant('O_APPEND',02000)
|
||||
O_NONBLOCK = Constant('O_NONBLOCK',04000)
|
||||
O_NDELAY = Constant('O_NDELAY',04000)
|
||||
O_SYNC = Constant('O_SYNC',010000)
|
||||
FASYNC = Constant('FASYNC',020000)
|
||||
O_DIRECT = Constant('O_DIRECT',040000)
|
||||
O_LARGEFILE = Constant('O_LARGEFILE',0100000)
|
||||
O_DIRECTORY = Constant('O_DIRECTORY',0200000)
|
||||
O_NOFOLLOW = Constant('O_NOFOLLOW',0400000)
|
||||
O_NOATIME = Constant('O_NOATIME',01000000)
|
||||
O_ACCMODE = Constant('O_ACCMODE',0o003)
|
||||
O_RDONLY = Constant('O_RDONLY',0o0)
|
||||
O_WRONLY = Constant('O_WRONLY',0o1)
|
||||
O_RDWR = Constant('O_RDWR',0o2)
|
||||
O_CREAT = Constant('O_CREAT',0o100)
|
||||
O_EXCL = Constant('O_EXCL',0o200)
|
||||
O_NOCTTY = Constant('O_NOCTTY',0o400)
|
||||
O_TRUNC = Constant('O_TRUNC',0o1000)
|
||||
O_APPEND = Constant('O_APPEND',0o2000)
|
||||
O_NONBLOCK = Constant('O_NONBLOCK',0o4000)
|
||||
O_NDELAY = Constant('O_NDELAY',0o4000)
|
||||
O_SYNC = Constant('O_SYNC',0o10000)
|
||||
FASYNC = Constant('FASYNC',0o20000)
|
||||
O_DIRECT = Constant('O_DIRECT',0o40000)
|
||||
O_LARGEFILE = Constant('O_LARGEFILE',0o100000)
|
||||
O_DIRECTORY = Constant('O_DIRECTORY',0o200000)
|
||||
O_NOFOLLOW = Constant('O_NOFOLLOW',0o400000)
|
||||
O_NOATIME = Constant('O_NOATIME',0o1000000)
|
||||
F_DUPFD = Constant('F_DUPFD',0)
|
||||
F_GETFD = Constant('F_GETFD',1)
|
||||
F_SETFD = Constant('F_SETFD',2)
|
||||
@@ -967,7 +967,7 @@ LOCK_MAND = Constant('LOCK_MAND',32)
|
||||
LOCK_READ = Constant('LOCK_READ',64)
|
||||
LOCK_WRITE = Constant('LOCK_WRITE',128)
|
||||
LOCK_RW = Constant('LOCK_RW',192)
|
||||
O_ASYNC = Constant('O_ASYNC',020000)
|
||||
O_ASYNC = Constant('O_ASYNC',0o20000)
|
||||
MREMAP_MAYMOVE = Constant('MREMAP_MAYMOVE',1)
|
||||
MREMAP_FIXED = Constant('MREMAP_FIXED',2)
|
||||
PROT_READ = Constant('PROT_READ',0x1)
|
||||
|
||||
@@ -919,51 +919,51 @@ F_LOCK = Constant('F_LOCK',1)
|
||||
F_TLOCK = Constant('F_TLOCK',2)
|
||||
F_TEST = Constant('F_TEST',3)
|
||||
STAT64_HAS_BROKEN_ST_INO = Constant('STAT64_HAS_BROKEN_ST_INO',1)
|
||||
S_IFMT = Constant('S_IFMT',00170000)
|
||||
S_IFSOCK = Constant('S_IFSOCK',0140000)
|
||||
S_IFLNK = Constant('S_IFLNK',0120000)
|
||||
S_IFREG = Constant('S_IFREG',0100000)
|
||||
S_IFBLK = Constant('S_IFBLK',0060000)
|
||||
S_IFDIR = Constant('S_IFDIR',0040000)
|
||||
S_IFCHR = Constant('S_IFCHR',0020000)
|
||||
S_IFIFO = Constant('S_IFIFO',0010000)
|
||||
S_ISUID = Constant('S_ISUID',0004000)
|
||||
S_ISGID = Constant('S_ISGID',0002000)
|
||||
S_ISVTX = Constant('S_ISVTX',0001000)
|
||||
S_IRWXU = Constant('S_IRWXU',00700)
|
||||
S_IRUSR = Constant('S_IRUSR',00400)
|
||||
S_IWUSR = Constant('S_IWUSR',00200)
|
||||
S_IXUSR = Constant('S_IXUSR',00100)
|
||||
S_IRWXG = Constant('S_IRWXG',00070)
|
||||
S_IRGRP = Constant('S_IRGRP',00040)
|
||||
S_IWGRP = Constant('S_IWGRP',00020)
|
||||
S_IXGRP = Constant('S_IXGRP',00010)
|
||||
S_IRWXO = Constant('S_IRWXO',00007)
|
||||
S_IROTH = Constant('S_IROTH',00004)
|
||||
S_IWOTH = Constant('S_IWOTH',00002)
|
||||
S_IXOTH = Constant('S_IXOTH',00001)
|
||||
S_IREAD = Constant('S_IREAD',00400)
|
||||
S_IWRITE = Constant('S_IWRITE',00200)
|
||||
S_IEXEC = Constant('S_IEXEC',00100)
|
||||
S_IFMT = Constant('S_IFMT',0o0170000)
|
||||
S_IFSOCK = Constant('S_IFSOCK',0o140000)
|
||||
S_IFLNK = Constant('S_IFLNK',0o120000)
|
||||
S_IFREG = Constant('S_IFREG',0o100000)
|
||||
S_IFBLK = Constant('S_IFBLK',0o060000)
|
||||
S_IFDIR = Constant('S_IFDIR',0o040000)
|
||||
S_IFCHR = Constant('S_IFCHR',0o020000)
|
||||
S_IFIFO = Constant('S_IFIFO',0o010000)
|
||||
S_ISUID = Constant('S_ISUID',0o004000)
|
||||
S_ISGID = Constant('S_ISGID',0o002000)
|
||||
S_ISVTX = Constant('S_ISVTX',0o001000)
|
||||
S_IRWXU = Constant('S_IRWXU',0o0700)
|
||||
S_IRUSR = Constant('S_IRUSR',0o0400)
|
||||
S_IWUSR = Constant('S_IWUSR',0o0200)
|
||||
S_IXUSR = Constant('S_IXUSR',0o0100)
|
||||
S_IRWXG = Constant('S_IRWXG',0o0070)
|
||||
S_IRGRP = Constant('S_IRGRP',0o0040)
|
||||
S_IWGRP = Constant('S_IWGRP',0o0020)
|
||||
S_IXGRP = Constant('S_IXGRP',0o0010)
|
||||
S_IRWXO = Constant('S_IRWXO',0o0007)
|
||||
S_IROTH = Constant('S_IROTH',0o0004)
|
||||
S_IWOTH = Constant('S_IWOTH',0o0002)
|
||||
S_IXOTH = Constant('S_IXOTH',0o0001)
|
||||
S_IREAD = Constant('S_IREAD',0o0400)
|
||||
S_IWRITE = Constant('S_IWRITE',0o0200)
|
||||
S_IEXEC = Constant('S_IEXEC',0o0100)
|
||||
F_LINUX_SPECIFIC_BASE = Constant('F_LINUX_SPECIFIC_BASE',1024)
|
||||
O_ACCMODE = Constant('O_ACCMODE',0003)
|
||||
O_RDONLY = Constant('O_RDONLY',00)
|
||||
O_WRONLY = Constant('O_WRONLY',01)
|
||||
O_RDWR = Constant('O_RDWR',02)
|
||||
O_CREAT = Constant('O_CREAT',0100)
|
||||
O_EXCL = Constant('O_EXCL',0200)
|
||||
O_NOCTTY = Constant('O_NOCTTY',0400)
|
||||
O_TRUNC = Constant('O_TRUNC',01000)
|
||||
O_APPEND = Constant('O_APPEND',02000)
|
||||
O_NONBLOCK = Constant('O_NONBLOCK',04000)
|
||||
O_NDELAY = Constant('O_NDELAY',04000)
|
||||
O_SYNC = Constant('O_SYNC',010000)
|
||||
FASYNC = Constant('FASYNC',020000)
|
||||
O_DIRECTORY = Constant('O_DIRECTORY',040000)
|
||||
O_NOFOLLOW = Constant('O_NOFOLLOW',0100000)
|
||||
O_DIRECT = Constant('O_DIRECT',0200000)
|
||||
O_LARGEFILE = Constant('O_LARGEFILE',0400000)
|
||||
O_NOATIME = Constant('O_NOATIME',01000000)
|
||||
O_ACCMODE = Constant('O_ACCMODE',0o003)
|
||||
O_RDONLY = Constant('O_RDONLY',0o0)
|
||||
O_WRONLY = Constant('O_WRONLY',0o1)
|
||||
O_RDWR = Constant('O_RDWR',0o2)
|
||||
O_CREAT = Constant('O_CREAT',0o100)
|
||||
O_EXCL = Constant('O_EXCL',0o200)
|
||||
O_NOCTTY = Constant('O_NOCTTY',0o400)
|
||||
O_TRUNC = Constant('O_TRUNC',0o1000)
|
||||
O_APPEND = Constant('O_APPEND',0o2000)
|
||||
O_NONBLOCK = Constant('O_NONBLOCK',0o4000)
|
||||
O_NDELAY = Constant('O_NDELAY',0o4000)
|
||||
O_SYNC = Constant('O_SYNC',0o10000)
|
||||
FASYNC = Constant('FASYNC',0o20000)
|
||||
O_DIRECTORY = Constant('O_DIRECTORY',0o40000)
|
||||
O_NOFOLLOW = Constant('O_NOFOLLOW',0o100000)
|
||||
O_DIRECT = Constant('O_DIRECT',0o200000)
|
||||
O_LARGEFILE = Constant('O_LARGEFILE',0o400000)
|
||||
O_NOATIME = Constant('O_NOATIME',0o1000000)
|
||||
F_DUPFD = Constant('F_DUPFD',0)
|
||||
F_GETFD = Constant('F_GETFD',1)
|
||||
F_SETFD = Constant('F_SETFD',2)
|
||||
@@ -994,7 +994,7 @@ LOCK_MAND = Constant('LOCK_MAND',32)
|
||||
LOCK_READ = Constant('LOCK_READ',64)
|
||||
LOCK_WRITE = Constant('LOCK_WRITE',128)
|
||||
LOCK_RW = Constant('LOCK_RW',192)
|
||||
O_ASYNC = Constant('O_ASYNC',020000)
|
||||
O_ASYNC = Constant('O_ASYNC',0o20000)
|
||||
MREMAP_MAYMOVE = Constant('MREMAP_MAYMOVE',1)
|
||||
MREMAP_FIXED = Constant('MREMAP_FIXED',2)
|
||||
PROT_READ = Constant('PROT_READ',0x1)
|
||||
|
||||
@@ -597,51 +597,51 @@ F_LOCK = Constant('F_LOCK',1)
|
||||
F_TLOCK = Constant('F_TLOCK',2)
|
||||
F_TEST = Constant('F_TEST',3)
|
||||
STAT64_HAS_BROKEN_ST_INO = Constant('STAT64_HAS_BROKEN_ST_INO',1)
|
||||
S_IFMT = Constant('S_IFMT',00170000)
|
||||
S_IFSOCK = Constant('S_IFSOCK',0140000)
|
||||
S_IFLNK = Constant('S_IFLNK',0120000)
|
||||
S_IFREG = Constant('S_IFREG',0100000)
|
||||
S_IFBLK = Constant('S_IFBLK',0060000)
|
||||
S_IFDIR = Constant('S_IFDIR',0040000)
|
||||
S_IFCHR = Constant('S_IFCHR',0020000)
|
||||
S_IFIFO = Constant('S_IFIFO',0010000)
|
||||
S_ISUID = Constant('S_ISUID',0004000)
|
||||
S_ISGID = Constant('S_ISGID',0002000)
|
||||
S_ISVTX = Constant('S_ISVTX',0001000)
|
||||
S_IRWXU = Constant('S_IRWXU',00700)
|
||||
S_IRUSR = Constant('S_IRUSR',00400)
|
||||
S_IWUSR = Constant('S_IWUSR',00200)
|
||||
S_IXUSR = Constant('S_IXUSR',00100)
|
||||
S_IRWXG = Constant('S_IRWXG',00070)
|
||||
S_IRGRP = Constant('S_IRGRP',00040)
|
||||
S_IWGRP = Constant('S_IWGRP',00020)
|
||||
S_IXGRP = Constant('S_IXGRP',00010)
|
||||
S_IRWXO = Constant('S_IRWXO',00007)
|
||||
S_IROTH = Constant('S_IROTH',00004)
|
||||
S_IWOTH = Constant('S_IWOTH',00002)
|
||||
S_IXOTH = Constant('S_IXOTH',00001)
|
||||
S_IREAD = Constant('S_IREAD',00400)
|
||||
S_IWRITE = Constant('S_IWRITE',00200)
|
||||
S_IEXEC = Constant('S_IEXEC',00100)
|
||||
S_IFMT = Constant('S_IFMT',0o0170000)
|
||||
S_IFSOCK = Constant('S_IFSOCK',0o140000)
|
||||
S_IFLNK = Constant('S_IFLNK',0o120000)
|
||||
S_IFREG = Constant('S_IFREG',0o100000)
|
||||
S_IFBLK = Constant('S_IFBLK',0o060000)
|
||||
S_IFDIR = Constant('S_IFDIR',0o040000)
|
||||
S_IFCHR = Constant('S_IFCHR',0o020000)
|
||||
S_IFIFO = Constant('S_IFIFO',0o010000)
|
||||
S_ISUID = Constant('S_ISUID',0o004000)
|
||||
S_ISGID = Constant('S_ISGID',0o002000)
|
||||
S_ISVTX = Constant('S_ISVTX',0o001000)
|
||||
S_IRWXU = Constant('S_IRWXU',0o0700)
|
||||
S_IRUSR = Constant('S_IRUSR',0o0400)
|
||||
S_IWUSR = Constant('S_IWUSR',0o0200)
|
||||
S_IXUSR = Constant('S_IXUSR',0o0100)
|
||||
S_IRWXG = Constant('S_IRWXG',0o0070)
|
||||
S_IRGRP = Constant('S_IRGRP',0o0040)
|
||||
S_IWGRP = Constant('S_IWGRP',0o0020)
|
||||
S_IXGRP = Constant('S_IXGRP',0o0010)
|
||||
S_IRWXO = Constant('S_IRWXO',0o0007)
|
||||
S_IROTH = Constant('S_IROTH',0o0004)
|
||||
S_IWOTH = Constant('S_IWOTH',0o0002)
|
||||
S_IXOTH = Constant('S_IXOTH',0o0001)
|
||||
S_IREAD = Constant('S_IREAD',0o0400)
|
||||
S_IWRITE = Constant('S_IWRITE',0o0200)
|
||||
S_IEXEC = Constant('S_IEXEC',0o0100)
|
||||
F_LINUX_SPECIFIC_BASE = Constant('F_LINUX_SPECIFIC_BASE',1024)
|
||||
O_ACCMODE = Constant('O_ACCMODE',0003)
|
||||
O_RDONLY = Constant('O_RDONLY',00)
|
||||
O_WRONLY = Constant('O_WRONLY',01)
|
||||
O_RDWR = Constant('O_RDWR',02)
|
||||
O_CREAT = Constant('O_CREAT',0100)
|
||||
O_EXCL = Constant('O_EXCL',0200)
|
||||
O_NOCTTY = Constant('O_NOCTTY',0400)
|
||||
O_TRUNC = Constant('O_TRUNC',01000)
|
||||
O_APPEND = Constant('O_APPEND',02000)
|
||||
O_NONBLOCK = Constant('O_NONBLOCK',04000)
|
||||
O_NDELAY = Constant('O_NDELAY',04000)
|
||||
O_SYNC = Constant('O_SYNC',010000)
|
||||
FASYNC = Constant('FASYNC',020000)
|
||||
O_DIRECT = Constant('O_DIRECT',040000)
|
||||
O_LARGEFILE = Constant('O_LARGEFILE',0100000)
|
||||
O_DIRECTORY = Constant('O_DIRECTORY',0200000)
|
||||
O_NOFOLLOW = Constant('O_NOFOLLOW',0400000)
|
||||
O_NOATIME = Constant('O_NOATIME',01000000)
|
||||
O_ACCMODE = Constant('O_ACCMODE',0o003)
|
||||
O_RDONLY = Constant('O_RDONLY',0o0)
|
||||
O_WRONLY = Constant('O_WRONLY',0o1)
|
||||
O_RDWR = Constant('O_RDWR',0o2)
|
||||
O_CREAT = Constant('O_CREAT',0o100)
|
||||
O_EXCL = Constant('O_EXCL',0o200)
|
||||
O_NOCTTY = Constant('O_NOCTTY',0o400)
|
||||
O_TRUNC = Constant('O_TRUNC',0o1000)
|
||||
O_APPEND = Constant('O_APPEND',0o2000)
|
||||
O_NONBLOCK = Constant('O_NONBLOCK',0o4000)
|
||||
O_NDELAY = Constant('O_NDELAY',0o4000)
|
||||
O_SYNC = Constant('O_SYNC',0o10000)
|
||||
FASYNC = Constant('FASYNC',0o20000)
|
||||
O_DIRECT = Constant('O_DIRECT',0o40000)
|
||||
O_LARGEFILE = Constant('O_LARGEFILE',0o100000)
|
||||
O_DIRECTORY = Constant('O_DIRECTORY',0o200000)
|
||||
O_NOFOLLOW = Constant('O_NOFOLLOW',0o400000)
|
||||
O_NOATIME = Constant('O_NOATIME',0o1000000)
|
||||
F_DUPFD = Constant('F_DUPFD',0)
|
||||
F_GETFD = Constant('F_GETFD',1)
|
||||
F_SETFD = Constant('F_SETFD',2)
|
||||
@@ -672,7 +672,7 @@ LOCK_MAND = Constant('LOCK_MAND',32)
|
||||
LOCK_READ = Constant('LOCK_READ',64)
|
||||
LOCK_WRITE = Constant('LOCK_WRITE',128)
|
||||
LOCK_RW = Constant('LOCK_RW',192)
|
||||
O_ASYNC = Constant('O_ASYNC',020000)
|
||||
O_ASYNC = Constant('O_ASYNC',0o20000)
|
||||
MREMAP_MAYMOVE = Constant('MREMAP_MAYMOVE',1)
|
||||
MREMAP_FIXED = Constant('MREMAP_FIXED',2)
|
||||
PROT_READ = Constant('PROT_READ',0x1)
|
||||
|
||||
@@ -568,51 +568,51 @@ F_ULOCK = Constant('F_ULOCK',0)
|
||||
F_LOCK = Constant('F_LOCK',1)
|
||||
F_TLOCK = Constant('F_TLOCK',2)
|
||||
F_TEST = Constant('F_TEST',3)
|
||||
S_IFMT = Constant('S_IFMT',00170000)
|
||||
S_IFSOCK = Constant('S_IFSOCK',0140000)
|
||||
S_IFLNK = Constant('S_IFLNK',0120000)
|
||||
S_IFREG = Constant('S_IFREG',0100000)
|
||||
S_IFBLK = Constant('S_IFBLK',0060000)
|
||||
S_IFDIR = Constant('S_IFDIR',0040000)
|
||||
S_IFCHR = Constant('S_IFCHR',0020000)
|
||||
S_IFIFO = Constant('S_IFIFO',0010000)
|
||||
S_ISUID = Constant('S_ISUID',0004000)
|
||||
S_ISGID = Constant('S_ISGID',0002000)
|
||||
S_ISVTX = Constant('S_ISVTX',0001000)
|
||||
S_IRWXU = Constant('S_IRWXU',00700)
|
||||
S_IRUSR = Constant('S_IRUSR',00400)
|
||||
S_IWUSR = Constant('S_IWUSR',00200)
|
||||
S_IXUSR = Constant('S_IXUSR',00100)
|
||||
S_IRWXG = Constant('S_IRWXG',00070)
|
||||
S_IRGRP = Constant('S_IRGRP',00040)
|
||||
S_IWGRP = Constant('S_IWGRP',00020)
|
||||
S_IXGRP = Constant('S_IXGRP',00010)
|
||||
S_IRWXO = Constant('S_IRWXO',00007)
|
||||
S_IROTH = Constant('S_IROTH',00004)
|
||||
S_IWOTH = Constant('S_IWOTH',00002)
|
||||
S_IXOTH = Constant('S_IXOTH',00001)
|
||||
S_IREAD = Constant('S_IREAD',00400)
|
||||
S_IWRITE = Constant('S_IWRITE',00200)
|
||||
S_IEXEC = Constant('S_IEXEC',00100)
|
||||
S_IFMT = Constant('S_IFMT',0o0170000)
|
||||
S_IFSOCK = Constant('S_IFSOCK',0o140000)
|
||||
S_IFLNK = Constant('S_IFLNK',0o120000)
|
||||
S_IFREG = Constant('S_IFREG',0o100000)
|
||||
S_IFBLK = Constant('S_IFBLK',0o060000)
|
||||
S_IFDIR = Constant('S_IFDIR',0o040000)
|
||||
S_IFCHR = Constant('S_IFCHR',0o020000)
|
||||
S_IFIFO = Constant('S_IFIFO',0o010000)
|
||||
S_ISUID = Constant('S_ISUID',0o004000)
|
||||
S_ISGID = Constant('S_ISGID',0o002000)
|
||||
S_ISVTX = Constant('S_ISVTX',0o001000)
|
||||
S_IRWXU = Constant('S_IRWXU',0o0700)
|
||||
S_IRUSR = Constant('S_IRUSR',0o0400)
|
||||
S_IWUSR = Constant('S_IWUSR',0o0200)
|
||||
S_IXUSR = Constant('S_IXUSR',0o0100)
|
||||
S_IRWXG = Constant('S_IRWXG',0o0070)
|
||||
S_IRGRP = Constant('S_IRGRP',0o0040)
|
||||
S_IWGRP = Constant('S_IWGRP',0o0020)
|
||||
S_IXGRP = Constant('S_IXGRP',0o0010)
|
||||
S_IRWXO = Constant('S_IRWXO',0o0007)
|
||||
S_IROTH = Constant('S_IROTH',0o0004)
|
||||
S_IWOTH = Constant('S_IWOTH',0o0002)
|
||||
S_IXOTH = Constant('S_IXOTH',0o0001)
|
||||
S_IREAD = Constant('S_IREAD',0o0400)
|
||||
S_IWRITE = Constant('S_IWRITE',0o0200)
|
||||
S_IEXEC = Constant('S_IEXEC',0o0100)
|
||||
F_LINUX_SPECIFIC_BASE = Constant('F_LINUX_SPECIFIC_BASE',1024)
|
||||
O_ACCMODE = Constant('O_ACCMODE',0003)
|
||||
O_RDONLY = Constant('O_RDONLY',00)
|
||||
O_WRONLY = Constant('O_WRONLY',01)
|
||||
O_RDWR = Constant('O_RDWR',02)
|
||||
O_CREAT = Constant('O_CREAT',0100)
|
||||
O_EXCL = Constant('O_EXCL',0200)
|
||||
O_NOCTTY = Constant('O_NOCTTY',0400)
|
||||
O_TRUNC = Constant('O_TRUNC',01000)
|
||||
O_APPEND = Constant('O_APPEND',02000)
|
||||
O_NONBLOCK = Constant('O_NONBLOCK',04000)
|
||||
O_NDELAY = Constant('O_NDELAY',04000)
|
||||
O_SYNC = Constant('O_SYNC',010000)
|
||||
FASYNC = Constant('FASYNC',020000)
|
||||
O_DIRECT = Constant('O_DIRECT',040000)
|
||||
O_LARGEFILE = Constant('O_LARGEFILE',0100000)
|
||||
O_DIRECTORY = Constant('O_DIRECTORY',0200000)
|
||||
O_NOFOLLOW = Constant('O_NOFOLLOW',0400000)
|
||||
O_NOATIME = Constant('O_NOATIME',01000000)
|
||||
O_ACCMODE = Constant('O_ACCMODE',0o003)
|
||||
O_RDONLY = Constant('O_RDONLY',0o0)
|
||||
O_WRONLY = Constant('O_WRONLY',0o1)
|
||||
O_RDWR = Constant('O_RDWR',0o2)
|
||||
O_CREAT = Constant('O_CREAT',0o100)
|
||||
O_EXCL = Constant('O_EXCL',0o200)
|
||||
O_NOCTTY = Constant('O_NOCTTY',0o400)
|
||||
O_TRUNC = Constant('O_TRUNC',0o1000)
|
||||
O_APPEND = Constant('O_APPEND',0o2000)
|
||||
O_NONBLOCK = Constant('O_NONBLOCK',0o4000)
|
||||
O_NDELAY = Constant('O_NDELAY',0o4000)
|
||||
O_SYNC = Constant('O_SYNC',0o10000)
|
||||
FASYNC = Constant('FASYNC',0o20000)
|
||||
O_DIRECT = Constant('O_DIRECT',0o40000)
|
||||
O_LARGEFILE = Constant('O_LARGEFILE',0o100000)
|
||||
O_DIRECTORY = Constant('O_DIRECTORY',0o200000)
|
||||
O_NOFOLLOW = Constant('O_NOFOLLOW',0o400000)
|
||||
O_NOATIME = Constant('O_NOATIME',0o1000000)
|
||||
F_DUPFD = Constant('F_DUPFD',0)
|
||||
F_GETFD = Constant('F_GETFD',1)
|
||||
F_SETFD = Constant('F_SETFD',2)
|
||||
@@ -643,7 +643,7 @@ LOCK_MAND = Constant('LOCK_MAND',32)
|
||||
LOCK_READ = Constant('LOCK_READ',64)
|
||||
LOCK_WRITE = Constant('LOCK_WRITE',128)
|
||||
LOCK_RW = Constant('LOCK_RW',192)
|
||||
O_ASYNC = Constant('O_ASYNC',020000)
|
||||
O_ASYNC = Constant('O_ASYNC',0o20000)
|
||||
MREMAP_MAYMOVE = Constant('MREMAP_MAYMOVE',1)
|
||||
MREMAP_FIXED = Constant('MREMAP_FIXED',2)
|
||||
PROT_READ = Constant('PROT_READ',0x1)
|
||||
|
||||
@@ -567,32 +567,32 @@ F_ULOCK = Constant('F_ULOCK',0)
|
||||
F_LOCK = Constant('F_LOCK',1)
|
||||
F_TLOCK = Constant('F_TLOCK',2)
|
||||
F_TEST = Constant('F_TEST',3)
|
||||
S_IFMT = Constant('S_IFMT',00170000)
|
||||
S_IFSOCK = Constant('S_IFSOCK',0140000)
|
||||
S_IFLNK = Constant('S_IFLNK',0120000)
|
||||
S_IFREG = Constant('S_IFREG',0100000)
|
||||
S_IFBLK = Constant('S_IFBLK',0060000)
|
||||
S_IFDIR = Constant('S_IFDIR',0040000)
|
||||
S_IFCHR = Constant('S_IFCHR',0020000)
|
||||
S_IFIFO = Constant('S_IFIFO',0010000)
|
||||
S_ISUID = Constant('S_ISUID',0004000)
|
||||
S_ISGID = Constant('S_ISGID',0002000)
|
||||
S_ISVTX = Constant('S_ISVTX',0001000)
|
||||
S_IRWXU = Constant('S_IRWXU',00700)
|
||||
S_IRUSR = Constant('S_IRUSR',00400)
|
||||
S_IWUSR = Constant('S_IWUSR',00200)
|
||||
S_IXUSR = Constant('S_IXUSR',00100)
|
||||
S_IRWXG = Constant('S_IRWXG',00070)
|
||||
S_IRGRP = Constant('S_IRGRP',00040)
|
||||
S_IWGRP = Constant('S_IWGRP',00020)
|
||||
S_IXGRP = Constant('S_IXGRP',00010)
|
||||
S_IRWXO = Constant('S_IRWXO',00007)
|
||||
S_IROTH = Constant('S_IROTH',00004)
|
||||
S_IWOTH = Constant('S_IWOTH',00002)
|
||||
S_IXOTH = Constant('S_IXOTH',00001)
|
||||
S_IREAD = Constant('S_IREAD',00400)
|
||||
S_IWRITE = Constant('S_IWRITE',00200)
|
||||
S_IEXEC = Constant('S_IEXEC',00100)
|
||||
S_IFMT = Constant('S_IFMT',0o0170000)
|
||||
S_IFSOCK = Constant('S_IFSOCK',0o140000)
|
||||
S_IFLNK = Constant('S_IFLNK',0o120000)
|
||||
S_IFREG = Constant('S_IFREG',0o100000)
|
||||
S_IFBLK = Constant('S_IFBLK',0o060000)
|
||||
S_IFDIR = Constant('S_IFDIR',0o040000)
|
||||
S_IFCHR = Constant('S_IFCHR',0o020000)
|
||||
S_IFIFO = Constant('S_IFIFO',0o010000)
|
||||
S_ISUID = Constant('S_ISUID',0o004000)
|
||||
S_ISGID = Constant('S_ISGID',0o002000)
|
||||
S_ISVTX = Constant('S_ISVTX',0o001000)
|
||||
S_IRWXU = Constant('S_IRWXU',0o0700)
|
||||
S_IRUSR = Constant('S_IRUSR',0o0400)
|
||||
S_IWUSR = Constant('S_IWUSR',0o0200)
|
||||
S_IXUSR = Constant('S_IXUSR',0o0100)
|
||||
S_IRWXG = Constant('S_IRWXG',0o0070)
|
||||
S_IRGRP = Constant('S_IRGRP',0o0040)
|
||||
S_IWGRP = Constant('S_IWGRP',0o0020)
|
||||
S_IXGRP = Constant('S_IXGRP',0o0010)
|
||||
S_IRWXO = Constant('S_IRWXO',0o0007)
|
||||
S_IROTH = Constant('S_IROTH',0o0004)
|
||||
S_IWOTH = Constant('S_IWOTH',0o0002)
|
||||
S_IXOTH = Constant('S_IXOTH',0o0001)
|
||||
S_IREAD = Constant('S_IREAD',0o0400)
|
||||
S_IWRITE = Constant('S_IWRITE',0o0200)
|
||||
S_IEXEC = Constant('S_IEXEC',0o0100)
|
||||
F_LINUX_SPECIFIC_BASE = Constant('F_LINUX_SPECIFIC_BASE',1024)
|
||||
O_ACCMODE = Constant('O_ACCMODE',0x0003)
|
||||
O_RDONLY = Constant('O_RDONLY',0x0000)
|
||||
|
||||
@@ -525,32 +525,32 @@ F_ULOCK = Constant('F_ULOCK',0)
|
||||
F_LOCK = Constant('F_LOCK',1)
|
||||
F_TLOCK = Constant('F_TLOCK',2)
|
||||
F_TEST = Constant('F_TEST',3)
|
||||
S_IFMT = Constant('S_IFMT',00170000)
|
||||
S_IFSOCK = Constant('S_IFSOCK',0140000)
|
||||
S_IFLNK = Constant('S_IFLNK',0120000)
|
||||
S_IFREG = Constant('S_IFREG',0100000)
|
||||
S_IFBLK = Constant('S_IFBLK',0060000)
|
||||
S_IFDIR = Constant('S_IFDIR',0040000)
|
||||
S_IFCHR = Constant('S_IFCHR',0020000)
|
||||
S_IFIFO = Constant('S_IFIFO',0010000)
|
||||
S_ISUID = Constant('S_ISUID',0004000)
|
||||
S_ISGID = Constant('S_ISGID',0002000)
|
||||
S_ISVTX = Constant('S_ISVTX',0001000)
|
||||
S_IRWXU = Constant('S_IRWXU',00700)
|
||||
S_IRUSR = Constant('S_IRUSR',00400)
|
||||
S_IWUSR = Constant('S_IWUSR',00200)
|
||||
S_IXUSR = Constant('S_IXUSR',00100)
|
||||
S_IRWXG = Constant('S_IRWXG',00070)
|
||||
S_IRGRP = Constant('S_IRGRP',00040)
|
||||
S_IWGRP = Constant('S_IWGRP',00020)
|
||||
S_IXGRP = Constant('S_IXGRP',00010)
|
||||
S_IRWXO = Constant('S_IRWXO',00007)
|
||||
S_IROTH = Constant('S_IROTH',00004)
|
||||
S_IWOTH = Constant('S_IWOTH',00002)
|
||||
S_IXOTH = Constant('S_IXOTH',00001)
|
||||
S_IREAD = Constant('S_IREAD',00400)
|
||||
S_IWRITE = Constant('S_IWRITE',00200)
|
||||
S_IEXEC = Constant('S_IEXEC',00100)
|
||||
S_IFMT = Constant('S_IFMT',0o0170000)
|
||||
S_IFSOCK = Constant('S_IFSOCK',0o140000)
|
||||
S_IFLNK = Constant('S_IFLNK',0o120000)
|
||||
S_IFREG = Constant('S_IFREG',0o100000)
|
||||
S_IFBLK = Constant('S_IFBLK',0o060000)
|
||||
S_IFDIR = Constant('S_IFDIR',0o040000)
|
||||
S_IFCHR = Constant('S_IFCHR',0o020000)
|
||||
S_IFIFO = Constant('S_IFIFO',0o010000)
|
||||
S_ISUID = Constant('S_ISUID',0o004000)
|
||||
S_ISGID = Constant('S_ISGID',0o002000)
|
||||
S_ISVTX = Constant('S_ISVTX',0o001000)
|
||||
S_IRWXU = Constant('S_IRWXU',0o0700)
|
||||
S_IRUSR = Constant('S_IRUSR',0o0400)
|
||||
S_IWUSR = Constant('S_IWUSR',0o0200)
|
||||
S_IXUSR = Constant('S_IXUSR',0o0100)
|
||||
S_IRWXG = Constant('S_IRWXG',0o0070)
|
||||
S_IRGRP = Constant('S_IRGRP',0o0040)
|
||||
S_IWGRP = Constant('S_IWGRP',0o0020)
|
||||
S_IXGRP = Constant('S_IXGRP',0o0010)
|
||||
S_IRWXO = Constant('S_IRWXO',0o0007)
|
||||
S_IROTH = Constant('S_IROTH',0o0004)
|
||||
S_IWOTH = Constant('S_IWOTH',0o0002)
|
||||
S_IXOTH = Constant('S_IXOTH',0o0001)
|
||||
S_IREAD = Constant('S_IREAD',0o0400)
|
||||
S_IWRITE = Constant('S_IWRITE',0o0200)
|
||||
S_IEXEC = Constant('S_IEXEC',0o0100)
|
||||
F_LINUX_SPECIFIC_BASE = Constant('F_LINUX_SPECIFIC_BASE',1024)
|
||||
MREMAP_MAYMOVE = Constant('MREMAP_MAYMOVE',1)
|
||||
MREMAP_FIXED = Constant('MREMAP_FIXED',2)
|
||||
|
||||
@@ -518,32 +518,32 @@ F_ULOCK = Constant('F_ULOCK',0)
|
||||
F_LOCK = Constant('F_LOCK',1)
|
||||
F_TLOCK = Constant('F_TLOCK',2)
|
||||
F_TEST = Constant('F_TEST',3)
|
||||
S_IFMT = Constant('S_IFMT',00170000)
|
||||
S_IFSOCK = Constant('S_IFSOCK',0140000)
|
||||
S_IFLNK = Constant('S_IFLNK',0120000)
|
||||
S_IFREG = Constant('S_IFREG',0100000)
|
||||
S_IFBLK = Constant('S_IFBLK',0060000)
|
||||
S_IFDIR = Constant('S_IFDIR',0040000)
|
||||
S_IFCHR = Constant('S_IFCHR',0020000)
|
||||
S_IFIFO = Constant('S_IFIFO',0010000)
|
||||
S_ISUID = Constant('S_ISUID',0004000)
|
||||
S_ISGID = Constant('S_ISGID',0002000)
|
||||
S_ISVTX = Constant('S_ISVTX',0001000)
|
||||
S_IRWXU = Constant('S_IRWXU',00700)
|
||||
S_IRUSR = Constant('S_IRUSR',00400)
|
||||
S_IWUSR = Constant('S_IWUSR',00200)
|
||||
S_IXUSR = Constant('S_IXUSR',00100)
|
||||
S_IRWXG = Constant('S_IRWXG',00070)
|
||||
S_IRGRP = Constant('S_IRGRP',00040)
|
||||
S_IWGRP = Constant('S_IWGRP',00020)
|
||||
S_IXGRP = Constant('S_IXGRP',00010)
|
||||
S_IRWXO = Constant('S_IRWXO',00007)
|
||||
S_IROTH = Constant('S_IROTH',00004)
|
||||
S_IWOTH = Constant('S_IWOTH',00002)
|
||||
S_IXOTH = Constant('S_IXOTH',00001)
|
||||
S_IREAD = Constant('S_IREAD',00400)
|
||||
S_IWRITE = Constant('S_IWRITE',00200)
|
||||
S_IEXEC = Constant('S_IEXEC',00100)
|
||||
S_IFMT = Constant('S_IFMT',0o0170000)
|
||||
S_IFSOCK = Constant('S_IFSOCK',0o140000)
|
||||
S_IFLNK = Constant('S_IFLNK',0o120000)
|
||||
S_IFREG = Constant('S_IFREG',0o100000)
|
||||
S_IFBLK = Constant('S_IFBLK',0o060000)
|
||||
S_IFDIR = Constant('S_IFDIR',0o040000)
|
||||
S_IFCHR = Constant('S_IFCHR',0o020000)
|
||||
S_IFIFO = Constant('S_IFIFO',0o010000)
|
||||
S_ISUID = Constant('S_ISUID',0o004000)
|
||||
S_ISGID = Constant('S_ISGID',0o002000)
|
||||
S_ISVTX = Constant('S_ISVTX',0o001000)
|
||||
S_IRWXU = Constant('S_IRWXU',0o0700)
|
||||
S_IRUSR = Constant('S_IRUSR',0o0400)
|
||||
S_IWUSR = Constant('S_IWUSR',0o0200)
|
||||
S_IXUSR = Constant('S_IXUSR',0o0100)
|
||||
S_IRWXG = Constant('S_IRWXG',0o0070)
|
||||
S_IRGRP = Constant('S_IRGRP',0o0040)
|
||||
S_IWGRP = Constant('S_IWGRP',0o0020)
|
||||
S_IXGRP = Constant('S_IXGRP',0o0010)
|
||||
S_IRWXO = Constant('S_IRWXO',0o0007)
|
||||
S_IROTH = Constant('S_IROTH',0o0004)
|
||||
S_IWOTH = Constant('S_IWOTH',0o0002)
|
||||
S_IXOTH = Constant('S_IXOTH',0o0001)
|
||||
S_IREAD = Constant('S_IREAD',0o0400)
|
||||
S_IWRITE = Constant('S_IWRITE',0o0200)
|
||||
S_IEXEC = Constant('S_IEXEC',0o0100)
|
||||
F_LINUX_SPECIFIC_BASE = Constant('F_LINUX_SPECIFIC_BASE',1024)
|
||||
MREMAP_MAYMOVE = Constant('MREMAP_MAYMOVE',1)
|
||||
MREMAP_FIXED = Constant('MREMAP_FIXED',2)
|
||||
|
||||
@@ -541,51 +541,51 @@ F_LOCK = Constant('F_LOCK',1)
|
||||
F_TLOCK = Constant('F_TLOCK',2)
|
||||
F_TEST = Constant('F_TEST',3)
|
||||
STAT64_HAS_BROKEN_ST_INO = Constant('STAT64_HAS_BROKEN_ST_INO',1)
|
||||
S_IFMT = Constant('S_IFMT',00170000)
|
||||
S_IFSOCK = Constant('S_IFSOCK',0140000)
|
||||
S_IFLNK = Constant('S_IFLNK',0120000)
|
||||
S_IFREG = Constant('S_IFREG',0100000)
|
||||
S_IFBLK = Constant('S_IFBLK',0060000)
|
||||
S_IFDIR = Constant('S_IFDIR',0040000)
|
||||
S_IFCHR = Constant('S_IFCHR',0020000)
|
||||
S_IFIFO = Constant('S_IFIFO',0010000)
|
||||
S_ISUID = Constant('S_ISUID',0004000)
|
||||
S_ISGID = Constant('S_ISGID',0002000)
|
||||
S_ISVTX = Constant('S_ISVTX',0001000)
|
||||
S_IRWXU = Constant('S_IRWXU',00700)
|
||||
S_IRUSR = Constant('S_IRUSR',00400)
|
||||
S_IWUSR = Constant('S_IWUSR',00200)
|
||||
S_IXUSR = Constant('S_IXUSR',00100)
|
||||
S_IRWXG = Constant('S_IRWXG',00070)
|
||||
S_IRGRP = Constant('S_IRGRP',00040)
|
||||
S_IWGRP = Constant('S_IWGRP',00020)
|
||||
S_IXGRP = Constant('S_IXGRP',00010)
|
||||
S_IRWXO = Constant('S_IRWXO',00007)
|
||||
S_IROTH = Constant('S_IROTH',00004)
|
||||
S_IWOTH = Constant('S_IWOTH',00002)
|
||||
S_IXOTH = Constant('S_IXOTH',00001)
|
||||
S_IREAD = Constant('S_IREAD',00400)
|
||||
S_IWRITE = Constant('S_IWRITE',00200)
|
||||
S_IEXEC = Constant('S_IEXEC',00100)
|
||||
S_IFMT = Constant('S_IFMT',0o0170000)
|
||||
S_IFSOCK = Constant('S_IFSOCK',0o140000)
|
||||
S_IFLNK = Constant('S_IFLNK',0o120000)
|
||||
S_IFREG = Constant('S_IFREG',0o100000)
|
||||
S_IFBLK = Constant('S_IFBLK',0o060000)
|
||||
S_IFDIR = Constant('S_IFDIR',0o040000)
|
||||
S_IFCHR = Constant('S_IFCHR',0o020000)
|
||||
S_IFIFO = Constant('S_IFIFO',0o010000)
|
||||
S_ISUID = Constant('S_ISUID',0o004000)
|
||||
S_ISGID = Constant('S_ISGID',0o002000)
|
||||
S_ISVTX = Constant('S_ISVTX',0o001000)
|
||||
S_IRWXU = Constant('S_IRWXU',0o0700)
|
||||
S_IRUSR = Constant('S_IRUSR',0o0400)
|
||||
S_IWUSR = Constant('S_IWUSR',0o0200)
|
||||
S_IXUSR = Constant('S_IXUSR',0o0100)
|
||||
S_IRWXG = Constant('S_IRWXG',0o0070)
|
||||
S_IRGRP = Constant('S_IRGRP',0o0040)
|
||||
S_IWGRP = Constant('S_IWGRP',0o0020)
|
||||
S_IXGRP = Constant('S_IXGRP',0o0010)
|
||||
S_IRWXO = Constant('S_IRWXO',0o0007)
|
||||
S_IROTH = Constant('S_IROTH',0o0004)
|
||||
S_IWOTH = Constant('S_IWOTH',0o0002)
|
||||
S_IXOTH = Constant('S_IXOTH',0o0001)
|
||||
S_IREAD = Constant('S_IREAD',0o0400)
|
||||
S_IWRITE = Constant('S_IWRITE',0o0200)
|
||||
S_IEXEC = Constant('S_IEXEC',0o0100)
|
||||
F_LINUX_SPECIFIC_BASE = Constant('F_LINUX_SPECIFIC_BASE',1024)
|
||||
O_ACCMODE = Constant('O_ACCMODE',0003)
|
||||
O_RDONLY = Constant('O_RDONLY',00)
|
||||
O_WRONLY = Constant('O_WRONLY',01)
|
||||
O_RDWR = Constant('O_RDWR',02)
|
||||
O_CREAT = Constant('O_CREAT',0100)
|
||||
O_EXCL = Constant('O_EXCL',0200)
|
||||
O_NOCTTY = Constant('O_NOCTTY',0400)
|
||||
O_TRUNC = Constant('O_TRUNC',01000)
|
||||
O_APPEND = Constant('O_APPEND',02000)
|
||||
O_NONBLOCK = Constant('O_NONBLOCK',04000)
|
||||
O_NDELAY = Constant('O_NDELAY',04000)
|
||||
O_SYNC = Constant('O_SYNC',010000)
|
||||
FASYNC = Constant('FASYNC',020000)
|
||||
O_DIRECT = Constant('O_DIRECT',040000)
|
||||
O_LARGEFILE = Constant('O_LARGEFILE',0100000)
|
||||
O_DIRECTORY = Constant('O_DIRECTORY',0200000)
|
||||
O_NOFOLLOW = Constant('O_NOFOLLOW',0400000)
|
||||
O_NOATIME = Constant('O_NOATIME',01000000)
|
||||
O_ACCMODE = Constant('O_ACCMODE',0o003)
|
||||
O_RDONLY = Constant('O_RDONLY',0o0)
|
||||
O_WRONLY = Constant('O_WRONLY',0o1)
|
||||
O_RDWR = Constant('O_RDWR',0o2)
|
||||
O_CREAT = Constant('O_CREAT',0o100)
|
||||
O_EXCL = Constant('O_EXCL',0o200)
|
||||
O_NOCTTY = Constant('O_NOCTTY',0o400)
|
||||
O_TRUNC = Constant('O_TRUNC',0o1000)
|
||||
O_APPEND = Constant('O_APPEND',0o2000)
|
||||
O_NONBLOCK = Constant('O_NONBLOCK',0o4000)
|
||||
O_NDELAY = Constant('O_NDELAY',0o4000)
|
||||
O_SYNC = Constant('O_SYNC',0o10000)
|
||||
FASYNC = Constant('FASYNC',0o20000)
|
||||
O_DIRECT = Constant('O_DIRECT',0o40000)
|
||||
O_LARGEFILE = Constant('O_LARGEFILE',0o100000)
|
||||
O_DIRECTORY = Constant('O_DIRECTORY',0o200000)
|
||||
O_NOFOLLOW = Constant('O_NOFOLLOW',0o400000)
|
||||
O_NOATIME = Constant('O_NOATIME',0o1000000)
|
||||
F_DUPFD = Constant('F_DUPFD',0)
|
||||
F_GETFD = Constant('F_GETFD',1)
|
||||
F_SETFD = Constant('F_SETFD',2)
|
||||
@@ -616,7 +616,7 @@ LOCK_MAND = Constant('LOCK_MAND',32)
|
||||
LOCK_READ = Constant('LOCK_READ',64)
|
||||
LOCK_WRITE = Constant('LOCK_WRITE',128)
|
||||
LOCK_RW = Constant('LOCK_RW',192)
|
||||
O_ASYNC = Constant('O_ASYNC',020000)
|
||||
O_ASYNC = Constant('O_ASYNC',0o20000)
|
||||
MREMAP_MAYMOVE = Constant('MREMAP_MAYMOVE',1)
|
||||
MREMAP_FIXED = Constant('MREMAP_FIXED',2)
|
||||
PROT_READ = Constant('PROT_READ',0x1)
|
||||
|
||||
@@ -533,32 +533,32 @@ F_ULOCK = Constant('F_ULOCK',0)
|
||||
F_LOCK = Constant('F_LOCK',1)
|
||||
F_TLOCK = Constant('F_TLOCK',2)
|
||||
F_TEST = Constant('F_TEST',3)
|
||||
S_IFMT = Constant('S_IFMT',00170000)
|
||||
S_IFSOCK = Constant('S_IFSOCK',0140000)
|
||||
S_IFLNK = Constant('S_IFLNK',0120000)
|
||||
S_IFREG = Constant('S_IFREG',0100000)
|
||||
S_IFBLK = Constant('S_IFBLK',0060000)
|
||||
S_IFDIR = Constant('S_IFDIR',0040000)
|
||||
S_IFCHR = Constant('S_IFCHR',0020000)
|
||||
S_IFIFO = Constant('S_IFIFO',0010000)
|
||||
S_ISUID = Constant('S_ISUID',0004000)
|
||||
S_ISGID = Constant('S_ISGID',0002000)
|
||||
S_ISVTX = Constant('S_ISVTX',0001000)
|
||||
S_IRWXU = Constant('S_IRWXU',00700)
|
||||
S_IRUSR = Constant('S_IRUSR',00400)
|
||||
S_IWUSR = Constant('S_IWUSR',00200)
|
||||
S_IXUSR = Constant('S_IXUSR',00100)
|
||||
S_IRWXG = Constant('S_IRWXG',00070)
|
||||
S_IRGRP = Constant('S_IRGRP',00040)
|
||||
S_IWGRP = Constant('S_IWGRP',00020)
|
||||
S_IXGRP = Constant('S_IXGRP',00010)
|
||||
S_IRWXO = Constant('S_IRWXO',00007)
|
||||
S_IROTH = Constant('S_IROTH',00004)
|
||||
S_IWOTH = Constant('S_IWOTH',00002)
|
||||
S_IXOTH = Constant('S_IXOTH',00001)
|
||||
S_IREAD = Constant('S_IREAD',00400)
|
||||
S_IWRITE = Constant('S_IWRITE',00200)
|
||||
S_IEXEC = Constant('S_IEXEC',00100)
|
||||
S_IFMT = Constant('S_IFMT',0o0170000)
|
||||
S_IFSOCK = Constant('S_IFSOCK',0o140000)
|
||||
S_IFLNK = Constant('S_IFLNK',0o120000)
|
||||
S_IFREG = Constant('S_IFREG',0o100000)
|
||||
S_IFBLK = Constant('S_IFBLK',0o060000)
|
||||
S_IFDIR = Constant('S_IFDIR',0o040000)
|
||||
S_IFCHR = Constant('S_IFCHR',0o020000)
|
||||
S_IFIFO = Constant('S_IFIFO',0o010000)
|
||||
S_ISUID = Constant('S_ISUID',0o004000)
|
||||
S_ISGID = Constant('S_ISGID',0o002000)
|
||||
S_ISVTX = Constant('S_ISVTX',0o001000)
|
||||
S_IRWXU = Constant('S_IRWXU',0o0700)
|
||||
S_IRUSR = Constant('S_IRUSR',0o0400)
|
||||
S_IWUSR = Constant('S_IWUSR',0o0200)
|
||||
S_IXUSR = Constant('S_IXUSR',0o0100)
|
||||
S_IRWXG = Constant('S_IRWXG',0o0070)
|
||||
S_IRGRP = Constant('S_IRGRP',0o0040)
|
||||
S_IWGRP = Constant('S_IWGRP',0o0020)
|
||||
S_IXGRP = Constant('S_IXGRP',0o0010)
|
||||
S_IRWXO = Constant('S_IRWXO',0o0007)
|
||||
S_IROTH = Constant('S_IROTH',0o0004)
|
||||
S_IWOTH = Constant('S_IWOTH',0o0002)
|
||||
S_IXOTH = Constant('S_IXOTH',0o0001)
|
||||
S_IREAD = Constant('S_IREAD',0o0400)
|
||||
S_IWRITE = Constant('S_IWRITE',0o0200)
|
||||
S_IEXEC = Constant('S_IEXEC',0o0100)
|
||||
F_LINUX_SPECIFIC_BASE = Constant('F_LINUX_SPECIFIC_BASE',1024)
|
||||
MREMAP_MAYMOVE = Constant('MREMAP_MAYMOVE',1)
|
||||
MREMAP_FIXED = Constant('MREMAP_FIXED',2)
|
||||
|
||||
@@ -576,32 +576,32 @@ F_ULOCK = Constant('F_ULOCK',0)
|
||||
F_LOCK = Constant('F_LOCK',1)
|
||||
F_TLOCK = Constant('F_TLOCK',2)
|
||||
F_TEST = Constant('F_TEST',3)
|
||||
S_IFMT = Constant('S_IFMT',00170000)
|
||||
S_IFSOCK = Constant('S_IFSOCK',0140000)
|
||||
S_IFLNK = Constant('S_IFLNK',0120000)
|
||||
S_IFREG = Constant('S_IFREG',0100000)
|
||||
S_IFBLK = Constant('S_IFBLK',0060000)
|
||||
S_IFDIR = Constant('S_IFDIR',0040000)
|
||||
S_IFCHR = Constant('S_IFCHR',0020000)
|
||||
S_IFIFO = Constant('S_IFIFO',0010000)
|
||||
S_ISUID = Constant('S_ISUID',0004000)
|
||||
S_ISGID = Constant('S_ISGID',0002000)
|
||||
S_ISVTX = Constant('S_ISVTX',0001000)
|
||||
S_IRWXU = Constant('S_IRWXU',00700)
|
||||
S_IRUSR = Constant('S_IRUSR',00400)
|
||||
S_IWUSR = Constant('S_IWUSR',00200)
|
||||
S_IXUSR = Constant('S_IXUSR',00100)
|
||||
S_IRWXG = Constant('S_IRWXG',00070)
|
||||
S_IRGRP = Constant('S_IRGRP',00040)
|
||||
S_IWGRP = Constant('S_IWGRP',00020)
|
||||
S_IXGRP = Constant('S_IXGRP',00010)
|
||||
S_IRWXO = Constant('S_IRWXO',00007)
|
||||
S_IROTH = Constant('S_IROTH',00004)
|
||||
S_IWOTH = Constant('S_IWOTH',00002)
|
||||
S_IXOTH = Constant('S_IXOTH',00001)
|
||||
S_IREAD = Constant('S_IREAD',00400)
|
||||
S_IWRITE = Constant('S_IWRITE',00200)
|
||||
S_IEXEC = Constant('S_IEXEC',00100)
|
||||
S_IFMT = Constant('S_IFMT',0o0170000)
|
||||
S_IFSOCK = Constant('S_IFSOCK',0o140000)
|
||||
S_IFLNK = Constant('S_IFLNK',0o120000)
|
||||
S_IFREG = Constant('S_IFREG',0o100000)
|
||||
S_IFBLK = Constant('S_IFBLK',0o060000)
|
||||
S_IFDIR = Constant('S_IFDIR',0o040000)
|
||||
S_IFCHR = Constant('S_IFCHR',0o020000)
|
||||
S_IFIFO = Constant('S_IFIFO',0o010000)
|
||||
S_ISUID = Constant('S_ISUID',0o004000)
|
||||
S_ISGID = Constant('S_ISGID',0o002000)
|
||||
S_ISVTX = Constant('S_ISVTX',0o001000)
|
||||
S_IRWXU = Constant('S_IRWXU',0o0700)
|
||||
S_IRUSR = Constant('S_IRUSR',0o0400)
|
||||
S_IWUSR = Constant('S_IWUSR',0o0200)
|
||||
S_IXUSR = Constant('S_IXUSR',0o0100)
|
||||
S_IRWXG = Constant('S_IRWXG',0o0070)
|
||||
S_IRGRP = Constant('S_IRGRP',0o0040)
|
||||
S_IWGRP = Constant('S_IWGRP',0o0020)
|
||||
S_IXGRP = Constant('S_IXGRP',0o0010)
|
||||
S_IRWXO = Constant('S_IRWXO',0o0007)
|
||||
S_IROTH = Constant('S_IROTH',0o0004)
|
||||
S_IWOTH = Constant('S_IWOTH',0o0002)
|
||||
S_IXOTH = Constant('S_IXOTH',0o0001)
|
||||
S_IREAD = Constant('S_IREAD',0o0400)
|
||||
S_IWRITE = Constant('S_IWRITE',0o0200)
|
||||
S_IEXEC = Constant('S_IEXEC',0o0100)
|
||||
F_LINUX_SPECIFIC_BASE = Constant('F_LINUX_SPECIFIC_BASE',1024)
|
||||
O_RDONLY = Constant('O_RDONLY',0x0000)
|
||||
O_WRONLY = Constant('O_WRONLY',0x0001)
|
||||
|
||||
@@ -524,32 +524,32 @@ F_ULOCK = Constant('F_ULOCK',0)
|
||||
F_LOCK = Constant('F_LOCK',1)
|
||||
F_TLOCK = Constant('F_TLOCK',2)
|
||||
F_TEST = Constant('F_TEST',3)
|
||||
S_IFMT = Constant('S_IFMT',00170000)
|
||||
S_IFSOCK = Constant('S_IFSOCK',0140000)
|
||||
S_IFLNK = Constant('S_IFLNK',0120000)
|
||||
S_IFREG = Constant('S_IFREG',0100000)
|
||||
S_IFBLK = Constant('S_IFBLK',0060000)
|
||||
S_IFDIR = Constant('S_IFDIR',0040000)
|
||||
S_IFCHR = Constant('S_IFCHR',0020000)
|
||||
S_IFIFO = Constant('S_IFIFO',0010000)
|
||||
S_ISUID = Constant('S_ISUID',0004000)
|
||||
S_ISGID = Constant('S_ISGID',0002000)
|
||||
S_ISVTX = Constant('S_ISVTX',0001000)
|
||||
S_IRWXU = Constant('S_IRWXU',00700)
|
||||
S_IRUSR = Constant('S_IRUSR',00400)
|
||||
S_IWUSR = Constant('S_IWUSR',00200)
|
||||
S_IXUSR = Constant('S_IXUSR',00100)
|
||||
S_IRWXG = Constant('S_IRWXG',00070)
|
||||
S_IRGRP = Constant('S_IRGRP',00040)
|
||||
S_IWGRP = Constant('S_IWGRP',00020)
|
||||
S_IXGRP = Constant('S_IXGRP',00010)
|
||||
S_IRWXO = Constant('S_IRWXO',00007)
|
||||
S_IROTH = Constant('S_IROTH',00004)
|
||||
S_IWOTH = Constant('S_IWOTH',00002)
|
||||
S_IXOTH = Constant('S_IXOTH',00001)
|
||||
S_IREAD = Constant('S_IREAD',00400)
|
||||
S_IWRITE = Constant('S_IWRITE',00200)
|
||||
S_IEXEC = Constant('S_IEXEC',00100)
|
||||
S_IFMT = Constant('S_IFMT',0o0170000)
|
||||
S_IFSOCK = Constant('S_IFSOCK',0o140000)
|
||||
S_IFLNK = Constant('S_IFLNK',0o120000)
|
||||
S_IFREG = Constant('S_IFREG',0o100000)
|
||||
S_IFBLK = Constant('S_IFBLK',0o060000)
|
||||
S_IFDIR = Constant('S_IFDIR',0o040000)
|
||||
S_IFCHR = Constant('S_IFCHR',0o020000)
|
||||
S_IFIFO = Constant('S_IFIFO',0o010000)
|
||||
S_ISUID = Constant('S_ISUID',0o004000)
|
||||
S_ISGID = Constant('S_ISGID',0o002000)
|
||||
S_ISVTX = Constant('S_ISVTX',0o001000)
|
||||
S_IRWXU = Constant('S_IRWXU',0o0700)
|
||||
S_IRUSR = Constant('S_IRUSR',0o0400)
|
||||
S_IWUSR = Constant('S_IWUSR',0o0200)
|
||||
S_IXUSR = Constant('S_IXUSR',0o0100)
|
||||
S_IRWXG = Constant('S_IRWXG',0o0070)
|
||||
S_IRGRP = Constant('S_IRGRP',0o0040)
|
||||
S_IWGRP = Constant('S_IWGRP',0o0020)
|
||||
S_IXGRP = Constant('S_IXGRP',0o0010)
|
||||
S_IRWXO = Constant('S_IRWXO',0o0007)
|
||||
S_IROTH = Constant('S_IROTH',0o0004)
|
||||
S_IWOTH = Constant('S_IWOTH',0o0002)
|
||||
S_IXOTH = Constant('S_IXOTH',0o0001)
|
||||
S_IREAD = Constant('S_IREAD',0o0400)
|
||||
S_IWRITE = Constant('S_IWRITE',0o0200)
|
||||
S_IEXEC = Constant('S_IEXEC',0o0100)
|
||||
F_LINUX_SPECIFIC_BASE = Constant('F_LINUX_SPECIFIC_BASE',1024)
|
||||
MREMAP_MAYMOVE = Constant('MREMAP_MAYMOVE',1)
|
||||
MREMAP_FIXED = Constant('MREMAP_FIXED',2)
|
||||
|
||||
@@ -917,51 +917,51 @@ F_LOCK = Constant('F_LOCK',1)
|
||||
F_TLOCK = Constant('F_TLOCK',2)
|
||||
F_TEST = Constant('F_TEST',3)
|
||||
STAT64_HAS_BROKEN_ST_INO = Constant('STAT64_HAS_BROKEN_ST_INO',1)
|
||||
S_IFMT = Constant('S_IFMT',00170000)
|
||||
S_IFSOCK = Constant('S_IFSOCK',0140000)
|
||||
S_IFLNK = Constant('S_IFLNK',0120000)
|
||||
S_IFREG = Constant('S_IFREG',0100000)
|
||||
S_IFBLK = Constant('S_IFBLK',0060000)
|
||||
S_IFDIR = Constant('S_IFDIR',0040000)
|
||||
S_IFCHR = Constant('S_IFCHR',0020000)
|
||||
S_IFIFO = Constant('S_IFIFO',0010000)
|
||||
S_ISUID = Constant('S_ISUID',0004000)
|
||||
S_ISGID = Constant('S_ISGID',0002000)
|
||||
S_ISVTX = Constant('S_ISVTX',0001000)
|
||||
S_IRWXU = Constant('S_IRWXU',00700)
|
||||
S_IRUSR = Constant('S_IRUSR',00400)
|
||||
S_IWUSR = Constant('S_IWUSR',00200)
|
||||
S_IXUSR = Constant('S_IXUSR',00100)
|
||||
S_IRWXG = Constant('S_IRWXG',00070)
|
||||
S_IRGRP = Constant('S_IRGRP',00040)
|
||||
S_IWGRP = Constant('S_IWGRP',00020)
|
||||
S_IXGRP = Constant('S_IXGRP',00010)
|
||||
S_IRWXO = Constant('S_IRWXO',00007)
|
||||
S_IROTH = Constant('S_IROTH',00004)
|
||||
S_IWOTH = Constant('S_IWOTH',00002)
|
||||
S_IXOTH = Constant('S_IXOTH',00001)
|
||||
S_IREAD = Constant('S_IREAD',00400)
|
||||
S_IWRITE = Constant('S_IWRITE',00200)
|
||||
S_IEXEC = Constant('S_IEXEC',00100)
|
||||
S_IFMT = Constant('S_IFMT',0o0170000)
|
||||
S_IFSOCK = Constant('S_IFSOCK',0o140000)
|
||||
S_IFLNK = Constant('S_IFLNK',0o120000)
|
||||
S_IFREG = Constant('S_IFREG',0o100000)
|
||||
S_IFBLK = Constant('S_IFBLK',0o060000)
|
||||
S_IFDIR = Constant('S_IFDIR',0o040000)
|
||||
S_IFCHR = Constant('S_IFCHR',0o020000)
|
||||
S_IFIFO = Constant('S_IFIFO',0o010000)
|
||||
S_ISUID = Constant('S_ISUID',0o004000)
|
||||
S_ISGID = Constant('S_ISGID',0o002000)
|
||||
S_ISVTX = Constant('S_ISVTX',0o001000)
|
||||
S_IRWXU = Constant('S_IRWXU',0o0700)
|
||||
S_IRUSR = Constant('S_IRUSR',0o0400)
|
||||
S_IWUSR = Constant('S_IWUSR',0o0200)
|
||||
S_IXUSR = Constant('S_IXUSR',0o0100)
|
||||
S_IRWXG = Constant('S_IRWXG',0o0070)
|
||||
S_IRGRP = Constant('S_IRGRP',0o0040)
|
||||
S_IWGRP = Constant('S_IWGRP',0o0020)
|
||||
S_IXGRP = Constant('S_IXGRP',0o0010)
|
||||
S_IRWXO = Constant('S_IRWXO',0o0007)
|
||||
S_IROTH = Constant('S_IROTH',0o0004)
|
||||
S_IWOTH = Constant('S_IWOTH',0o0002)
|
||||
S_IXOTH = Constant('S_IXOTH',0o0001)
|
||||
S_IREAD = Constant('S_IREAD',0o0400)
|
||||
S_IWRITE = Constant('S_IWRITE',0o0200)
|
||||
S_IEXEC = Constant('S_IEXEC',0o0100)
|
||||
F_LINUX_SPECIFIC_BASE = Constant('F_LINUX_SPECIFIC_BASE',1024)
|
||||
O_ACCMODE = Constant('O_ACCMODE',0003)
|
||||
O_RDONLY = Constant('O_RDONLY',00)
|
||||
O_WRONLY = Constant('O_WRONLY',01)
|
||||
O_RDWR = Constant('O_RDWR',02)
|
||||
O_CREAT = Constant('O_CREAT',0100)
|
||||
O_EXCL = Constant('O_EXCL',0200)
|
||||
O_NOCTTY = Constant('O_NOCTTY',0400)
|
||||
O_TRUNC = Constant('O_TRUNC',01000)
|
||||
O_APPEND = Constant('O_APPEND',02000)
|
||||
O_NONBLOCK = Constant('O_NONBLOCK',04000)
|
||||
O_NDELAY = Constant('O_NDELAY',04000)
|
||||
O_SYNC = Constant('O_SYNC',010000)
|
||||
FASYNC = Constant('FASYNC',020000)
|
||||
O_DIRECTORY = Constant('O_DIRECTORY',040000)
|
||||
O_NOFOLLOW = Constant('O_NOFOLLOW',0100000)
|
||||
O_DIRECT = Constant('O_DIRECT',0200000)
|
||||
O_LARGEFILE = Constant('O_LARGEFILE',0400000)
|
||||
O_NOATIME = Constant('O_NOATIME',01000000)
|
||||
O_ACCMODE = Constant('O_ACCMODE',0o003)
|
||||
O_RDONLY = Constant('O_RDONLY',0o0)
|
||||
O_WRONLY = Constant('O_WRONLY',0o1)
|
||||
O_RDWR = Constant('O_RDWR',0o2)
|
||||
O_CREAT = Constant('O_CREAT',0o100)
|
||||
O_EXCL = Constant('O_EXCL',0o200)
|
||||
O_NOCTTY = Constant('O_NOCTTY',0o400)
|
||||
O_TRUNC = Constant('O_TRUNC',0o1000)
|
||||
O_APPEND = Constant('O_APPEND',0o2000)
|
||||
O_NONBLOCK = Constant('O_NONBLOCK',0o4000)
|
||||
O_NDELAY = Constant('O_NDELAY',0o4000)
|
||||
O_SYNC = Constant('O_SYNC',0o10000)
|
||||
FASYNC = Constant('FASYNC',0o20000)
|
||||
O_DIRECTORY = Constant('O_DIRECTORY',0o40000)
|
||||
O_NOFOLLOW = Constant('O_NOFOLLOW',0o100000)
|
||||
O_DIRECT = Constant('O_DIRECT',0o200000)
|
||||
O_LARGEFILE = Constant('O_LARGEFILE',0o400000)
|
||||
O_NOATIME = Constant('O_NOATIME',0o1000000)
|
||||
F_DUPFD = Constant('F_DUPFD',0)
|
||||
F_GETFD = Constant('F_GETFD',1)
|
||||
F_SETFD = Constant('F_SETFD',2)
|
||||
@@ -992,7 +992,7 @@ LOCK_MAND = Constant('LOCK_MAND',32)
|
||||
LOCK_READ = Constant('LOCK_READ',64)
|
||||
LOCK_WRITE = Constant('LOCK_WRITE',128)
|
||||
LOCK_RW = Constant('LOCK_RW',192)
|
||||
O_ASYNC = Constant('O_ASYNC',020000)
|
||||
O_ASYNC = Constant('O_ASYNC',0o20000)
|
||||
MREMAP_MAYMOVE = Constant('MREMAP_MAYMOVE',1)
|
||||
MREMAP_FIXED = Constant('MREMAP_FIXED',2)
|
||||
PROT_READ = Constant('PROT_READ',0x1)
|
||||
|
||||
+172
-49
@@ -5,12 +5,14 @@ Implements context management so that nested/scoped contexts and threaded
|
||||
contexts work properly and as expected.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
|
||||
import collections
|
||||
import functools
|
||||
import logging
|
||||
import os
|
||||
import platform
|
||||
import six
|
||||
import socket
|
||||
import stat
|
||||
import string
|
||||
@@ -138,9 +140,9 @@ class _Tls_DictStack(threading.local, _DictStack):
|
||||
|
||||
>>> t = pwnlib.context._Tls_DictStack({})
|
||||
>>> t['key'] = 'value'
|
||||
>>> print t
|
||||
>>> print(t)
|
||||
{'key': 'value'}
|
||||
>>> def p(): print t
|
||||
>>> def p(): print(t)
|
||||
>>> thread = threading.Thread(target=p)
|
||||
>>> _ = (thread.start(), thread.join())
|
||||
{}
|
||||
@@ -150,7 +152,7 @@ class _Tls_DictStack(threading.local, _DictStack):
|
||||
|
||||
def _validator(validator):
|
||||
"""
|
||||
Validator that tis tightly coupled to the implementation
|
||||
Validator that is tightly coupled to the implementation
|
||||
of the classes here.
|
||||
|
||||
This expects that the object has a ._tls property which
|
||||
@@ -194,9 +196,9 @@ class Thread(threading.Thread):
|
||||
>>> context.clear()
|
||||
>>> context.update(arch='arm')
|
||||
>>> def p():
|
||||
... print context.arch
|
||||
... print(context.arch)
|
||||
... context.arch = 'mips'
|
||||
... print context.arch
|
||||
... print(context.arch)
|
||||
>>> # Note that a normal Thread starts with a clean context
|
||||
>>> # (i386 is the default architecture)
|
||||
>>> t = threading.Thread(target=p)
|
||||
@@ -204,7 +206,7 @@ class Thread(threading.Thread):
|
||||
i386
|
||||
mips
|
||||
>>> # Note that the main Thread's context is unchanged
|
||||
>>> print context.arch
|
||||
>>> print(context.arch)
|
||||
arm
|
||||
>>> # Note that a context-aware Thread receives a copy of the context
|
||||
>>> t = pwnlib.context.Thread(target=p)
|
||||
@@ -212,7 +214,7 @@ class Thread(threading.Thread):
|
||||
arm
|
||||
mips
|
||||
>>> # Again, the main thread is unchanged
|
||||
>>> print context.arch
|
||||
>>> print(context.arch)
|
||||
arm
|
||||
|
||||
Implementation Details:
|
||||
@@ -238,7 +240,13 @@ class Thread(threading.Thread):
|
||||
differently.
|
||||
"""
|
||||
context.update(**self.old)
|
||||
super(Thread, self).__bootstrap()
|
||||
sup = super(Thread, self)
|
||||
bootstrap = getattr(sup, '_bootstrap', None)
|
||||
if bootstrap is None:
|
||||
sup.__bootstrap()
|
||||
else:
|
||||
bootstrap()
|
||||
_bootstrap = __bootstrap
|
||||
|
||||
def _longest(d):
|
||||
"""
|
||||
@@ -252,17 +260,13 @@ def _longest(d):
|
||||
>>> pwnlib.context._longest(data) == data
|
||||
True
|
||||
>>> for i in pwnlib.context._longest(data):
|
||||
... print i
|
||||
... print(i)
|
||||
ccc
|
||||
bb
|
||||
a
|
||||
"""
|
||||
return collections.OrderedDict((k,d[k]) for k in sorted(d, key=len, reverse=True))
|
||||
|
||||
def TlsProperty(object):
|
||||
def __get__(self, obj, objtype=None):
|
||||
return obj._tls
|
||||
|
||||
class ContextType(object):
|
||||
r"""
|
||||
Class for specifying information about the target machine.
|
||||
@@ -298,7 +302,7 @@ class ContextType(object):
|
||||
>>> context.bits
|
||||
32
|
||||
>>> def nop():
|
||||
... print pwnlib.asm.asm('nop').encode('hex')
|
||||
... print(enhex(pwnlib.asm.asm('nop')))
|
||||
>>> nop()
|
||||
00f020e3
|
||||
>>> with context.local(arch = 'i386'):
|
||||
@@ -337,9 +341,13 @@ class ContextType(object):
|
||||
'binary': None,
|
||||
'bits': 32,
|
||||
'buffer_size': 4096,
|
||||
'cyclic_alphabet': string.ascii_lowercase.encode(),
|
||||
'cyclic_size': 4,
|
||||
'delete_corefiles': False,
|
||||
'device': os.getenv('ANDROID_SERIAL', None) or None,
|
||||
'encoding': 'auto',
|
||||
'endian': 'little',
|
||||
'gdbinit': "",
|
||||
'kernel': None,
|
||||
'log_level': logging.INFO,
|
||||
'log_file': _devnull(),
|
||||
@@ -389,6 +397,7 @@ class ContextType(object):
|
||||
'sparc64': big_64,
|
||||
'thumb': little_32,
|
||||
'vax': little_32,
|
||||
'none': {},
|
||||
})
|
||||
|
||||
#: Valid values for :attr:`endian`
|
||||
@@ -417,7 +426,7 @@ class ContextType(object):
|
||||
|
||||
All keyword arguments are passed to :func:`update`.
|
||||
"""
|
||||
self._tls = _Tls_DictStack(_defaultdict(ContextType.defaults))
|
||||
self._tls = _Tls_DictStack(_defaultdict(self.defaults))
|
||||
self.update(**kwargs)
|
||||
|
||||
|
||||
@@ -497,15 +506,15 @@ class ContextType(object):
|
||||
>>> context.timeout = 1
|
||||
>>> context.timeout == 1
|
||||
True
|
||||
>>> print context.timeout
|
||||
>>> print(context.timeout)
|
||||
1.0
|
||||
>>> with context.local(timeout = 2):
|
||||
... print context.timeout
|
||||
... print(context.timeout)
|
||||
... context.timeout = 3
|
||||
... print context.timeout
|
||||
... print(context.timeout)
|
||||
2.0
|
||||
3.0
|
||||
>>> print context.timeout
|
||||
>>> print(context.timeout)
|
||||
1.0
|
||||
"""
|
||||
class LocalContext(object):
|
||||
@@ -684,11 +693,11 @@ class ContextType(object):
|
||||
break
|
||||
|
||||
try:
|
||||
defaults = ContextType.architectures[arch]
|
||||
defaults = self.architectures[arch]
|
||||
except KeyError:
|
||||
raise AttributeError('AttributeError: arch must be one of %r' % sorted(ContextType.architectures))
|
||||
raise AttributeError('AttributeError: arch must be one of %r' % sorted(self.architectures))
|
||||
|
||||
for k,v in ContextType.architectures[arch].items():
|
||||
for k,v in defaults.items():
|
||||
if k not in self._tls:
|
||||
self._tls[k] = v
|
||||
|
||||
@@ -718,8 +727,8 @@ class ContextType(object):
|
||||
Even then, this doesn't matter much -- only when the the segment
|
||||
registers need to be known
|
||||
"""
|
||||
with context.local(arch=arch):
|
||||
return context.arch
|
||||
with self.local(arch=arch):
|
||||
return self.arch
|
||||
|
||||
@_validator
|
||||
def bits(self, bits):
|
||||
@@ -774,6 +783,7 @@ class ContextType(object):
|
||||
self.arch = binary.arch
|
||||
self.bits = binary.bits
|
||||
self.endian = binary.endian
|
||||
self.os = binary.os
|
||||
|
||||
return binary
|
||||
|
||||
@@ -782,7 +792,7 @@ class ContextType(object):
|
||||
"""
|
||||
Target machine word size, in bytes (i.e. the size of general purpose registers).
|
||||
|
||||
This is a convenience wrapper around ``bits / 8``.
|
||||
This is a convenience wrapper around ``bits // 8``.
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -795,11 +805,41 @@ class ContextType(object):
|
||||
...
|
||||
AttributeError: bits must be > 0 (0)
|
||||
"""
|
||||
return self.bits/8
|
||||
return self.bits // 8
|
||||
@bytes.setter
|
||||
def bytes(self, value):
|
||||
self.bits = value*8
|
||||
|
||||
@_validator
|
||||
def encoding(self, charset):
|
||||
if charset == 'auto':
|
||||
return charset
|
||||
|
||||
if ( b'aA'.decode(charset) != 'aA'
|
||||
or 'aA'.encode(charset) != b'aA'):
|
||||
raise ValueError('Strange encoding!')
|
||||
|
||||
return charset
|
||||
|
||||
def _encode(self, s):
|
||||
if isinstance(s, (bytes, bytearray)):
|
||||
return s # already bytes
|
||||
|
||||
if self.encoding == 'auto':
|
||||
try:
|
||||
return s.encode('latin1')
|
||||
except UnicodeEncodeError:
|
||||
return s.encode('utf-8', 'surrogateescape')
|
||||
return s.encode(self.encoding)
|
||||
|
||||
def _decode(self, b):
|
||||
if self.encoding == 'auto':
|
||||
try:
|
||||
return b.decode('utf-8')
|
||||
except UnicodeDecodeError:
|
||||
return b.decode('latin1')
|
||||
return b.decode(self.encoding)
|
||||
|
||||
@_validator
|
||||
def endian(self, endianness):
|
||||
"""
|
||||
@@ -831,10 +871,10 @@ class ContextType(object):
|
||||
"""
|
||||
endian = endianness.lower()
|
||||
|
||||
if endian not in ContextType.endiannesses:
|
||||
raise AttributeError("endian must be one of %r" % sorted(ContextType.endiannesses))
|
||||
if endian not in self.endiannesses:
|
||||
raise AttributeError("endian must be one of %r" % sorted(self.endiannesses))
|
||||
|
||||
return ContextType.endiannesses[endian]
|
||||
return self.endiannesses[endian]
|
||||
|
||||
|
||||
@_validator
|
||||
@@ -891,24 +931,23 @@ class ContextType(object):
|
||||
>>> with context.local(log_file='bar.txt'):
|
||||
... log.debug('Hello from bar!')
|
||||
>>> log.info('Hello from foo!')
|
||||
>>> file('foo.txt').readlines()[-3] #doctest: +ELLIPSIS
|
||||
>>> open('foo.txt').readlines()[-3] #doctest: +ELLIPSIS
|
||||
'...:DEBUG:...:Hello!\n'
|
||||
>>> file('foo.txt').readlines()[-2] #doctest: +ELLIPSIS
|
||||
>>> open('foo.txt').readlines()[-2] #doctest: +ELLIPSIS
|
||||
'...:INFO:...:Hello again!\n'
|
||||
>>> file('foo.txt').readlines()[-1] #doctest: +ELLIPSIS
|
||||
>>> open('foo.txt').readlines()[-1] #doctest: +ELLIPSIS
|
||||
'...:INFO:...:Hello from foo!\n'
|
||||
>>> file('bar.txt').readlines()[-1] #doctest: +ELLIPSIS
|
||||
>>> open('bar.txt').readlines()[-1] #doctest: +ELLIPSIS
|
||||
'...:DEBUG:...:Hello from bar!\n'
|
||||
"""
|
||||
if isinstance(value, (str,unicode)):
|
||||
modes = ('w', 'wb', 'a', 'ab')
|
||||
if isinstance(value, (bytes, six.text_type)):
|
||||
# check if mode was specified as "[value],[mode]"
|
||||
if ',' not in value:
|
||||
value += ',a'
|
||||
filename, mode = value.rsplit(',', 1)
|
||||
value = open(filename, mode)
|
||||
|
||||
elif not isinstance(value, (file)):
|
||||
elif not hasattr(value, "fileno"):
|
||||
raise AttributeError('log_file must be a file')
|
||||
|
||||
# Is this the same file we already have open?
|
||||
@@ -976,8 +1015,8 @@ class ContextType(object):
|
||||
"""
|
||||
os = os.lower()
|
||||
|
||||
if os not in ContextType.oses:
|
||||
raise AttributeError("os must be one of %r" % ContextType.oses)
|
||||
if os not in self.oses:
|
||||
raise AttributeError("os must be one of %r" % self.oses)
|
||||
|
||||
return os
|
||||
|
||||
@@ -1015,11 +1054,11 @@ class ContextType(object):
|
||||
...
|
||||
AttributeError: signed must be one of ['no', 'signed', 'unsigned', 'yes'] or a non-string truthy value
|
||||
"""
|
||||
try: signed = ContextType.signednesses[signed]
|
||||
try: signed = self.signednesses[signed]
|
||||
except KeyError: pass
|
||||
|
||||
if isinstance(signed, str):
|
||||
raise AttributeError('signed must be one of %r or a non-string truthy value' % sorted(ContextType.signednesses))
|
||||
raise AttributeError('signed must be one of %r or a non-string truthy value' % sorted(self.signednesses))
|
||||
|
||||
return bool(signed)
|
||||
|
||||
@@ -1043,7 +1082,7 @@ class ContextType(object):
|
||||
Can be a string or an iterable of strings. In the latter case the first
|
||||
entry is the terminal and the rest are default arguments.
|
||||
"""
|
||||
if isinstance(value, (str, unicode)):
|
||||
if isinstance(value, (bytes, six.text_type)):
|
||||
return [value]
|
||||
return value
|
||||
|
||||
@@ -1124,13 +1163,13 @@ class ContextType(object):
|
||||
def device(self, device):
|
||||
"""Sets the device being operated on.
|
||||
"""
|
||||
if isinstance(device, (bytes, six.text_type)):
|
||||
device = Device(device)
|
||||
if isinstance(device, Device):
|
||||
self.arch = device.arch or self.arch
|
||||
self.bits = device.bits or self.bits
|
||||
self.endian = device.endian or self.endian
|
||||
self.os = device.os or self.os
|
||||
elif isinstance(device, str):
|
||||
device = Device(device)
|
||||
elif device is not None:
|
||||
raise AttributeError("device must be either a Device object or a serial number as a string")
|
||||
|
||||
@@ -1190,7 +1229,7 @@ class ContextType(object):
|
||||
if not os.access(home, os.W_OK):
|
||||
return None
|
||||
|
||||
cache = os.path.join(home, '.pwntools-cache')
|
||||
cache = os.path.join(home, '.pwntools-cache-%d.%d' % sys.version_info[:2])
|
||||
|
||||
if not os.path.exists(cache):
|
||||
try:
|
||||
@@ -1231,6 +1270,49 @@ class ContextType(object):
|
||||
"""
|
||||
return bool(v)
|
||||
|
||||
|
||||
@_validator
|
||||
def gdbinit(self, value):
|
||||
"""Path to the gdbinit that is used when running GDB locally.
|
||||
|
||||
This is useful if you want pwntools-launched GDB to include some additional modules,
|
||||
like PEDA but you do not want to have GDB include them by default.
|
||||
|
||||
The setting will only apply when GDB is launched locally since remote hosts may not have
|
||||
the necessary requirements for the gdbinit.
|
||||
|
||||
If set to an empty string, GDB will use the default `~/.gdbinit`.
|
||||
|
||||
Default value is ``""``.
|
||||
"""
|
||||
return str(value)
|
||||
|
||||
@_validator
|
||||
def cyclic_alphabet(self, alphabet):
|
||||
"""Cyclic alphabet.
|
||||
|
||||
Default value is `string.ascii_lowercase`.
|
||||
"""
|
||||
|
||||
# Do not allow multiple occurrences
|
||||
if len(set(alphabet)) != len(alphabet):
|
||||
raise AttributeError("cyclic alphabet cannot contain duplicates")
|
||||
|
||||
return alphabet.encode()
|
||||
|
||||
@_validator
|
||||
def cyclic_size(self, size):
|
||||
"""Cyclic pattern size.
|
||||
|
||||
Default value is `4`.
|
||||
"""
|
||||
size = int(size)
|
||||
|
||||
if size > self.bytes:
|
||||
raise AttributeError("cyclic pattern size cannot be larger than word size")
|
||||
|
||||
return size
|
||||
|
||||
#*************************************************************************
|
||||
# ALIASES
|
||||
#*************************************************************************
|
||||
@@ -1341,11 +1423,39 @@ def LocalContext(function):
|
||||
"""
|
||||
@functools.wraps(function)
|
||||
def setter(*a, **kw):
|
||||
# Fast path to skip adding a Context frame
|
||||
if not kw:
|
||||
return function(*a)
|
||||
with context.local(**{k:kw.pop(k) for k,v in tuple(kw.items()) if isinstance(getattr(ContextType, k, None), property)}):
|
||||
arch = context.arch
|
||||
bits = context.bits
|
||||
endian = context.endian
|
||||
|
||||
with context.local(**{k:kw.pop(k) for k,v in kw.items() if isinstance(getattr(ContextType, k, None), property)}):
|
||||
# Prevent the user from doing silly things with invalid
|
||||
# architecture / bits / endianness combinations.
|
||||
if (arch == 'i386' and bits != 32) \
|
||||
or (arch == 'amd64' and bits != 64):
|
||||
raise AttributeError("Invalid arch/bits combination: %s/%s" % (arch, bits))
|
||||
|
||||
if arch in ('i386', 'amd64') and endian == 'big':
|
||||
raise AttributeError("Invalid arch/endianness combination: %s/%s" % (arch, endian))
|
||||
|
||||
return function(*a, **kw)
|
||||
return setter
|
||||
|
||||
def LocalNoarchContext(function):
|
||||
"""
|
||||
Same as LocalContext, but resets arch to :const:`'none'` by default
|
||||
|
||||
Example:
|
||||
|
||||
>>> @LocalNoarchContext
|
||||
... def printArch():
|
||||
... print(context.arch)
|
||||
>>> printArch()
|
||||
none
|
||||
"""
|
||||
@functools.wraps(function)
|
||||
def setter(*a, **kw):
|
||||
kw.setdefault('arch', 'none')
|
||||
with context.local(**{k:kw.pop(k) for k,v in tuple(kw.items()) if isinstance(getattr(ContextType, k, None), property)}):
|
||||
return function(*a, **kw)
|
||||
return setter
|
||||
|
||||
@@ -1359,8 +1469,21 @@ def update_context_defaults(section):
|
||||
if key not in ContextType.defaults:
|
||||
log.warn("Unknown configuration option %r in section %r" % (key, 'context'))
|
||||
continue
|
||||
if isinstance(ContextType.defaults[key], (str, unicode, tuple)):
|
||||
|
||||
default = ContextType.defaults[key]
|
||||
|
||||
if isinstance(default, six.string_types + six.integer_types + (tuple, list, dict)):
|
||||
value = safeeval.expr(value)
|
||||
else:
|
||||
log.warn("Unsupported configuration option %r in section %r" % (key, 'context'))
|
||||
|
||||
# Attempt to set the value, to see if it is value:
|
||||
try:
|
||||
with context.local(**{key: value}):
|
||||
value = getattr(context, key)
|
||||
except (ValueError, AttributeError) as e:
|
||||
log.warn("Could not set context.%s=%s via pwn.conf (%s)", key, section[key], e)
|
||||
continue
|
||||
|
||||
ContextType.defaults[key] = value
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
from __future__ import absolute_import
|
||||
from pwnlib.data.elf import relro
|
||||
|
||||
import os
|
||||
path = os.path.dirname(__file__)
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
import os
|
||||
path = os.path.dirname(__file__)
|
||||
|
||||
def get(x):
|
||||
return os.path.join(path, x)
|
||||
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Loaded 100 of 694 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user