572 Commits
Author SHA1 Message Date
van Hauser 022790867d Merge pull request #691 from Schweinepriester/patch-1
README: HTTP => HTTPS
2021-11-07 13:33:26 +01:00
Kai f20ca77309 README: HTTP => HTTPS 2021-11-05 17:47:21 +01:00
vanhauser-thc 9b055287c0 fix -M ipv6 2021-11-01 14:13:51 +01:00
vanhauser-thc 13db28f9d2 rdp empty pw fix 2021-10-27 17:19:13 +02:00
vanhauser-thc 3e364483d2 support xcode 2021-10-20 16:29:52 +02:00
vanhauser-thc 89fbd9a44d debug 2021-10-14 10:14:42 +02:00
vanhauser-thc b3bd068334 fix nits 2021-10-06 15:21:26 +02:00
vanhauser-thc 5cb14100f8 remove old option from help output 2021-08-31 09:37:06 +02:00
vanhauser-thc 67ef4c733f code format 2021-08-23 11:31:58 +02:00
van Hauser 09453c7be8 Merge pull request #681 from ultimaiiii/master
New CobaltStrike module
2021-08-23 11:28:32 +02:00
ultimaiiii c9da867141 Move CS service to keep service list sorted 2021-08-21 17:12:40 +00:00
ultimaiiii cb8fccda71 Rename MS to CS 2021-08-21 17:07:40 +00:00
ultimaiiii 63badb59af Makefile fix 2021-08-20 23:18:46 +00:00
ultimaiiii 84c7b116db New CobaltStrike module 2021-08-20 23:09:51 +00:00
vanhauser-thc 93cee75419 added make uninstall 2021-08-17 18:21:43 +02:00
van Hauser 403d00e897 Merge pull request #675 from horner/master
telnet detects password retries with same user
2021-08-06 11:54:26 +02:00
horner edc910628f telnet detects password retries with same user 2021-08-05 13:52:18 -04:00
vanhauser-thc cf20153655 smtp-enum: skip host on unsupported command 2021-08-01 11:06:15 +02:00
vanhauser-thc b375bbc332 skip host when password is found on password-only checks 2021-06-29 12:15:03 +02:00
vanhauser-thc 0b1f3c5037 fix ssh for -M and ip/range 2021-06-29 12:04:36 +02:00
vanhauser-thc 93283091d0 sscanf change 2021-06-24 09:22:53 +02:00
vanhauser-thc d3f784ab64 fix 2021-06-17 16:17:44 +02:00
vanhauser-thc 92ef7d7455 Revert "Merge pull request #666 from Yisus7u7/master"
This reverts commit 5b98a23140, reversing
changes made to a6784e4021.
2021-06-17 16:16:43 +02:00
van Hauser 5b98a23140 Merge pull request #666 from Yisus7u7/master
Add more files to GitHub pages
2021-06-17 16:13:18 +02:00
Yisus7u7 12dc488f3f Set theme jekyll-theme-slate 2021-06-16 22:55:27 -05:00
Yisus7u7 486a6bddde Merge branch 'vanhauser-thc:master' into master 2021-06-16 16:31:08 -05:00
Yisus7u7 e02b0d41e5 Show repo info in image 2021-06-16 16:30:45 -05:00
Yisus7u7 3b9280da3a Update README.md 2021-06-16 16:19:51 -05:00
Yisus7u7 cf325b0008 Update README.md 2021-06-16 16:18:57 -05:00
Yisus7u7 9fc4aabd6b Update index.md 2021-06-16 16:15:08 -05:00
Yisus7u7 54c2e85d79 Update index.md 2021-06-16 16:13:24 -05:00
Yisus7u7 d260804d19 Update index.md 2021-06-16 16:12:12 -05:00
Yisus7u7 2d12a0df6a Create index.md 2021-06-16 16:06:21 -05:00
Yisus7u7 bfdbeee1b2 Delete index.md 2021-06-16 15:54:06 -05:00
Yisus7u7 caf39e1542 Update README.md 2021-06-16 15:51:52 -05:00
Yisus7u7 be95247c69 Update README.md 2021-06-16 15:48:43 -05:00
Yisus7u7 0483351e6a Create index.md 2021-06-16 15:44:42 -05:00
van Hauser a6784e4021 Merge pull request #665 from Yisus7u7/master
Add GitHub pages service
2021-06-16 21:56:20 +02:00
Yisus7u7 27cab133fa Delete index.md 2021-06-16 12:56:27 -05:00
Yisus7u7 24395ab478 Set theme jekyll-theme-midnight 2021-06-16 12:53:17 -05:00
Yisus7u7 55682bf69a Set theme jekyll-theme-modernist 2021-06-16 12:51:29 -05:00
Yisus7u7 7601493400 Create index.md 2021-06-16 12:50:01 -05:00
Yisus7u7 3450d87420 Update _config.yml 2021-06-16 12:46:23 -05:00
Yisus7u7 acd4bcf1a7 Set theme jekyll-theme-hacker 2021-06-16 12:43:58 -05:00
vanhauser-thc bc9190d3dd fix 2021-06-16 11:18:12 +02:00
van Hauser 659ab10b14 Merge pull request #664 from Yisus7u7/master
Add termux setup file (android)
2021-06-16 11:16:07 +02:00
Yisus7u7 f1cc9e6cfb Specify in the INSTALL file the steps for Android (termux) 2021-06-16 03:06:40 -05:00
Yisus7u7 b7e77d7672 Specify in the INSTALL file the steps for Android (termux) 2021-06-16 03:03:31 -05:00
Yisus7u7 f12dc459c1 Specify in the INSTALL file the steps for Android (termux) 2021-06-16 03:01:07 -05:00
Yisus7u7 ef3c334671 Add termux setup file (android) 2021-06-16 02:30:45 -05:00
van Hauser 4de7595357 Merge pull request #662 from abhackerofficial/patch-1
Fixed data types.
2021-06-12 11:40:48 +02:00
ABHacker Official 19432a2173 Fixed data types. 2021-06-12 11:34:57 +05:30
van Hauser fb0b2e030e Merge pull request #651 from wj0s3ph/master
fix: skip user bug
2021-05-19 14:28:20 +02:00
wj0seph 221876598b fix: skip user bug
username can potentially be identical to the beginning of login_ptr
2021-05-19 20:18:49 +08:00
van Hauser fc70daa757 Merge pull request #648 from sanmacorz/master
Changed index() to strchr()
2021-05-16 18:13:38 +02:00
sanmacorz c81f0b97e7 Changed index() to strchr() 2021-05-12 12:22:48 -05:00
van Hauser d6a42ace44 Merge pull request #638 from chris-pcguy/master
Fix logic bug
2021-04-26 21:10:33 +02:00
Christian Inci a2d715b870 Fix logic bug
I can provide another patch version, which swaps the operands instead.

Signed-off-by: Christian Inci <chris.gh@broke-the-inter.net>
2021-04-26 20:56:22 +02:00
vanhauser-thc dd8348bcf0 removed bad entries in dpl 2021-04-23 17:06:18 +02:00
vanhauser-thc bd2f949b34 removed bad entries in dpl 2021-04-23 17:05:58 +02:00
vanhauser-thc e7b3d09d00 removed bad entries in dpl 2021-04-23 16:07:50 +02:00
vanhauser-thc 593c5b151a fix macos + freerdp 2021-04-16 09:50:14 +02:00
vanhauser-thc 0749b9be9f malloc checks for restore 2021-04-15 11:35:34 +02:00
van Hauser 6381ab2cd3 Merge pull request #623 from xambroz/desktop-launcher
Desktop launcher
2021-03-24 08:51:26 +01:00
xambroz 5c9184061f Install the desktop launcher for xhydra 2021-03-24 04:20:43 +01:00
xambroz f250c8a191 Add the desktop launcher file 2021-03-24 03:52:36 +01:00
xambroz b6dda7da81 Add transparent PNG file to be used as icon
Add transparent PNG file to be used as launcher icon. The original JPG is not transparent so it doesn't go well with window theme.
2021-03-24 03:50:55 +01:00
van Hauser fd55766ea3 Merge pull request #621 from mexicarne/master
Fix assignment
2021-03-17 11:11:21 +01:00
Ruslan Makhmatkhanov 2ec0b164ca fix typo: comparison -> assignment 2021-03-17 13:04:24 +03:00
Ruslan Makhmatkhanov 2cbbc53692 Merge pull request #1 from vanhauser-thc/master
merge upstream
2021-03-17 13:02:07 +03:00
vanhauser-thc fe930f4dd1 hydra 9.2 release 2021-03-15 18:52:54 +01:00
vanhauser-thc cedbd0ddb2 indent 2021-03-11 14:00:40 +01:00
vanhauser-thc f423875d90 remove rain mode 2021-03-11 14:00:00 +01:00
vanhauser-thc ac2fd35b4f allow configure to pick up PKG_CONFIG 2021-02-19 09:19:05 +01:00
van Hauser 51da37bfd8 Update issue templates 2021-01-29 10:29:28 +01:00
van Hauser 0407699583 Update issue templates 2021-01-29 10:23:27 +01:00
van Hauser 09f6a71e84 2021 2021-01-01 12:20:49 +01:00
van Hauser 6364bf329b Merge pull request #586 from kazkansouh/http-get-ipv6
http-get: ipv6 fix
2020-12-27 00:32:06 +01:00
Karim Kanso 37a0eeaabe www: normalise webtarget 2020-12-26 16:42:57 +00:00
van Hauser 08fc0fb2e2 Merge pull request #582 from e2002e/master
cleanup
2020-12-04 17:09:00 +01:00
y 3be6824fa2 cleanup 2020-12-04 12:50:46 +01:00
van Hauser 53290bb5cc Merge pull request #569 from e2002e/master
Rain mode
2020-11-30 13:56:15 +01:00
van Hauser 469cafb639 Merge pull request #579 from kazkansouh/http-form-ipv6
http-form: ipv6 fix
2020-11-30 13:54:38 +01:00
e2002e 026ea7017e Merge branch 'master' into master 2020-11-14 13:22:53 +00:00
owein 1a1bcf3855 uptodate with rainycrack 2020-11-14 14:20:00 +01:00
van Hauser ea50c0a11f Merge pull request #578 from kazkansouh/libsmbclient-miscptr
smb2: fix parsing of miscptr
2020-11-13 15:08:32 +01:00
owein 78b3358862 profound mangling 2020-11-12 17:06:53 +01:00
Karim Kanso 7f19248e34 resolve compiler warnings identified by gcc 9.3.0 2020-11-12 15:31:03 +00:00
Karim Kanso 981e19852b www-form: normalise webtarget 2020-11-12 15:31:03 +00:00
Karim Kanso 1df1d63c4f smb2: fix parsing of miscptr 2020-11-11 11:18:04 +00:00
owein 56d1726edf lqst commit 2020-11-09 19:41:00 +01:00
owein b61dbacca9 up to last fix 2020-11-09 19:25:26 +01:00
owein 5e98fe23e7 see https://github.com/e2002e/zhou 2020-10-22 02:35:46 +02:00
van Hauser c2260d2c5d Merge pull request #574 from ddeka2910/master
Add architecture ppc64le to travis build
2020-10-20 17:53:21 +02:00
ddeka2910 2d0723b281 Add architecture ppc64le to travis build 2020-10-20 21:04:31 +05:30
ddeka2910 be654c6bac As is 2020-10-20 21:02:17 +05:30
van Hauser 927ed229f2 Merge pull request #571 from g3offrey/master
html_encode the + character
2020-10-16 16:24:46 +02:00
van Hauser 631a61be8e fix http-post-form optional parameter parsing 2020-10-16 13:49:07 +02:00
owein e69f06ef62 this should be the last commit 2020-10-10 19:49:02 +02:00
owein 9edbcd3c36 slight modif that fixes all 2020-10-10 18:52:04 +02:00
owein D 033c881f8f implement rain 2020-10-08 04:10:54 +02:00
owein D fdb1c09c8e if current < 4 2020-10-05 14:45:40 +02:00
owein D fc82b52505 working algo after a change 2020-10-05 14:37:04 +02:00
Geoffrey bbab443f88 html_encode the + character 2020-10-02 16:44:10 +02:00
owein D 490bd3e7cd avoid negative values for the rotation variable 2020-09-30 10:19:10 +02:00
owein D c65e3a26fc update efficient rain option 2020-09-29 21:01:13 +02:00
owein 3fa6d372cf fixed min length 2020-09-11 11:59:20 +02:00
owein 14ee7f2c83 typos again, too much copies and pastes... 2020-09-10 13:02:46 +02:00
e2002e 60a9924547 Merge branch 'master' into master 2020-09-10 12:52:26 +02:00
owein 2514335bf9 clean 2020-09-10 12:45:35 +02:00
owein a6a87f11f4 fixed rotation broken due to a typo. 2020-09-10 10:57:06 +02:00
owein fd8e83d0b1 done 2020-09-09 21:36:30 +02:00
owein 0e4913a7c1 help menu ok 2020-09-09 18:38:07 +02:00
owein 3742af00bb rebranded the bruteforce variation method 2020-09-09 18:34:40 +02:00
van Hauser 78387c1ab1 Merge pull request #553 from maaaaz/msys2
MSYS2 support
2020-08-16 13:43:23 +02:00
maaaaz 84e765d3a9 msys support 2020-08-16 04:10:38 -04:00
van Hauser 79fa70cfdb fix with gcc10 and overriden CFLAGS 2020-08-02 07:12:19 +02:00
van Hauser 0a17bf5f53 v9.1 release 2020-07-29 09:36:37 +02:00
van Hauser a73cd388f8 fix PR 2020-07-07 18:43:53 +02:00
van Hauser df475f1900 Merge pull request #538 from animetauren/master
Updating hydra support for freedrdp 3
2020-07-07 18:07:53 +02:00
Henry Robalino fc196d7fc2 Updating freerdp logic to check v3 first
Updating the logic here to check for freerdpv3 first and if found do not check for freerdpv2. Also fixed paths for freerdpv2 paths.
Updated bash "or" to use "||" and "and" to use "&&" conditionals with proper POSIX specifications.
2020-07-07 11:25:09 -04:00
van Hauser 1ce502e754 Merge pull request #542 from Jab2870/https-help
Usage: Fix help for https-post-form and https-get-form
2020-06-26 17:39:04 +02:00
Jonathan Hodgson 5ec8a3e5e9 Makes change work on any sting starting with https
As per suggestion, the code now remvoes the 's' on any module starting
with https-
2020-06-26 15:31:20 +01:00
Jonathan Hodgson 62f06dce24 Usage: Fix help for https-post-form and https-get-form
Fixes issue #530
2020-06-26 11:49:18 +01:00
van Hauser 4ea2db2fe1 Merge pull request #541 from kazkansouh/oracle-fix
oracle: add success condition and fix skipped tries
2020-06-25 22:23:18 +02:00
Karim Kanso 11a96e5d32 oracle: add success condition and fix skipped tries 2020-06-25 20:21:16 +01:00
Henry Robalino 435ed44289 Adding step to makefile to fix Lib Symlinks 2020-06-16 10:19:16 -04:00
Henry Robalino f5b3fe77d3 Fixing typo on xlibs path 2020-06-16 09:56:11 -04:00
Henry Robalino 54dd5667ff Fixing XDEFINES
Trying to fix defines for freerdp
2020-06-16 09:53:24 -04:00
Henry Robalino 9c300ea820 Refactoring libfreerdp
Removing double entry of libfreerdp in hydra.c and hydra-rdp.c
2020-06-15 15:51:22 -04:00
Henry Robalino 70fb9e4fa5 Fixing logic that checks for rdp libraries
Fixed logic inside of configure to properly check for freedrdp2 if not found check for freerdp3, if found to skip freerdp3
2020-06-12 12:11:03 -04:00
Henry Robalino fdc460c7fb Fixing logic issue with hydra.c file
Did not do proper check for freerdp2 or freerdp3 modules
2020-06-12 11:32:25 -04:00
Henry Robalino bc6e8aec41 Adding support to check for freerdp2 and freerdp3
Adding logic to check for freerdp2 first and if not the rdp module will check for freerdp3 to support the rdp module
2020-06-12 11:19:01 -04:00
van Hauser 09a247412b compiler option change 2020-06-10 10:17:40 +02:00
Henry Robalino b0c1a9d1de Updated version of freerdp lib supported to 3.0 2020-06-08 09:24:16 -04:00
Henry Robalino a88198051b add support for freerdp3"
Added support for freerdp module 3, this is the newest module from freerdp
2020-06-05 17:28:49 -04:00
van Hauser 8b603b82a2 fix makefile 2020-05-28 22:39:13 +02:00
van Hauser 1ed6909836 more buffer 2020-05-28 22:38:52 +02:00
van Hauser e33152230b Merge pull request #529 from kazkansouh/http-proxy-buffer-fix
http-proxy: Fix for multiline buffer
2020-05-28 22:35:08 +02:00
van Hauser c426452772 fuck backward compatability - snprintf for the win 2020-05-21 22:43:13 +02:00
van Hauser 609201f9c4 Merge pull request #535 from TenGbps/patch-1
Update sasl.c
2020-05-21 22:37:49 +02:00
TenGbps 167a1c53e8 Update sasl.c
Some this the realm are long, if is too long is getting a #392
2020-05-21 17:46:26 +02:00
Karim Kanso a40bfb1e54 add 404 to http-proxy as a success condition 2020-05-14 10:58:14 +01:00
Karim Kanso 99d8ef8f3c fix -Wformat-overflow= warnings in sprintf 2020-05-14 10:18:20 +01:00
Karim Kanso dac0c18f75 fix http-proxy to handle multiline buffer data 2020-05-14 09:56:57 +01:00
van Hauser 9abb946dc1 Merge pull request #523 from maaaaz/cygwin_oracle
oracle on cygwin support
2020-04-26 16:50:51 +02:00
maaaaz 8f45980625 oracle on cygwin support 2020-04-26 09:52:11 -04:00
van Hauser 33680d9b0a Merge pull request #522 from maaaaz/libfreerdp_libwinpr
libfreerdp2 and libwinpr2 fix in configure
2020-04-26 12:53:21 +02:00
maaaaz e2dc1d5109 libfreerdp2 and libwinpr2 fix in configure 2020-04-26 06:44:12 -04:00
van Hauser dea22d3e7e tiny fix 2020-04-25 18:03:24 +02:00
van Hauser 96779d6daa Merge pull request #511 from kazkansouh/libsmbclient-eperm
SMB2: improved compatibility when null sessions fail
2020-04-08 23:21:56 +02:00
Karim Kanso 4e45f85fbb improved compatibility when null sessions fail 2020-04-08 21:32:48 +01:00
van Hauser 1ea3fc5a28 Merge pull request #509 from GitAntoinee/master
Add optional option to skip pre-request
2020-04-02 10:46:32 +02:00
GitAntoinee 8a50072e42 Fix indentation in help 2020-04-01 21:12:10 +02:00
GitAntoinee f0424742e3 Fix indentation in help 2020-04-01 21:10:48 +02:00
Antoine 47f24cb256 Update help 2020-04-01 17:37:44 +02:00
GitAntoinee bea3cf2bd1 Update help 2020-04-01 15:58:00 +02:00
GitAntoinee 7b053d7164 Add optional option to skip pre-request 2020-04-01 15:52:47 +02:00
van Hauser 88637abe26 fix typo 2020-04-01 12:26:28 +02:00
van Hauser b0fc44daa2 update todo and bfg too many entries message 2020-03-10 09:53:27 +01:00
van Hauser 8426e55939 Merge pull request #500 from xambroz/patch-1
Consider the /usr/include/firebird/ path for fb
2020-03-03 20:30:37 +01:00
xambroz 4fd33e8ca2 Consider the /usr/include/firebird/ path for fb
For example on the Fedora 31 the path for the firebird include ibase.h is /usr/include/firebird/ibase.
This patch should also consider the firebird subdirectory inside the regular include directory.
2020-03-03 17:37:12 +01:00
van Hauser 90bbde1be8 clarify license 2020-02-17 11:16:51 +01:00
van Hauser 5b6fc88428 fixed crash in rtsp module 2020-02-17 10:39:17 +01:00
van Hauser 0b093e67c4 remove carriage returns in lines (pw-inspector) 2020-02-17 09:44:26 +01:00
van Hauser 720bdb3f96 code indent 2020-02-01 11:47:13 +01:00
van Hauser 531ee7734b fix for very very old compilers 2020-02-01 11:36:33 +01:00
van Hauser 60c76d0c64 BN_zero fix 2020-01-29 12:24:46 +01:00
van Hauser 13934c5b19 gcc-10 fix 2020-01-28 11:06:44 +01:00
van Hauser 0a1bdf2527 Merge pull request #491 from jer-gentoo/vnc-hydra_report-buf2
hydra-vnc: Use buf2 instead of buf in hydra_report
2020-01-27 14:44:27 +01:00
van Hauser 73318ff14f Merge pull request #490 from jer-gentoo/modules-unused-buf
modules: Remove various unused char *buf
2020-01-27 14:44:01 +01:00
Jeroen Roovers 020137ac35 modules: Remove various unused char *buf 2020-01-26 17:09:07 +01:00
Jeroen Roovers 35cab1e127 hydra-vnc: Use buf2 instead of buf in hydra_report
A compiler warning told me that buf was used uninitialised here and it
turned out that instead of buf2, buf was being used. It makes a lot more
sense to report buf2 and that happens to fix the warning as well.
2020-01-26 17:06:47 +01:00
van Hauser 84fb3fac07 Merge pull request #489 from kazkansouh/libsmbclient
Updated xhydra to support smb2
2020-01-19 13:23:38 +01:00
Karim Kanso c8de75bf13 Updated xhydra to support smb2 2020-01-18 19:40:14 +00:00
van Hauser f05718824d make CFLAGS overridable 2020-01-18 11:47:36 +01:00
van Hauser 69a6b4f7d7 added changelog entry 2020-01-18 11:33:23 +01:00
van Hauser da568a871a in the future I will learn not to push Makefile ... 2020-01-18 11:15:11 +01:00
van Hauser a6eda41751 fixed off-by-one bug 2020-01-18 11:14:39 +01:00
van Hauser 8e3e5db7ba Merge pull request #487 from kazkansouh/libsmbclient
SMB2/3 support
2020-01-18 11:08:05 +01:00
Karim Kanso 2423cbd5d5 smb2 module, provides linkage with libsmbclient to interface with smbv2/v3 servers.
Developed against version: 2:4.7.6+dfsg~ubuntu-0ubuntu2.1
2020-01-17 19:04:13 +00:00
van Hauser db2a1feeb8 bump year 2020-01-07 15:09:28 +01:00
van Hauser d0c9d7ca3f http-form parse option fix 2019-11-20 12:13:14 +01:00
owein ccd3a99765 rolled back the http-form parameters parsing.
help for bfg's rain is in bfg's help now
2019-11-19 16:49:54 +01:00
van Hauser b8c30ef0b0 rdp account missing permissions detection 2019-11-07 10:05:15 +01:00
van Hauser efbc35eb50 verbose output for rdp to identify an issue 2019-11-05 09:59:36 +01:00
owein b34655617f !!! I did not test the escapes in the miscptr !!! 2019-10-21 20:37:25 +02:00
owein 6dfd77a37d fixed http-post 2019-10-21 20:11:38 +02:00
owein ab4aa36fd0 rolled back head_init for http-post-form, still an issue with the display 2019-10-20 23:26:44 +02:00
van Hauser a1f3f00f86 Merge pull request #459 from e2002e/v8.8-rain
V8.8 rain
2019-10-17 12:27:26 +02:00
van Hauser 217e025475 Update bfg.h 2019-10-17 12:21:47 +02:00
van Hauser 4c0e2c2b45 Merge branch 'master' into v8.8-rain 2019-10-17 12:19:55 +02:00
e2002e 9d7ebfd3c9 false is 0 and true 1 2019-10-15 20:22:46 +02:00
e2002e c414d9a3ab Update bfg.c 2019-10-07 23:00:27 +02:00
owein 4b41480549 option -r and help() 2019-10-07 17:06:32 +02:00
owein a4b4e54bd1 option -r 2019-10-07 17:04:44 +02:00
owein b09e39f98d modified bfg 2019-10-07 17:02:43 +02:00
owein ed9d8f1516 using hydra 8.8 files 2019-10-07 16:56:59 +02:00
owein 1658f4926f it look like github wants to drive me mad 2019-10-07 14:20:02 +02:00
David Maciejak b911269c1a Fix typo when only 1 password is found 2019-09-15 23:18:54 +08:00
van Hauser ebbea58cf6 http-form parameter fix 2019-09-13 17:35:05 +02:00
van Hauser 60f4969043 Merge pull request #447 from IPv4v6/fix-typo
Fix typo in PW-Inspector
2019-09-10 23:19:29 +02:00
Stefan Pietsch b77d49d407 Fix typo in PW-Inspector 2019-09-10 21:48:23 +02:00
David Maciejak 273334df88 Force VNC protocol version downgrade 2019-09-05 12:28:45 +08:00
David Maciejak a06ee48826 Add entry for svn module update 2019-09-03 13:34:57 +08:00
David Maciejak 866120e4e6 Fix compilation error if missing libsvn
oops forgot the case if the lib is not installed
2019-09-02 21:18:52 +08:00
David Maciejak e1e708d1a1 Fix compilation warning for long unsigned value printing 2019-09-02 21:05:50 +08:00
David Maciejak b3ddd4a2d2 Fix svn_client_list3 function call deprecation
Update the module to support subversion lib from v1.5 to 1.10 and fix following warning:
hydra-svn.c:124:3: warning: \u2018svn_client_list3\u2019 is deprecated [-Wdeprecated-declarations]
   err = svn_client_list3(canonical, &revision, &revision, svn_depth_unknown, dirents, FALSE, FALSE, (svn_client_list_func2_t) print_dirdummy, NULL, ctx, pool);
2019-09-02 10:41:45 +08:00
David Maciejak 9ae7ed075a Improve support for macOS
That's fixing the compilation issues as /lib does not exist on these systems, remove pie warnings,  and add support for libraries installed with macPorts
2019-09-01 10:15:06 +08:00
van Hauser 288d564daf Merge pull request #443 from loonydev/master
Fix dump with folder
2019-08-30 14:31:05 +02:00
Andrii Artiushok 2a62cb30bb Fix dump with folder 2019-08-30 15:10:32 +03:00
David Maciejak 32a7a40653 Add myself back to the project 2019-08-30 16:41:32 +08:00
David Maciejak 5d25fa1d1c Fix string matching call for system without libpcre
hydra_string_match() function is only available if libpcre is present. Compilation crashes without that patch.
2019-08-30 10:44:09 +08:00
van Hauser 150d325027 cleanup of submitted code 2019-07-29 12:04:57 +02:00
van Hauser 91ced0fa40 Merge pull request #432 from poucz/master
HTTP-GET add end condition. Simulary like in http-form
2019-07-29 11:55:43 +02:00
jopravil 98afb8e32d http-get better log 2019-07-29 09:38:37 +02:00
van Hauser eb8fc1686c fix 2019-07-25 19:00:41 +02:00
jopravil c639f21a72 HTTP-GET add end condition. Simulary like in http-form 2019-07-24 09:27:40 +02:00
van Hauser a93539e872 mysql module not using a default db now 2019-07-11 11:27:07 +02:00
van Hauser 39bc8e64db more scriptkiddie annoying 2019-07-03 11:43:47 +02:00
van Hauser 71df2b3518 fcknscriptkiddies 2019-07-02 22:09:30 +02:00
van Hauser 296e5e3204 print the necessary info on found passwords with issues 2019-07-02 22:04:58 +02:00
van Hauser 74b78c5322 fix for -K 2019-06-26 10:24:22 +02:00
van Hauser 4cda4ca189 added -K no redo switch 2019-06-25 12:52:07 +02:00
David Maciejak c2286ffb00 Remove extra comma from the json output
related to #412
2019-06-15 16:26:31 +08:00
David Maciejak 6a758105bb Fix typo in error msg creation
Prevent typo while generating such kind of logs:
"[ERROR] 0 targets did not complete"
"1 of 1 target completed, 0 valid passwords found"
2019-06-15 16:03:16 +08:00
David Maciejak 7009b6db03 Fix json output in case of connection error to the server 2019-06-14 13:44:16 +08:00
David Maciejak 4130079209 Remove README file
Duplicated from README.md which will be used as default readme file.
2019-06-11 17:24:18 +08:00
David Maciejak 1213174e9a Remove RDP related entry 2019-06-11 17:22:07 +08:00
David Maciejak 6e3f02b419 Add more check to detect missing header file for radmin support 2019-06-08 11:45:54 +08:00
David Maciejak f4b48c0513 Add radmin entry and describe dependencies 2019-06-08 11:38:14 +08:00
David Maciejak 6d70d30c51 Fixed a typo in readme 2019-06-08 11:24:41 +08:00
David Maciejak 5ea9c47bb5 Fix initialization of pool struct variable 2019-06-04 13:56:48 +08:00
David Maciejak 85d51ba494 Fix memory leak
buf variable is not freed properly from the hydra_receive_line call
2019-06-04 13:53:08 +08:00
David Maciejak 2f1c1438ea Cosmetic change
Missed that one in the previous commit.
2019-06-02 11:44:47 +08:00
David Maciejak f2d2cd338e Add length check for fixed-size string 2019-06-02 11:32:21 +08:00
David Maciejak b589d658bd Merge branch 'master' of https://github.com/vanhauser-thc/thc-hydra 2019-06-02 11:23:00 +08:00
David Maciejak 87a6e9385e Cosmetic change to please code scanner 2019-06-02 11:21:54 +08:00
David Maciejak f1e0df4080 Add length check for fixed-size string 2019-06-02 11:18:27 +08:00
David Maciejak 99205f0410 Add length check for fixed-size string
To prevent possible overflow.
2019-06-02 11:11:30 +08:00
David Maciejak d01f473d2e Fixing distinct used types 2019-06-01 09:27:23 +08:00
David Maciejak 392bb0e3b3 Fixing open() off by one error
As reported by coverity:
off_by_one: Testing whether handle fd is strictly greater than zero is suspicious. fd leaks when it is zero
2019-05-31 18:38:10 +08:00
David Maciejak 5df0ab39c0 Fixing memory leak
lresp variable is not freed properly, also taking the chance to switch the printf calls to hydra_report function
2019-05-31 17:14:45 +08:00
David Maciejak f6001f39e2 Initialize properly sockaddr_in structs 2019-05-30 23:43:45 +08:00
van Hauser d24d7a8665 hydra -m help 2019-05-29 08:54:16 +02:00
van Hauser 0f70ca75d1 Merge pull request #422 from raynull/patch-1
Update hydra-redis.c
2019-05-28 12:16:24 +02:00
raynull bd70ea79c2 Update hydra-redis.c 2019-05-28 12:52:27 +03:00
van Hauser b9c5e7e125 better compile options 2019-05-23 14:04:14 +02:00
David Maciejak 30e5d53fce Delete rdp header file
We don't need that header file anymore as we are relying on freerdp now.
2019-05-23 13:31:37 +08:00
van Hauser 1ad8197fb0 Merge pull request #419 from hlein/apr-limit-fix
Worked around APR_PATH_MAX errors on some Linuxes when SVN is enabled.
2019-05-19 01:06:18 +02:00
Hank Leininger db9025bf86 Worked around APR_PATH_MAX errors on some Linuxes when SVN is enabled.
On Gentoo Linux (and possibly others?) with Subversion 1.12.0,
compilation of hydra-svn.c fails with:

In file included from /usr/include/subversion-1/svn_client.h:34,
                 from hydra-svn.c:9:
/usr/include/apr-1/apr.h:632:2: error: #error no decision has been made on APR_PATH_MAX for your platform
 #error no decision has been made on APR_PATH_MAX for your platform
  ^~~~~

This happens when PATH_MAX is not defined.

PATH_MAX is defined by /usr/include/linux/limits.h, but rather than
include'ing that directly and possibly breaking other platforms,
include sys/param.h (which will include linux/limits.h indirectly)
iff PATH_MAX is not defined and sys/param.h exists.

I based the approach on how math.h is handled.
2019-05-18 15:56:08 -06:00
van Hauser c4667685f7 v9.1-dev init 2019-05-17 09:05:44 +02:00
van Hauser ce3ae57645 remove outdated directory 2019-05-17 09:04:33 +02:00
van Hauser ab467e0a3b v9.0 release 2019-05-17 08:50:01 +02:00
van Hauser 8bc67dc332 Merge pull request #418 from rmaksimov/auth-type-switching-option
fix typo and the offset value of miscptr
2019-05-16 11:46:54 +02:00
Roman Maksimov c3c23bbd94 fix typo and the offset value of miscptr 2019-05-16 12:19:40 +03:00
van Hauser 0a0dd605ff http module a= option 2019-05-16 06:06:52 +02:00
van Hauser c57d78c42f Merge pull request #417 from rmaksimov/misc-fixes
Header value parsing fix and some misc changes
2019-05-15 23:12:55 +02:00
Roman Maksimov 6a57bd6877 add newline characters, fix option description in hydra-http-form.c 2019-05-15 22:58:49 +03:00
Roman Maksimov f6723f61b1 fix parsing of header value in http(s) modules 2019-05-15 22:50:14 +03:00
van Hauser 451e3d3edd Merge pull request #414 from rmaksimov/ntlm-auth-fix
fix NTLM authentication
2019-05-13 08:12:10 +02:00
van Hauser a5b2f92284 Merge pull request #416 from rmaksimov/misc-fixes
Misc fixes
2019-05-12 19:50:43 +02:00
Roman Maksimov f7f3aa1686 change the order of the comparison operands 2019-05-11 15:19:52 +03:00
Roman Maksimov 59241d6b8f change the order of the parameters as in the socket manual 2019-05-11 15:14:57 +03:00
Roman Maksimov 3424786530 fix NTLM authentication 2019-05-11 14:11:25 +03:00
David Maciejak 2bcd722941 Free the memory allocated by setupterm() 2019-04-29 09:55:57 +08:00
David Maciejak 2c7df66d42 Use specific RDP port if requested 2019-04-29 09:54:30 +08:00
van Hauser 5ca9285838 Merge pull request #410 from imhashir/master
Fixed a typo in readme
2019-04-28 12:03:57 +02:00
Hashir Baig 96641d2631 Fixed a typo in readme 2019-04-28 14:48:55 +05:00
van Hauser a5ade64bdb Merge pull request #409 from Galaxy-cst/master
Rebuild JSON report file in first time and append while using -R
2019-04-27 11:17:45 +02:00
Galaxy-cst 486f33cd5f Fix logical issue. It cause adding wrong output file head when restore session using JSON format 2019-04-27 10:11:02 +08:00
Galaxy-cst 5120f03645 Rebuild JSON report file in first time and append while using -R 2019-04-27 00:37:27 +08:00
van Hauser e82e395dad Changelog update and compiler warning fix 2019-04-26 14:28:40 +02:00
David Maciejak 0fa7a484b3 Add ref to rdp module change 2019-04-25 22:16:32 +08:00
David Maciejak c06685c308 Clean the code and handle more freerdp error code 2019-04-25 15:02:04 +08:00
van Hauser 64168bd98a Merge pull request #405 from loianhtuan/master
replace rdesktop with freerdp for rdp module
2019-04-23 16:52:49 +02:00
Tuan f93b799384 replace rdesktop with freerdp for rdp module 2019-04-23 18:32:22 +07:00
van Hauser 12f22f253b Merge pull request #402 from IPv4v6/fix-typo
Fix typo in man page
2019-04-11 21:57:25 +02:00
Stefan Pietsch caa3f0ac8f Fix typo in man page 2019-04-11 21:36:38 +02:00
van Hauser 7c81e5dd5d Merge pull request #394 from mlsendian/master
Fix compilation error when Mongo and Memcache libraries are absent
2019-03-22 21:55:56 +01:00
Marco Slaviero 14d74ff619 Fix compilation error when Mongo and Memcache libraries are absent 2019-03-22 11:09:05 +02:00
David Maciejak 0d4bcb548f Fix conditional compilation when the proper libs are not present 2019-03-20 11:35:35 +08:00
David Maciejak e57f97417d Merge branch 'master' of https://github.com/vanhauser-thc/thc-hydra 2019-03-20 10:45:59 +08:00
David Maciejak 012fbe6d1b Add module for mongodb 2019-03-20 10:45:42 +08:00
David Maciejak 6575bf964d Fix unauthenticated memcached server detection 2019-03-20 10:35:51 +08:00
van Hauser 95819bf458 return 255 fix 2019-03-17 09:39:03 -04:00
van Hauser af808bc4d9 http md5-digest fix 2019-03-16 18:20:08 -04:00
David Maciejak 1ad374b6a1 Fix hydra child exit 2019-03-15 22:39:37 +08:00
David Maciejak 09b2af9c8c update README for new memcached module 2019-03-09 08:38:32 +08:00
David Maciejak 8e209b14f4 add memcached module 2019-03-09 08:30:16 +08:00
David Maciejak 4a87be9c48 Fix rtsp module potential buffer overflow 2019-03-07 08:20:15 +08:00
David Maciejak 91825f0fef Fix svn module memory leaks 2019-03-07 08:12:04 +08:00
David Maciejak 59ef84522b Clean unsupported ftps helper message
Just for the code and message to look like unsupported pop3s, imaps, ...
2019-03-05 19:23:43 +08:00
David Maciejak 4d9740836f Remove the extra CR
To have the perror log details on the same error line
2019-03-05 19:00:07 +08:00
David Maciejak 26e69be9a9 Missing error log carriage return 2019-03-05 18:49:37 +08:00
David Maciejak edc01ed049 Fix compilation warning
See below full log:

hydra-http-proxy.c: In function ‘start_http_proxy’:
hydra-http-proxy.c:26:26: warning: ‘%.200s’ directive writing up to 200 bytes into a region of size 24 [-Wformat-overflow=]
     sprintf(host, "Host: %.200s", ptr + 3);
                          ^~~~~~
In file included from /usr/include/stdio.h:862:0,
                 from hydra.h:3,
                 from hydra-mod.h:4,
                 from hydra-http-proxy.c:1:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:33:10: note: ‘__builtin___sprintf_chk’ output between 7 and 207 bytes into a destination of size 30
   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       __bos (__s), __fmt, __va_arg_pack ());
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2019-03-05 12:45:41 +08:00
David Maciejak e759b3768c Fix compilation warning
hydra-redis.c: In function ‘start_redis’:
hydra-redis.c:18:51: warning: ‘%.250s’ directive writing up to 250 bytes into a region of size between 243 and 493 [-Wformat-overflow=]
   sprintf(buffer, "*2\r\n$4\r\nAUTH\r\n$%.250s\r\n%.250s\r\n", pass_num, pass);
                                                   ^~~~~~
In file included from /usr/include/stdio.h:862:0,
                 from hydra.h:3,
                 from hydra-mod.h:4,
                 from hydra-redis.c:1:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:33:10: note: ‘__builtin___sprintf_chk’ output between 20 and 520 bytes into a destination of size 510
   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       __bos (__s), __fmt, __va_arg_pack ());
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2019-03-03 23:24:09 +08:00
David Maciejak 87e410e5a1 Fix compilation warning
Fix the compilation warning below:

hydra-smtp-enum.c: In function ‘service_smtp_enum’:
hydra-mod.h:72:22: warning: statement will never be executed [-Wswitch-unreachable]
 #define hydra_report fprintf
hydra-smtp-enum.c:220:11: note: in expansion of macro ‘hydra_report’
           hydra_report(stdout, "[VERBOSE] ");
           ^~~~~~~~~~~~
2019-03-03 23:08:47 +08:00
David Maciejak bdf0475b48 Update dependencies for Ubuntu/Debian
remove libncp, rename firebird dev libs
2019-03-03 22:54:36 +08:00
David Maciejak d5fb1142b2 Missing carriage return when printing error 2019-03-03 22:50:22 +08:00
van Hauser ce2fd05edf new 8.9-dev init 2019-02-26 08:43:25 -05:00
van Hauser 3a9a3c1eba v8.9.1 release 2019-02-26 08:41:10 -05:00
van Hauser d863927a53 clarification 2019-02-26 08:38:29 -05:00
van Hauser cb30c8442b clarification 2019-02-26 08:38:17 -05:00
van Hauser 5c1a4bbf99 Merge pull request #388 from Mattlk13/imgbot
[ImgBot] Optimize images
2019-02-24 07:55:44 -05:00
ImgBotApp f0f546af8a [ImgBot] Optimize images
*Total -- 614.33kb -> 589.40kb (4.06%)

/web/webfiles/img/hydra_pass.jpg -- 34.39kb -> 29.21kb (15.08%)
/web/webfiles/img/hydra_target.jpg -- 28.19kb -> 23.97kb (14.95%)
/web/webfiles/img/hydra_start.jpg -- 49.21kb -> 43.31kb (11.99%)
/xhydra.jpg -- 75.15kb -> 66.52kb (11.48%)
/web/webfiles/img/Cross.png -- 0.98kb -> 0.93kb (4.89%)
/web/xhydra.png -- 213.21kb -> 212.73kb (0.22%)
/web/webfiles/img/xhydra.png -- 213.21kb -> 212.73kb (0.22%)
2019-02-17 02:48:12 +00:00
van Hauser ffb7b5bc8a CIDR notation now correctly identifed 2019-01-09 11:10:49 +01:00
van Hauser 3ac0595f25 Merge pull request #382 from epsilon77/master
Fix spelling error
2019-01-08 09:07:09 +01:00
Daniel Echeverry 238d9d8bb5 Fix spelling error 2019-01-07 18:45:29 -05:00
van Hauser 7565756c33 v8.9-dev init 2019-01-02 13:41:34 +01:00
van Hauser 3f56e5185a v8.8 release 2019-01-02 13:38:23 +01:00
van Hauser aee8fdee3f PROBLEMS file added 2018-12-24 17:27:11 +01:00
van Hauser 6f2d9d6744 add PROBLEMS file 2018-12-24 13:37:39 +01:00
van Hauser bf8444ae39 rdp disabled 2018-12-24 13:18:17 +01:00
van Hauser 6509f2d172 rdp disabled 2018-12-24 13:17:21 +01:00
van Hauser d76bfe440b add ldap alias 2018-12-24 13:12:12 +01:00
van Hauser fc9350cfdf ldap fix 2018-12-11 19:01:48 +01:00
van Hauser b32f0c0633 enabled child crash reporting 2018-11-15 08:27:07 +01:00
van Hauser c56d87d4da added MacOS compile hints 2018-11-15 08:25:38 +01:00
van Hauser c8a87c54e1 Merge pull request #374 from plonibarploni/patch-1
remove obsolete dependency
2018-11-11 21:21:05 +01:00
plonibarploni 9ad5738bdb remove obsolete dependency 2018-11-11 14:48:27 -05:00
plonibarploni 1f599bb710 remove obsolete dependencies
this closes #373.
2018-11-11 14:45:27 -05:00
van Hauser f6bd9d6410 fixed some typos 2018-10-28 07:46:59 +01:00
van Hauser 3585e505d2 Merge pull request #367 from deargle/fix-ssh-threadsafe
make thread-safe against old ssl versions
2018-10-26 15:05:34 +02:00
Dave Eargle a2de33fd2b make thread-safe against old ssl versions 2018-10-26 02:09:00 -06:00
van Hauser ff4deb768e fix no target crash 2018-10-11 19:30:55 +02:00
van Hauser 2043a941eb force stdint.h 2018-10-06 18:33:13 +02:00
van Hauser 9ea71a55eb debugging ssh 2018-10-03 17:39:12 +02:00
van Hauser edfaeed0a3 Merge pull request #348 from mathewmarcus/fix_issue_347
set cookie for http-form-post redirects
2018-09-20 07:28:35 +02:00
van Hauser a1de59e465 added web page 2018-08-18 15:38:46 +02:00
van Hauser 0796c5f954 update web link 2018-08-18 14:41:32 +02:00
van Hauser 54bec96fb4 Merge pull request #350 from OrBin/master
Fixed a tiny typo in the help text
2018-08-11 10:55:38 +02:00
Or Bin 4f167371d2 Fixed a tiny typo in the help text 2018-08-10 23:11:58 +03:00
van Hauser 0626888331 http-form fix to always identify 403/404 as failed 2018-08-09 11:13:25 +02:00
mathewmarcus f6383ae4c7 set cookie for http-form-post redirects 2018-07-27 14:31:22 -05:00
van Hauser 7f4d8fc6e9 update changelog 2018-07-16 17:45:21 +02:00
van Hauser 5d94930978 Merge pull request #342 from mathewmarcus/add_feature_321
Optionally add request headers to http-get
2018-07-16 17:39:15 +02:00
mathewmarcus 25383d76d9 modified parse_options function 2018-07-16 07:46:45 -05:00
mathewmarcus 9afbddfa95 optionally include headers in non-form based http requests 2018-07-16 07:16:58 -05:00
mathewmarcus 4b1a945c45 moved relevant header macros and functions into http header file 2018-07-16 07:04:59 -05:00
mathewmarcus a6db85b963 parse optional header string e.g. (h|H=My-Hdr\: foo) for non-form based http requests 2018-07-14 16:14:40 -05:00
mathewmarcus 689b20f60a ported relevant shared http declarations into header file 2018-07-14 15:57:21 -05:00
mathewmarcus d89483ed05 pulled option parsing functionality into separate function 2018-07-14 11:10:34 -05:00
van Hauser eb064c4222 support uncommon mysql ports 2018-06-14 02:44:31 +02:00
van Hauser 650a8185c6 Merge pull request #332 from DarrenRainey/patch-1
General Cleanup
2018-06-06 13:40:32 +02:00
Darren Rainey 1572e8c458 General Cleanup 2018-06-05 20:59:43 +01:00
van Hauser d06208966b allow newer libssh versions - once they exist 2018-04-17 02:04:26 +02:00
van Hauser 1845c4476b proxy connect debug 2018-02-19 19:07:48 +01:00
van Hauser b54a3b2495 -w support for ssh module 2018-01-31 14:07:54 +01:00
van Hauser dcd04ac6d9 -w support for ssh module 2018-01-31 14:07:03 +01:00
van Hauser 9597bafb17 crash fix 2018-01-04 11:14:11 +01:00
van Hauser 71d407d641 fix 2018-01-04 10:53:24 +01:00
van Hauser cc209e5227 2018 year update 2018-01-04 10:52:09 +01:00
van Hauser 3e53a91a8c Merge pull request #294 from mostafahussein/extraslash
Don't add extra slash to url if exist
2017-12-22 09:12:51 +01:00
Mostafa Hussein 0c1a50db31 Don't add extra slash to url if exist 2017-12-22 01:03:23 +02:00
van Hauser a58f785065 fixed http-form memory leaks 2017-11-27 17:44:51 +01:00
van Hauser 445e5026ef hydra return code fix 2017-11-06 07:23:50 +01:00
van Hauser 89f998592f Merge pull request #278 from edhinard/master
base64 encoding of credentials support
2017-10-25 11:00:17 +02:00
Edouard Hinard e72b408e54 possible base64 encoding of credentials 2017-10-25 08:23:00 +02:00
van Hauser c74a0cd963 Merge pull request #270 from aayla-secura/master
Fixes issue #267
2017-10-06 08:23:30 +02:00
Aleksandrina Nikolova 2650665161 Fixes issue #267 (http-get-form does not use
absolute URL when proxy is set)
2017-10-06 07:17:35 +10:00
van Hauser 3633991bd1 Merge pull request #269 from ebfe/musl
fix build with musl libc
2017-10-05 14:38:00 +02:00
Michael Gehring d4429b67ac fix build with musl libc 2017-10-05 12:15:30 +00:00
van Hauser 0a50b41be9 corrected int type for main 2017-10-05 13:31:36 +02:00
van Hauser 93d5da33a7 fix for weird sshd response 2017-10-01 22:23:09 +02:00
van Hauser 67354f92ce Merge pull request #257 from DomT4/math_fix_macos
configure: find math.h on Xcode-only macOS systems
2017-09-01 14:22:02 +02:00
Dominyk Tiller 28e3e0b469 configure: find math.h on Xcode-only macOS systems
Should fix https://github.com/vanhauser-thc/thc-hydra/issues/255.
2017-09-01 12:53:23 +01:00
van Hauser ba4a23d2d4 segfault fix 2017-09-01 09:29:03 +02:00
van Hauser 9772a91fb0 include fix 2017-08-19 17:48:10 +02:00
van Hauser 4ead67252f Merge pull request #254 from crondaemon/osx
compile better on OSX
2017-08-19 17:45:51 +02:00
Dario Lombardo 502eb5286a travis-ci: install libgcrypt on osx. 2017-08-19 15:27:53 +02:00
Dario Lombardo 35ece53d3b Move int includes to hydra-mod and add includes.
This makes the code compile on OSX.
2017-08-19 14:56:50 +02:00
van Hauser 24f1a929c1 Merge pull request #253 from crondaemon/ccc-analyzer
ccc-analyzer code audit fixes
2017-08-19 06:20:39 +02:00
Dario Lombardo 0ed3bef2db hydra.c: make proper allocation and casts when using malloc. 2017-08-18 21:58:48 +02:00
Dario Lombardo 8c42e0007b radmin2: cast calloc output (found by ccc-analyzer). 2017-08-18 21:58:17 +02:00
Dario Lombardo 82be691b9d vmauthd: don't use freed mem (found by ccc-analyzer). 2017-08-18 21:37:29 +02:00
Dario Lombardo bb734b2c90 cisco: use strstr only on non-null var (found by ccc-analyzer). 2017-08-18 21:34:57 +02:00
Dario Lombardo 995c6d2385 vnc: fix use after-free (found by ccc-analyzer). 2017-08-18 21:29:26 +02:00
Dario Lombardo 2d67764bbf mod: fix warning (found by ccc-analyzer). 2017-08-18 21:26:29 +02:00
van Hauser ad8f77bbf1 Merge pull request #252 from crondaemon/travis
Add travis-ci file.
2017-08-18 16:24:13 +02:00
Dario Lombardo b05d52f43d Add travis-ci file. 2017-08-18 16:07:50 +02:00
van Hauser e669df08a8 readme updates 2017-08-18 12:00:19 +02:00
van Hauser 9cfe981bdc README for github 2017-08-18 11:40:22 +02:00
van Hauser 892b79d464 readme 2017-08-18 11:39:36 +02:00
van Hauser 8a936fe63a Merge pull request #251 from crondaemon/markdown
Change README to README.md syntax, thanks to crondaemon
2017-08-18 11:37:31 +02:00
van Hauser 2a9e13201a warning fixes by crondaemon 2017-08-18 11:31:06 +02:00
van Hauser fdf9b5f588 warning fixes by crondaemon 2017-08-18 11:30:42 +02:00
Dario Lombardo a6d35e11bc Change REAME to README.md. 2017-08-17 23:13:39 +02:00
van Hauser b9465a4c8c spelling 2017-08-08 16:08:05 +02:00
van Hauser 49b81db7a8 Merge pull request #244 from lukas227/master
add radmin2 to xhydra selection and man page
2017-08-01 22:37:44 +02:00
Lukas Schwaighofer 120e6d5ccb minor man page improvements
* mention radmin2 as a module in the hydra man page
* remove the listed modules from the xhydra man page, refer to the
  hydra man page instead
* improve markup
2017-08-01 22:21:07 +02:00
Lukas Schwaighofer b8c70cd502 add radmin2 as a selectable option to xhydra 2017-08-01 20:33:19 +02:00
van Hauser ea3fd5285c more spelling fixes 2017-07-26 22:29:18 +02:00
van Hauser b1d9236312 Merge pull request #242 from lukas227/master
fix various spelling and typography errors
2017-07-26 10:11:40 +02:00
Lukas Schwaighofer 0e6ef089db fix various spelling and typography errors
taken from Debian; the changes were authored by:
* Julián Moreno Patiño <julian@debian.org>
* Daniel Echeverry <epsilon77@gmail.com>
2017-07-26 01:22:11 +02:00
van Hauser 21ae638382 8.7-dev init 2017-07-21 13:37:30 +02:00
van Hauser 93181d8135 makefile fix 2017-07-21 13:35:56 +02:00
van Hauser cd0757e81b x64 warning fixes 2017-07-21 13:35:40 +02:00
van Hauser bd8ec4712f v8.6 release 2017-07-21 13:26:22 +02:00
van Hauser 0a4f0987d1 beauty output 2017-07-08 15:11:13 +02:00
van Hauser 9ba5939ad5 makefile cleanup 2017-07-08 14:48:24 +02:00
van Hauser 07acbda422 radmin2 enhancements 2017-07-08 14:42:23 +02:00
van Hauser 04818f2b07 Merge pull request #239 from catatonicprime/gcrypt
Support Radmin2 (aka W32/GhostRadmin)
2017-07-08 14:33:43 +02:00
catatonic 2386d4517f Improving data specificity more. 2017-07-08 01:14:41 +00:00
Catatonic 444a912b37 Removing unused variable 2017-07-07 15:39:49 -07:00
catatonic cf089a6c75 Merge branch 'master' into HEAD
Conflicts:
	Makefile.am
	hydra.c
	hydra.h

Additional changes to better fit the newer design patterns.
2017-07-07 20:52:58 +00:00
catatonic 1503c8a381 Checking for gcrypt support & disabling radmin2 when it is unavailable. 2017-07-07 19:34:52 +00:00
van Hauser cea00533ea smb req signing check 2017-07-07 18:26:17 +02:00
van Hauser 15e534fbbf smbv1 check 2017-07-07 18:05:59 +02:00
van Hauser 1a72fe023e cleanup 2017-07-07 11:21:46 +02:00
van Hauser 185021d474 compile fix for debug 2017-07-06 23:09:44 +02:00
van Hauser 789214cc7e warn on BINDTODEVICE not supported in some modules 2017-07-06 23:02:05 +02:00
van Hauser 5a19c1787e small info changes 2017-07-06 22:58:31 +02:00
van Hauser 859b7aa443 ipv6 pretty print 2017-07-06 22:35:45 +02:00
van Hauser 4ab31cd18e ipv6 pretty print 2017-07-06 22:34:55 +02:00
van Hauser 4c6cbf03a7 stdint fixes 2017-07-06 22:26:08 +02:00
van Hauser 11176a1080 stdint fixes 2017-07-06 22:25:09 +02:00
van Hauser 7613700a5a fix 2017-07-06 21:39:01 +02:00
van Hauser e141c59d2a fix 2017-07-06 21:37:59 +02:00
van Hauser bbb54239b7 fix 2017-07-06 21:34:42 +02:00
van Hauser f4eb8d0132 show device on IPv6 LL addresses 2017-07-06 21:32:46 +02:00
van Hauser 6445689545 show device on IPv6 LL addresses 2017-07-06 21:29:59 +02:00
van Hauser 044bab0c2c makefile fix 2017-07-05 08:48:20 +02:00
van Hauser f124c26fc6 big int to stdint switch 2017-07-05 08:48:00 +02:00
van Hauser 74931e3b58 ensure null terminated entries in restore file 2017-06-27 11:36:35 +02:00
van Hauser abb83694aa -c enforces -t 1 now 2017-06-27 11:14:56 +02:00
van Hauser b43514dc45 -c enforces -t 1 now 2017-06-27 11:12:47 +02:00
van Hauser eff86754f2 fix 2017-06-26 16:35:38 +02:00
van Hauser 43c9ab09e5 print test username 2017-06-26 13:37:55 +02:00
van Hauser 13942efbbd ? 2017-06-26 09:50:47 +02:00
van Hauser b4acb367f5 better head/target state documentation 2017-06-25 16:52:56 +02:00
van Hauser bea6cbe821 write restore file if final threads did not complete 2017-06-25 16:27:12 +02:00
van Hauser 6a1b58c74b Merge pull request #235 from mindon/master
Reset redirect flag and fix redirect port error issue
2017-06-24 15:54:43 +02:00
mindon 6a6c58c925 Reset redirect flag and fix redirect port error issue
fix following 2 issues:

1. when fail is a redirect url, matched is not - but the redirect flag is still 1 - causing match missed

2. when redirect to a relative url on a port not 80, it fails to attach the port to the redirect url
2017-06-24 08:26:39 -05:00
van Hauser be47c0e475 makefile clean 2017-06-24 15:18:55 +02:00
van Hauser 115a4d007a forget to move -c option value to restore file data 2017-06-24 15:18:40 +02:00
van Hauser 51d881353b moved help to modules 2017-06-23 19:15:18 +02:00
van Hauser 88aae59227 changed -R behaviour 2017-06-23 18:23:59 +02:00
van Hauser d917d1aeba option -c test 2017-06-23 10:40:50 +02:00
van Hauser 5bcc39c6a4 Merge pull request #232 from Diadlo/usage_service
Usage service
2017-06-22 01:02:27 +02:00
Diadlo bd8a901bea Move services and usage on the top of the hydra.c 2017-06-22 01:08:13 +03:00
Diadlo a8f8bdbc5f Add usage functions into service vector 2017-06-22 01:08:13 +03:00
Diadlo 7e09c0b43e Extrace each module usage in separate function 2017-06-22 00:39:54 +03:00
Diadlo 9265272a3e Use early return instead of 'find' flag
It's increase performance
2017-06-21 23:17:34 +03:00
Diadlo 21c4b99e1b Use early break instead of large if 2017-06-21 23:14:25 +03:00
van Hauser 13962a20a8 fix for SSL error:00000000:lib(0):func(0):reason(0) bug 2017-06-15 11:45:46 +02:00
van Hauser b98789d32e Merge pull request #230 from Diadlo/maxfail
Maxfail
2017-06-12 11:51:11 +02:00
Diadlo e8e17d092d Remove using 'ok' from 'if' where 'ok' is always true 2017-06-12 12:26:28 +03:00
Diadlo a47bd13c30 Add maxfail default value
Maxfail for '!ok' is always 0
2017-06-12 12:26:18 +03:00
Diadlo 1043a120d7 Replace one compare sign to make summands more generic 2017-06-12 12:21:08 +03:00
Diadlo 39cf5133a6 Extract maxfail in to a variable
Reduce code duplication, make code easier to read
2017-06-12 12:20:27 +03:00
van Hauser b391d725cd Merge pull request #228 from Diadlo/useless_check
Useless check
2017-06-11 18:39:21 +02:00
Diadlo 78c88159fa Remove reduant 'if' after 'else'
if (A) {
} else if (!A) {
}
2017-06-11 18:29:33 +03:00
Diadlo 18ae87b396 Remove useless null check
'while' has 2 pbuffer[0] checks:
- pbuffer[0] not equal to 0
- pbuffer[0] more then 31 (first printable char)

if pbuffer[0] more than 31 it's always not equal to 0 => first check is
useless
2017-06-11 18:29:33 +03:00
Diadlo a01712370b Remove useless sock check in init functions
'sock' inited with -1 a few lines above, so condition is alwais false
2017-06-11 18:28:18 +03:00
van Hauser cdfce6b977 Merge pull request #229 from Diadlo/null_deref
Null deref
2017-06-11 14:24:08 +02:00
Diadlo 300fe2f19d Prevert using NULL login 2017-06-10 23:56:52 +03:00
Diadlo 48709842a6 Replace possible null pointer no '(null)' string 2017-06-10 23:56:18 +03:00
Diadlo e95e036bbf Remove null pointer dereference 2017-06-10 23:54:59 +03:00
Diadlo 66562bd73c Move null pointer check before pointer using 2017-06-10 23:54:32 +03:00
van Hauser 63ebf3ec25 Merge pull request #219 from Diadlo/refactor
Refactor
2017-06-06 15:36:17 +02:00
van Hauser 46af724c0f Merge branch 'master' into refactor 2017-06-06 15:35:47 +02:00
van Hauser 5033c262df changelog update 2017-06-06 15:23:43 +02:00
van Hauser f7b122f6ed cleanup 2017-06-06 15:22:37 +02:00
van Hauser ac71f5e16f Merge pull request #223 from Diadlo/enums
[SMALL] Enums
2017-06-06 15:20:26 +02:00
van Hauser cc72938180 Merge branch 'master' into enums 2017-06-06 15:20:01 +02:00
van Hauser 3a7ad3c10f Merge pull request #221 from Diadlo/swap
[SMALL] Add swap function
2017-06-06 15:16:54 +02:00
van Hauser 354016eb68 Merge pull request #224 from Diadlo/print_help
Add using macros to align help text
2017-06-06 15:13:23 +02:00
Diadlo 0519661f95 Add using macros to align help text 2017-06-02 10:58:10 +03:00
Diadlo 985f9c43b0 Add output_format_t enum 2017-06-02 10:22:29 +03:00
Diadlo cdb9123e28 Add hydra_mode_t enum 2017-06-02 10:22:25 +03:00
Diadlo 07d55e94af Add target_state_t enum 2017-06-02 10:21:47 +03:00
Diadlo 0d6efda1d2 Add swap function 2017-06-01 23:56:06 +03:00
Diadlo 6edd64e6b6 Refactor spawn_head 2017-06-01 09:08:57 +03:00
Diadlo 8b6607aec0 Add using SERVICE macro 2017-06-01 09:05:06 +03:00
Diadlo 5dc883fb4b Refactor service_init 2017-06-01 09:04:37 +03:00
Diadlo dfef658cf8 Create services vector 2017-06-01 09:04:36 +03:00
van Hauser 3ed91cd18f fix 2017-05-20 15:44:42 +02:00
van Hauser d4ace452c7 Merge pull request #217 from petrock6/master
Bugfix for issue 192 -- increased URL/POST/cookie data size to 6096 b…
2017-05-20 15:38:40 +02:00
petrock6 df5ec9ea30 Bugfix for issue 121 -- increased URL/POST/cookie data size to 6096 bytes from 1000 bytes. 2017-05-20 02:58:47 -05:00
van Hauser 4575af1476 forgot to update web pages 2017-05-03 14:20:55 +02:00
van Hauser 0e0a7878dc forgot to update web pages 2017-05-03 14:15:09 +02:00
van Hauser 639dce3be1 v8.6-dev init 2017-05-03 14:10:17 +02:00
van Hauser 59819655d1 hydra v8.5 release 2017-05-03 14:07:08 +02:00
van Hauser d754411a96 Merge pull request #209 from lukas227/fix-pointer-size
do not assume sizeof(int) is the pointer size
2017-04-24 21:31:40 +02:00
Lukas Schwaighofer 1c3ebae990 do not assume sizeof(int) is the pointer size
sizeof(int) is not necessarily the same as the pointer size. On my amd64
system sizeof(int) is 4 bytes while the pointer size is 8 bytes. The
change solves https://github.com/vanhauser-thc/thc-hydra/issues/27 for
me.
2017-04-24 18:21:25 +02:00
van Hauser d5827c4182 fixes 2017-04-18 09:42:09 +02:00
van Hauser 7a4fa7b51e Merge pull request #208 from Diadlo/refactor
Refactor
2017-04-18 09:33:15 +02:00
Diadlo 1bf376baa3 Refactor hydra_debug function 2017-04-17 23:15:47 +03:00
Diadlo c760e7e5c5 Fix size of pointer instead of size of data 2017-04-17 22:41:12 +03:00
Diadlo 34131739fe Remove comparing unsigned value with zero 2017-04-17 22:34:07 +03:00
van Hauser 2e1b0c2487 Merge pull request #198 from veggiespam/master
Updates to JSON code
2017-03-03 09:38:49 +01:00
veggie spam 075fac2a5f Merge branch 'master' of https://github.com/veggiespam/thc-hydra 2017-03-02 20:57:06 -05:00
veggie spam 795e9c7baa Buffer overrun in hydra_report_debug. 2017-03-02 20:56:29 -05:00
veggiespam cb40928c00 spacing 2017-03-02 14:48:06 -05:00
veggie spam 517744ca3c one bug, lots of minor updates 2017-03-02 14:44:38 -05:00
veggie spam 35f69ce3a2 Merge https://github.com/vanhauser-thc/thc-hydra 2017-03-02 10:46:34 -05:00
veggie spam 971474c9d8 Merge branch 'master' of https://github.com/veggiespam/thc-hydra 2017-03-02 10:23:49 -05:00
van Hauser ace9e35658 man page beautification 2017-03-02 10:58:40 +01:00
van Hauser 09f5395b7a update command line 2017-03-02 10:32:25 +01:00
van Hauser a81aa6db64 Merge pull request #196 from veggiespam/master
New feature: output results in JSON format.
2017-03-02 10:13:54 +01:00
veggie spam 88f16b73d6 New feature: output results in JSON format. 2017-03-01 15:09:35 -05:00
van Hauser f09710512f Merge pull request #188 from LocutusOfBorg/patch-2
Fix typos on manpage (From Daniel Echeverry)
2017-02-13 14:47:36 +01:00
van Hauser 8f1de64723 Merge pull request #187 from LocutusOfBorg/patch-3
Fix typo on xhydra manpage (From Daniel Echeverry)
2017-02-13 14:47:28 +01:00
van Hauser 737a82c9e0 Merge pull request #186 from LocutusOfBorg/patch-1
Fix manpage adding a missing newline
2017-02-13 14:47:10 +01:00
Gianfranco Costamagna f32fe17851 Fix typo on xhydra manpage (From Daniel Echeverry) 2017-02-13 11:32:19 +01:00
Gianfranco Costamagna b14d5f3225 Fix typos on manpage (From Daniel Echeverry) 2017-02-13 11:31:27 +01:00
Gianfranco Costamagna ae2f6b8b76 Fix manpage adding a missing newline
A missing newline lead to https://bugs.debian.org/853807
2017-02-13 11:16:30 +01:00
van Hauser 9c3feee9b6 configure CC support, strrchr over rindex 2017-01-31 11:03:00 +01:00
van Hauser 5ae15317c6 8.4 docu update 2017-01-27 17:19:18 +01:00
van Hauser 3b97da1021 v8.4 2017-01-27 17:11:59 +01:00
van Hauser dc4c20e34e gtk updates 2017-01-27 17:10:22 +01:00
van Hauser 7f1a9e3496 ssh initial password check now uses the supplied user 2017-01-24 09:51:03 +01:00
van Hauser 60c5aff0ea set year to 2017 2017-01-19 09:50:31 +01:00
van Hauser f340852655 fixed -U crash 2017-01-18 10:31:37 +01:00
van Hauser f2a328d35a Merge pull request #175 from CaledoniaProject/master
SunOS compile support
2016-12-29 11:00:56 +01:00
Aaron Lewis 34f5d55b84 SunOS compile support: add -lrt to support nanosleep(); add definition of strndup() 2016-12-29 17:03:46 +08:00
Catatonic Prime c5d98dc352 Removing diagnostics 2016-12-27 22:06:41 +00:00
catatonic 5d88976bc6 Fixing issue were we are not correctly grabbing the next password "pair" 2016-12-27 15:01:15 -07:00
catatonic 249c8f973b Removing diagnostics 2016-12-27 10:20:59 -07:00
Catatonic Prime ff7343e872 Yay gcrypt is working!!! 2016-12-27 17:14:17 +00:00
Catatonic Prime 050892bb73 libgcrypt doens't appear to be working either. No errors so crypto is funny? dunno. 2016-12-27 16:32:27 +00:00
Catatonic Prime 43e3040062 Basic libgcrypt usage... no idea if it works, but it has to be better than nothing right? 2016-12-25 03:24:06 +00:00
van Hauser 796992d82d fix for libressl 2016-11-22 16:58:11 +01:00
Catatonic Prime 0c2e02135d Formatting 2016-11-13 20:37:35 +00:00
Catatonic Prime 2713a0d816 Including memory checks 2016-11-12 18:47:21 +00:00
Catatonic Prime 3f73d1f163 Oops missed a reference. 2016-11-12 18:38:42 +00:00
Catatonic Prime 756d8a631f Fixing warnings 2016-11-12 18:37:10 +00:00
Catatonic Prime 44180b2c98 Adding documentation.
Fixing memory leaks.
2016-11-12 18:23:43 +00:00
Catatonic Prime 1732eff6bb Initial working radmin 2.x cracker. Lots of additional work still left to be done. 2016-11-12 08:38:39 +00:00
van Hauser bcf224097c Merge pull request #170 from deniswhite8/master
Fix telnet complete condition
2016-11-08 11:11:49 +01:00
Denis Belov 4582bc9529 Fix telnet complete condition 2016-11-07 22:15:34 +00:00
van Hauser 4ee7bc3c38 fix for current libsvn 2016-11-04 17:53:07 +01:00
van Hauser 5a1a66d2a3 fix 2016-11-04 10:31:57 +01:00
van Hauser 9fcde9f9bb dpl4hydra update 2016-11-03 17:16:12 +01:00
van Hauser 2b02aa091b optimized oracle module and user not existing messages 2016-11-03 12:41:44 +01:00
van Hauser 7110837cf8 print -m data when starting 2016-11-03 12:20:33 +01:00
van Hauser ff57715ea0 fixed todo calc 2016-11-02 16:43:56 +01:00
van Hauser ac2dd7817d added -I option 2016-11-02 14:34:43 +01:00
van Hauser 333713288c new protocol module: adam6500 2016-10-27 13:13:18 +02:00
van Hauser 0cd82aae49 removed issue/113 bailing 2016-10-25 10:36:02 +02:00
van Hauser b46bed226b makefile reset 2016-10-15 14:47:00 +02:00
van Hauser 514e23611b fixed some compiler warnings 2016-10-15 14:46:48 +02:00
van Hauser a88f18ee16 rpcap by Petar Kaleychev <petar.kaleychev@gmail.com> 2016-10-12 19:55:31 +02:00
van Hauser 3f6ea5b20a Merge pull request #165 from PetarKaleychev/master
New module: rpcap
2016-10-12 19:53:17 +02:00
Petar Kaleychev 9fdb9e3d2d Update hydra.c 2016-10-12 20:14:56 +03:00
Petar Kaleychev 81533865bf Update hydra.c 2016-10-12 20:13:08 +03:00
Petar Kaleychev 98ba037748 Update hydra-rpcap.c 2016-10-12 20:02:20 +03:00
Petar Kaleychev be07643841 Update Makefile.am 2016-10-12 20:01:12 +03:00
Petar Kaleychev 17fafc1f90 Update hydra.h 2016-10-12 19:59:00 +03:00
Petar Kaleychev f3d56bdb0d Update hydra.c 2016-10-12 19:56:33 +03:00
Petar Kaleychev 79a1bb5d6f Update hydra.c 2016-10-12 19:47:01 +03:00
Petar Kaleychev 812a39f80a Create hydra-rpcap.c 2016-10-12 19:41:52 +03:00
van Hauser bb53072a73 proxy file support implemented 2016-10-12 17:37:51 +02:00
van Hauser d27e40cd32 Merge pull request #164 from PetarKaleychev/master
Bug fix and module improvement
2016-10-12 09:59:20 +02:00
Petar Kaleychev 093f172ee3 Update hydra-redis.c 2016-10-11 21:31:56 +03:00
Petar Kaleychev 3658f3a6ad Update hydra-redis.c 2016-10-11 21:28:24 +03:00
van Hauser 402cc0934e Merge pull request #161 from sizeofvoid/master
added LibreSSL support
2016-10-09 16:39:41 +02:00
Rafael Sadowski 09e8c3378b add LibreSSL support
- Tested with LibreSSL 2.5.0 on OpenBSD current amd64
2016-10-09 10:05:13 +02:00
van Hauser 1c744634a1 flush outputfile after found password 2016-09-13 13:05:50 +02:00
van Hauser d1d39badc0 warning for smtp/pop3/imap usage with -S when starttls is needed 2016-09-13 11:33:04 +02:00
van Hauser d89983364b present better error message for clueless users :) 2016-09-03 10:56:32 +02:00
van Hauser 0a7ae89631 fixed sleepn 2016-09-01 17:42:43 +02:00
van Hauser f42f7626ac sleep -> usleep fix 2016-09-01 17:38:33 +02:00
van Hauser cbe0ada4c1 changelog added 2016-08-30 15:42:16 +02:00
van Hauser 8d981c0e15 Merge pull request #149 from crondaemon/cron
Fix issue #148.
2016-08-30 15:39:05 +02:00
Dario Lombardo 712defcb40 Add new option to disable placeholders.
With -y the use of -x ?:?:aA1 has changed to "use a, A and 1",
instead of "use all lowercase, uppercase letters and all numbers".
2016-08-30 15:18:47 +02:00
Dario Lombardo 2e8c21a9ca Change printf modifier. 2016-08-30 15:18:47 +02:00
van Hauser 6444712bd7 updated web files 2016-08-11 10:01:56 +02:00
van Hauser a4bc5a2c21 property fixes 2016-08-11 09:58:01 +02:00
van Hauser 9dbe84c3d7 gitignore update 2016-08-11 09:53:42 +02:00
van Hauser 047c957ed6 8.4-dev 2016-08-11 09:51:27 +02:00
150 changed files with 16001 additions and 15828 deletions
+117
View File
@@ -0,0 +1,117 @@
---
Language: Cpp
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 512
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: true
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentPPDirectives: None
IndentWidth: 2
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 2
UseTab: Never
...
+37
View File
@@ -0,0 +1,37 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**IMPORTANT**
This is just for reporting *BUGS* not help on how to hack, how to use hydra, command line options or how to get it compiled. Please search for help via search engines. Issues asking for this here will be closed.
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
* Ensure that you have tested the bug to be present in the current github code. You might be using an outdated version that comes with your Linux distribution!
* You must provide full command line options.
Steps to reproduce the behavior:
1. ...
2. ...
3. ...
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
Note that all messages must be in *English*, not in Chinese, Russian, etc.
**Desktop (please complete the following information):**
- OS: [e.g. Ubuntu 20.04]
- hydra version [e.g. current github state]
**Additional context**
Add any other context about the problem here.
+23
View File
@@ -0,0 +1,23 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**IMPORTANT**
Please note that hydra is still maintained however not actively developed. If you would like to see specific feature here it it recommended implement it yourself and send a pull request - or look for someone to do that for you :-)
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
+5
View File
@@ -2,10 +2,15 @@ Makefile
Makefile.in
*.o
hydra
hydra.exe
xhydra
xhydra.exe
hydra-gtk/config.log
hydra-gtk/config.status
hydra-gtk/errors
hydra-gtk/src/.deps/
hydra-gtk/stamp-h
pw-inspector
pw-inspector.exe
hydra.restore
*~
+19
View File
@@ -0,0 +1,19 @@
language: c
sudo: required
dist: trusty
os:
- linux
- osx
arch:
- amd64
- ppc64le
compiler:
- clang
- gcc
matrix:
before_install:
- if [ "$TRAVIS_OS_NAME" == "osx" ];then brew install libgcrypt; fi
before_script:
./configure
script:
- make
+4 -1
View File
@@ -40,6 +40,8 @@ LOCAL_SRC_FILES:= \
hydra-irc.c\
hydra-ldap.c\
hydra-mod.c\
hydra-memcached.c\
hydra-mongodb.c\
hydra-mssql.c\
hydra-mysql.c\
hydra-ncp.c\
@@ -90,7 +92,8 @@ LOCAL_STATIC_LIBRARIES := \
libiconv\
libneon\
libssl_static\
libcrypto_static
libcrypto_static\
libmemcached
LOCAL_SHARED_LIBRARIES := \
libsqlite\
+113 -2
View File
@@ -1,6 +1,118 @@
Changelog for hydra
-------------------
Release 9.3-dev
* support Xcode compilation
* new module: cobaltstrike by ultimaiiii, thank you!
* fix for ssh to support -M or ip/range
* fix for rdp to detect empty passwords
* for vnc/cisco/... protocols that only check for a password, skip host
after the password is found
* fixe to support IPv6 addresses in -M
* added "make uninstall"
Release 9.2
* fix for http-post-form optional parameters
* enable gcc 10 support for xhydra too :)
* msys support
* removed rain mode (-r) because of inefficiency
* IPv6 support for Host: header for http based modules
Release 9.1
* rdb: support for libfreerdp3 (thanks to animetauren)
* new module: smb2 which also supports smb3 (uses libsmbclient-dev) (thanks to Karim Kanso for the module!)
* oracle: added success condition (thanks to kazkansouh), compile on Cygwin (thanks to maaaaz)
* rtsp: fixed crash in MD5 auth
* svn: updated to support past and new API
* http: now supports F=/S= string matching conditions (thanks to poucz@github)
* http-proxy: buffer fix, 404 success condition (thanks to kazkansouh)
* mysql: changed not to use mysql db as a default. if the user has not access to this db auth fails ...
* sasl: buffer fix (thanks to TenGbps)
* fixed help for https modules (thanks to Jab2870)
* added -K command line switch to disable redo attempts (good for mass scanning)
* forgot to have the -m option in the hydra help output
* gcc-10 support and various cleanups by Jeroen Roovers, thanks!
* added .clang-format and formatted all code
Release 9.0
* rdp: Revamped rdp module to use FreeRDP library (thanks to loianhtuan@github for the patch!)
* Added memcached module
* Added mongodb module
* http: http module now supports a= option to select http authentication type
* JSON output does now truncate the file if exists.
* Fixed svn module memory leaks
* Fixed rtsp module potential buffer overflow
* Fixed http module DIGEST-MD5 mode
Release 8.9.1
* Clarification for rdp error message
* CIDR notation (hydra -l test -p test 192.168.0.0/24 ftp) was not detected, fixed
Release 8.8
* New web page: https://github.com/vanhauser-thc/thc-hydra
* added PROBLEMS file with known issues
* rdp: disabled the module as it does not support the current protocol. If you want to add it contact me
* ldap: fixed a dumb strlen on a potential null pointer
* http-get/http-post:
- now supports H=/h= parameters same as http-form (thanks to mathewmarcus@github for the patch)
- 403/404 errors are now always registered as failed attempts
* mysql module: a non-default port was not working, fixed
* added -w timeout support to ssh module
* fixed various memory leaks in http-form module
* corrected hydra return code to be 0 on success
* added patch from debian maintainers which fixes spellings
* fixed weird crash on x64 systems
* many warning fixes by crondaemon
Release 8.6
* added radmin2 module by catatonic prime - great work!
* smb module now checks if SMBv1 is supported by the server and if signing is required
* http-form module now supports URLs up to 6000 bytes (thanks to petrock6@github for the patch)
* Fix for SSL connections that failed with error:00000000:lib(0):func(0):reason(0) (thanks gaia@github for reporting)
* Added new command line option:
-c TIME: seconds between login attempts (over all threads, so -t 1 is recommended)
* Options put after -R (for loading a restore file) are now honored (and were disallowed before)
* merged several patches by Diadlo@github to make the code easier readable. thanks for that!
* merged a patch by Diadlo@github that moves the help output to the invididual module
Release 8.5
* New command line option:
-b : format option for -o output file (json only so far, happy for patches supporting others :) ) - thanks to veggiespam for the patch
* ./configure now honors the CC enviroment variable if present
* Fix for the restore file crash on some x64 platforms (finally! thanks to lukas227!)
* Changed the format of the restore file to detect cross platform copies
* Fixed a bug in the NCP module
* Favor strrchr() over rindex()
* Added refactoring patch by diadlo
* Updated man page with missing command line options
Release 8.4
! Reports came in that the rdp module is not working reliable sometimes, most likely against new Windows versions. please test, report and if possible send a fix
* Proxy support re-implemented:
- HYDRA_PROXY[_HTTP] environment can be a text file with up to 64 entries
- HYDRA_PROXY_AUTH was deprecated, set login/password in HTTP_PROXY[_HTTP]
* New protocol: adam6500 - this one is work in progress, please test and report
* New protocol: rpcap - thanks to Petar Kaleychev <petar.kaleychev@gmail.com>
* New command line options:
-y : disables -x 1aA interpretation, thanks to crondaemon for the patch
-I : ignore an existing hydra.restore file (don't wait for 10 seconds)
* hydra-svn: works now with the current libsvn version
* hydra-ssh: initial check for password auth support now uses login supplied
* Fixed dpl4hydra to be able to update from the web again
* Fixed crash when -U was used without any service (thanks to thecarterb for reporting)
* Updated default password lists
* The protocols vnc, xmpp, telnet, imap, nntp and pcanywhere got accidentially long sleep commands due a patch in 8.2, fixed
* Added special error message for clueless users :)
Release 8.3
* Support for upcoming OpenSSL 1.1 added. needs testing.
* Fixed hydra redo bug (issue #113)
@@ -8,10 +120,9 @@ Release 8.3
* Some more command line error checking
* Ensured unneeded sockets are closed
Release 8.2
* Added RTSP module, thanks to jjavi89 for supplying!
* Added patch for ssh that fixes hyra stopping to connect, thanks to ShantonRU for the patch
* Added patch for ssh that fixes hydra stopping to connect, thanks to ShantonRU for the patch
* Added new -O option to hydra to support SSL servers that do not suport TLS
* Added xhydra gtk patche by Petar Kaleychev to support modules that do not use usernames
* Added patch to redis for initial service checking by Petar Kaleychev - thanks a lot!
+18 -1
View File
@@ -2,10 +2,27 @@ type "./configure", then "make" and finally "sudo make install"
For special modules you need to install software packages before
you run "./configure":
Ubuntu/Debian: apt-get install libssl-dev libssh-dev libidn11-dev libpcre3-dev libgtk2.0-dev libmysqlclient-dev libpq-dev libsvn-dev firebird2.1-dev libncp-dev libncurses5-dev
Ubuntu/Debian: apt-get install libssl-dev libssh-dev libidn11-dev libpcre3-dev libgtk2.0-dev libmysqlclient-dev libpq-dev libsvn-dev firebird-dev libncurses5-dev
Redhat/Fedora: yum install openssl-devel pcre-devel ncpfs-devel postgresql-devel libssh-devel subversion-devel libncurses-devel
OpenSuSE: zypper install libopenssl-devel pcre-devel libidn-devel ncpfs-devel libssh-devel postgresql-devel subversion-devel libncurses-devel
For Termux/Android you need the following setup:
Install the necessary dependencies
# pkg install -y x11-repo
# pkg install -y clang make openssl openssl-tool wget openssh coreutils gtk2 gtk3
And then compiling hydra
# ./configure --prefix=$PREFIX
# make
# make install
To use xhydra, you will need to install a graphical output in termux, you can be guided from this article:
https://wiki.termux.com/wiki/Graphical_Environment
For the Oracle login module, install the basic and SDK packages:
http://www.oracle.com/technetwork/database/features/instant-client/index.html
+3
View File
@@ -3,3 +3,6 @@ all:
clean:
cp -f Makefile.orig Makefile
uninstall:
@echo Error: you must run "./configure" first
+41 -20
View File
@@ -1,36 +1,47 @@
#
# Makefile for Hydra - (c) 2001-2016 by van Hauser / THC <vh@thc.org>
# Makefile for Hydra - (c) 2001-2020 by van Hauser / THC <vh@thc.org>
#
OPTS=-I. -O3
WARN_CLANG=-Wformat-nonliteral -Wstrncat-size -Wformat-security -Wsign-conversion -Wconversion -Wfloat-conversion -Wshorten-64-to-32 -Wuninitialized -Wmissing-variable-declarations -Wmissing-declarations
WARN_GCC=-Wformat=2 -Wformat-overflow=2 -Wformat-nonliteral -Wformat-truncation=2 -Wnull-dereference -Wstrict-overflow=2 -Wstringop-overflow=4 -Walloca-larger-than=4096 -Wtype-limits -Wconversion -Wtrampolines -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -fno-common -Wcast-align
CFLAGS ?= -g
OPTS=-I. -O3 $(CFLAGS) -fcommon
# -Wall -g -pedantic
LIBS=-lm
BINDIR = /bin
MANDIR ?= /man/man1
DATADIR ?= /etc
DESTDIR ?=
BINDIR = /bin
MANDIR = /man/man1/
DATADIR = /etc
PIXDIR = /share/pixmaps
APPDIR = /share/applications
SRC = hydra-vnc.c hydra-pcnfs.c hydra-rexec.c hydra-nntp.c hydra-socks5.c \
hydra-telnet.c hydra-cisco.c hydra-http.c hydra-ftp.c hydra-imap.c \
hydra-pop3.c hydra-smb.c hydra-icq.c hydra-cisco-enable.c hydra-ldap.c \
hydra-mysql.c hydra-mssql.c hydra-xmpp.c hydra-http-proxy-urlenum.c \
hydra-snmp.c hydra-cvs.c hydra-smtp.c hydra-smtp-enum.c hydra-sapr3.c hydra-ssh.c \
hydra-sshkey.c hydra-teamspeak.c hydra-postgres.c hydra-rsh.c hydra-rlogin.c \
hydra-oracle-listener.c hydra-svn.c hydra-pcanywhere.c hydra-sip.c \
hydra-oracle.c hydra-vmauthd.c hydra-asterisk.c hydra-firebird.c hydra-afp.c hydra-ncp.c \
hydra-memcached.c hydra-mongodb.c hydra-mysql.c hydra-mssql.c hydra-xmpp.c \
hydra-http-proxy-urlenum.c hydra-snmp.c hydra-cvs.c hydra-smtp.c \
hydra-smtp-enum.c hydra-sapr3.c hydra-ssh.c hydra-sshkey.c hydra-teamspeak.c \
hydra-postgres.c hydra-rsh.c hydra-rlogin.c hydra-oracle-listener.c \
hydra-svn.c hydra-pcanywhere.c hydra-sip.c hydra-oracle.c hydra-vmauthd.c \
hydra-asterisk.c hydra-firebird.c hydra-afp.c hydra-ncp.c hydra-rdp.c \
hydra-oracle-sid.c hydra-http-proxy.c hydra-http-form.c hydra-irc.c \
hydra-rdp.c hydra-s7-300.c hydra-redis.c \
crc32.c d3des.c bfg.c ntlm.c sasl.c hmacmd5.c hydra-mod.c hydra-rtsp.c hydra-time.c
hydra-s7-300.c hydra-redis.c hydra-adam6500.c hydra-rtsp.c \
hydra-rpcap.c hydra-radmin2.c hydra-cobaltstrike.c \
hydra-time.c crc32.c d3des.c bfg.c ntlm.c sasl.c hmacmd5.c hydra-mod.c \
hydra-smb2.c
OBJ = hydra-vnc.o hydra-pcnfs.o hydra-rexec.o hydra-nntp.o hydra-socks5.o \
hydra-telnet.o hydra-cisco.o hydra-http.o hydra-ftp.o hydra-imap.o \
hydra-pop3.o hydra-smb.o hydra-icq.o hydra-cisco-enable.o hydra-ldap.o \
hydra-mysql.o hydra-mssql.o hydra-xmpp.o hydra-http-proxy-urlenum.o \
hydra-snmp.o hydra-cvs.o hydra-smtp.o hydra-smtp-enum.o hydra-sapr3.o hydra-ssh.o \
hydra-sshkey.o hydra-teamspeak.o hydra-postgres.o hydra-rsh.o hydra-rlogin.o \
hydra-oracle-listener.o hydra-svn.o hydra-pcanywhere.o hydra-sip.o \
hydra-oracle-sid.o hydra-oracle.o hydra-vmauthd.o hydra-asterisk.o hydra-firebird.o hydra-afp.o hydra-ncp.o \
hydra-http-proxy.o hydra-http-form.o hydra-irc.o hydra-redis.o \
hydra-rdp.o hydra-s7-300.c \
crc32.o d3des.o bfg.o ntlm.o sasl.o hmacmd5.o hydra-mod.o hydra-rtsp.o hydra-time.o
hydra-memcached.o hydra-mongodb.o hydra-mysql.o hydra-mssql.o hydra-cobaltstrike.o hydra-xmpp.o \
hydra-http-proxy-urlenum.o hydra-snmp.o hydra-cvs.o hydra-smtp.o \
hydra-smtp-enum.o hydra-sapr3.o hydra-ssh.o hydra-sshkey.o hydra-teamspeak.o \
hydra-postgres.o hydra-rsh.o hydra-rlogin.o hydra-oracle-listener.o \
hydra-svn.o hydra-pcanywhere.o hydra-sip.o hydra-oracle-sid.o hydra-oracle.o \
hydra-vmauthd.o hydra-asterisk.o hydra-firebird.o hydra-afp.o \
hydra-ncp.o hydra-http-proxy.o hydra-http-form.o hydra-irc.o \
hydra-redis.o hydra-rdp.o hydra-s7-300.c hydra-adam6500.o hydra-rtsp.o \
hydra-rpcap.o hydra-radmin2.o \
crc32.o d3des.o bfg.o ntlm.o sasl.o hmacmd5.o hydra-mod.o hydra-time.o \
hydra-smb2.o
BINS = hydra pw-inspector
EXTRA_DIST = README README.arm README.palm CHANGES TODO INSTALL LICENSE \
@@ -69,8 +80,18 @@ install: strip
-cp -f *.csv $(DESTDIR)$(PREFIX)$(DATADIR)
-mkdir -p $(DESTDIR)$(PREFIX)$(MANDIR)
-cp -f hydra.1 xhydra.1 pw-inspector.1 $(DESTDIR)$(PREFIX)$(MANDIR)
-mkdir -p $(DESTDIR)$(PREFIX)$(PIXDIR)
-cp -f xhydra.png $(DESTDIR)$(PREFIX)$(PIXDIR)/
-mkdir -p $(DESTDIR)$(PREFIX)$(APPDIR)
-desktop-file-install --dir $(DESTDIR)$(PREFIX)$(APPDIR) xhydra.desktop
clean:
rm -rf xhydra pw-inspector hydra *.o core *.core *.stackdump *~ Makefile.in Makefile dev_rfc hydra.restore arm/*.ipk arm/ipkg/usr/bin/* hydra-gtk/src/*.o hydra-gtk/src/xhydra hydra-gtk/stamp-h hydra-gtk/config.status hydra-gtk/errors hydra-gtk/config.log hydra-gtk/src/.deps hydra-gtk/src/Makefile hydra-gtk/Makefile
cp -f Makefile.orig Makefile
uninstall:
-rm -f $(DESTDIR)$(PREFIX)$(BINDIR)/xhydra $(DESTDIR)$(PREFIX)$(BINDIR)/hydra $(DESTDIR)$(PREFIX)$(BINDIR)/pw-inspector $(DESTDIR)$(PREFIX)$(BINDIR)/hydra-wizard.sh $(DESTDIR)$(PREFIX)$(BINDIR)/dpl4hydra.sh
-rm -f $(DESTDIR)$(PREFIX)$(DATADIR)/dpl4hydra_full.csv $(DESTDIR)$(PREFIX)$(DATADIR)/dpl4hydra_local.csv
-rm -f $(DESTDIR)$(PREFIX)$(MANDIR)/hydra.1 $(DESTDIR)$(PREFIX)$(MANDIR)/xhydra.1 $(DESTDIR)$(PREFIX)$(MANDIR)/pw-inspector.1
-rm -f $(DESTDIR)$(PREFIX)$(PIXDIR)/xhydra.png
-rm -f $(DESTDIR)$(PREFIX)$(APPDIR)/xhydra.desktop
+3
View File
@@ -3,3 +3,6 @@ all:
clean:
cp -f Makefile.orig Makefile
uninstall:
@echo Error: you must run "./configure" first
-1
View File
@@ -1,2 +1 @@
CC=gcc
STRIP=strip
+5
View File
@@ -0,0 +1,5 @@
List of known issues:
=====================
* Cygwin: more than 30 tasks (-t 31 or more) will lead to a stack smash
* OS X: brew installed modules are not compiled correctly and will crash hydra
+215 -82
View File
@@ -1,8 +1,8 @@
H Y D R A
(c) 2001-2016 by van Hauser / THC
<vh@thc.org> http://www.thc.org
(c) 2001-2021 by van Hauser / THC
<vh@thc.org> https://github.com/vanhauser-thc/thc-hydra
many modules were written by David (dot) Maciejak @ gmail (dot) com
BFG code by Jan Dlabal <dlabaljan@gmail.com>
@@ -10,6 +10,9 @@
Please do not use in military or secret service organizations,
or for illegal purposes.
(This is the wish of the author and non-binding. Many people working
in these organizations do not care for laws and ethics anyways.
You are not one of the "good" ones if you ignore this.)
@@ -23,19 +26,19 @@ access from remote to a system.
THIS TOOL IS FOR LEGAL PURPOSES ONLY!
There are already several login hacker tools available, however none does
either support more than one protocol to attack or support parallized
There are already several login hacker tools available, however, none does
either support more than one protocol to attack or support parallelized
connects.
It was tested to compile cleanly on Linux, Windows/Cygwin, Solaris,
FreeBSD/OpenBSD, QNX (Blackberry 10) and OSX.
FreeBSD/OpenBSD, QNX (Blackberry 10) and MacOS.
Currently this tool supports the following protocols:
Asterisk, AFP, Cisco AAA, Cisco auth, Cisco enable, CVS, Firebird, FTP,
HTTP-FORM-GET, HTTP-FORM-POST, HTTP-GET, HTTP-HEAD, HTTP-POST, HTTP-PROXY,
HTTPS-FORM-GET, HTTPS-FORM-POST, HTTPS-GET, HTTPS-HEAD, HTTPS-POST,
HTTP-Proxy, ICQ, IMAP, IRC, LDAP, MS-SQL, MYSQL, NCP, NNTP, Oracle Listener,
Oracle SID, Oracle, PC-Anywhere, PCNFS, POP3, POSTGRES, RDP, Rexec, Rlogin,
HTTP-Proxy, ICQ, IMAP, IRC, LDAP, MEMCACHED, MONGODB, MS-SQL, MYSQL, NCP, NNTP, Oracle Listener,
Oracle SID, Oracle, PC-Anywhere, PCNFS, POP3, POSTGRES, Radmin, RDP, Rexec, Rlogin,
Rsh, RTSP, SAP/R3, SIP, SMB, SMTP, SMTP Enum, SNMP v1+v2+v3, SOCKS5,
SSH (v1 and v2), SSHKEY, Subversion, Teamspeak (TS2), Telnet, VMware-Auth,
VNC and XMPP.
@@ -49,12 +52,12 @@ Your help in writing, enhancing or fixing modules is highly appreciated!! :-)
WHERE TO GET
------------
You can always find the newest release/production version of hydra at its
project page at https://www.thc.org/thc-hydra
project page at https://github.com/vanhauser-thc/thc-hydra/releases
If you are interested in the current development state, the public development
repository is at Github:
svn co https://github.com/vanhauser-thc/thc-hydra
or
git clone https://github.com/vanhauser-thc/thc-hydra.git
git clone https://github.com/vanhauser-thc/thc-hydra
Use the development version at your own risk. It contains new features and
new bugs. Things might not work!
@@ -64,57 +67,68 @@ HOW TO COMPILE
--------------
To configure, compile and install hydra, just type:
```
./configure
make
make install
```
If you want the ssh module, you have to setup libssh (not libssh2!) on your
system, get it from http://www.libssh.org, for ssh v1 support you also need
system, get it from https://www.libssh.org, for ssh v1 support you also need
to add "-DWITH_SSH1=On" option in the cmake command line.
IMPORTANT: If you compile on MacOS then you must do this - do not install libssh via brew!
If you use Ubuntu/Debian, this will install supplementary libraries needed
for a few optional modules:
apt-get install libssl-dev libssh-dev libidn11-dev libpcre3-dev \
for a few optional modules (note that some might not be available on your distribution):
```
apt-get install libssl-dev libssh-dev libidn11-dev libpcre3-dev \
libgtk2.0-dev libmysqlclient-dev libpq-dev libsvn-dev \
firebird2.1-dev libncp-dev
firebird-dev libmemcached-dev libgpg-error-dev \
libgcrypt11-dev libgcrypt20-dev
```
This enables all optional modules and features with the exception of Oracle,
SAP R/3 and the apple filing protocol - which you will need to download and
SAP R/3, NCP and the apple filing protocol - which you will need to download and
install from the vendor's web sites.
For all other Linux derivates and BSD based systems, use the system
software installer and look for similar named libraries like in the
command above. In all other cases you have to download all source libraries
software installer and look for similarly named libraries like in the
command above. In all other cases, you have to download all source libraries
and compile them manually.
SUPPORTED PLATFORMS
-------------------
All UNIX platforms (linux, *bsd, solaris, etc.)
Mac OS/X
Windows with Cygwin (both IPv4 and IPv6)
Mobile systems based on Linux, Mac OS/X or QNX (e.g. Android, iPhone, Blackberry 10, Zaurus, iPaq)
- All UNIX platforms (Linux, *BSD, Solaris, etc.)
- MacOS (basically a BSD clone)
- Windows with Cygwin (both IPv4 and IPv6)
- Mobile systems based on Linux, MacOS or QNX (e.g. Android, iPhone, Blackberry 10, Zaurus, iPaq)
HOW TO USE
----------
If you just enter "hydra", you will see a short summary of the important
If you just enter `hydra`, you will see a short summary of the important
options available.
Type "./hydra -h" to see all available command line options.
Type `./hydra -h` to see all available command line options.
Note that NO login/password file is included. Generate them yourself.
A default password list is however present, use "dpl4hydra.sh" to generate
a list.
For Linux users, a GTK gui is available, try "./xhydra"
For Linux users, a GTK GUI is available, try `./xhydra`
For the command line usage, the syntax is as follows:
For attacking one target or a network, you can use the new "://" style:
hydra [some command line options] PROTOCOL://TARGET:PORT/OPTIONS
hydra [some command line options] PROTOCOL://TARGET:PORT/MODULE-OPTIONS
The old mode can be used for these too, and additionally if you want to
specify your targets from a text file, you *must* use this one:
hydra [some command line options] [-s port] TARGET PROTOCOL OPTIONS
```
hydra [some command line options] [-s PORT] TARGET PROTOCOL [MODULE-OPTIONS]
```
Via the command line options you specify which logins to try, which passwords,
if SSL should be used, how many parallel tasks to use for attacking, etc.
@@ -122,7 +136,7 @@ if SSL should be used, how many parallel tasks to use for attacking, etc.
PROTOCOL is the protocol you want to use for attacking, e.g. ftp, smtp,
http-get or many others are available
TARGET is the target you want to attack
OPTIONS are optional values which are special per PROTOCOL module
MODULE-OPTIONS are optional values which are special per PROTOCOL module
FIRST - select your target
you have three options on how to specify the target you want to attack:
@@ -139,7 +153,7 @@ THIRD - check if the module has optional parameters
e.g. hydra -U smtp
FOURTH - the destination port
this is optional! if no port is supplied the default common port for the
this is optional, if no port is supplied the default common port for the
PROTOCOL is used.
If you specify SSL to use ("-S" option), the SSL common port is used by default.
@@ -147,7 +161,7 @@ FOURTH - the destination port
If you use "://" notation, you must use "[" "]" brackets if you want to supply
IPv6 addresses or CIDR ("192.168.0.0/24") notations to attack:
hydra [some command line options] ftp://[192.168.0.0/24]/
hydra [some command line options] -6 smtp://[2001:db8::1]/NTLM
hydra [some command line options] -6 smtps://[2001:db8::1]/NTLM
Note that everything hydra does is IPv4 only!
If you want to attack IPv6 addresses, you must add the "-6" command line option.
@@ -156,24 +170,29 @@ All attacks are then IPv6 only!
If you want to supply your targets via a text file, you can not use the ://
notation but use the old style and just supply the protocol (and module options):
hydra [some command line options] -M targets.txt ftp
You can supply also port for each target entry by adding ":<port>" after a
You can also supply the port for each target entry by adding ":<port>" after a
target entry in the file, e.g.:
foo.bar.com
target.com:21
unusual.port.com:2121
default.used.here.com
127.0.0.1
127.0.0.1:2121
```
foo.bar.com
target.com:21
unusual.port.com:2121
default.used.here.com
127.0.0.1
127.0.0.1:2121
```
Note that if you want to attach IPv6 targets, you must supply the -6 option
and *must* put IPv6 addresses in brackets in the file(!) like this:
foo.bar.com
target.com:21
[fe80::1%eth0]
[2001::1]
[2002::2]:8080
[2a01:24a:133:0:00:123:ff:1a]
```
foo.bar.com
target.com:21
[fe80::1%eth0]
[2001::1]
[2002::2]:8080
[2a01:24a:133:0:00:123:ff:1a]
```
LOGINS AND PASSWORDS
--------------------
@@ -182,45 +201,68 @@ With -l for login and -p for password you tell hydra that this is the only
login and/or password to try.
With -L for logins and -P for passwords you supply text files with entries.
e.g.:
hydra -l admin -p password ftp://localhost/
hydra -L default_logins.txt -p test ftp://localhost/
hydra -l admin -P common_passwords.txt ftp://localhost/
hydra -L logins.txt -P passwords.txt ftp://localhost/
```
hydra -l admin -p password ftp://localhost/
hydra -L default_logins.txt -p test ftp://localhost/
hydra -l admin -P common_passwords.txt ftp://localhost/
hydra -L logins.txt -P passwords.txt ftp://localhost/
```
Additionally, you can try passwords based on the login via the "-e" option.
The "-e" option has three parameters:
s - try the login as password
n - try an empty password
r - reverse the login and try it as password
```
s - try the login as password
n - try an empty password
r - reverse the login and try it as password
```
If you want to, e.g. try "try login as password and "empty password", you
specify "-e sn" on the command line.
But there are two more modes for trying passwords than -p/-P:
You can use text file which where a login and password pair is separated by a colon,
e.g.:
admin:password
test:test
foo:bar
```
admin:password
test:test
foo:bar
```
This is a common default account style listing, that is also generated by the
dpl4hydra.sh default account file generator supplied with hydra.
You use such a text file with the -C option - note that in this mode you
can not use -l/-L/-p/-P options (-e nsr however you can).
Example:
hydra -C default_accounts.txt ftp://localhost/
```
hydra -C default_accounts.txt ftp://localhost/
```
And finally, there is a bruteforce mode with the -x option (which you can not
use with -p/-P/-C):
-x minimum_length:maximum_length:charset
the charset definition is 'a' for lowercase letters, 'A' for uppercase letters,
'1' for numbers and for anything else you supply it is their real representation.
```
-x minimum_length:maximum_length:charset
```
the charset definition is `a` for lowercase letters, `A` for uppercase letters,
`1` for numbers and for anything else you supply it is their real representation.
Examples:
-x 1:3:a generate passwords from length 1 to 3 with all lowercase letters
-x 2:5:/ generate passwords from length 2 to 5 containing only slashes
-x 5:8:A1 generate passwords from length 5 to 8 with uppercase and numbers
```
-x 1:3:a generate passwords from length 1 to 3 with all lowercase letters
-x 2:5:/ generate passwords from length 2 to 5 containing only slashes
-x 5:8:A1 generate passwords from length 5 to 8 with uppercase and numbers
```
Example:
hydra -l ftp -x 3:3:a ftp://localhost/
```
hydra -l ftp -x 3:3:a ftp://localhost/
```
SPECIAL OPTIONS FOR MODULES
---------------------------
@@ -229,19 +271,23 @@ command line option, you can pass one option to a module.
Many modules use this, a few require it!
To see the special option of a module, type:
hydra -U <module>
e.g.
./hydra -U http-post-form
The special options can be passed via the -m parameter, as 3rd command line
option or in the service://target/option format.
Examples (they are all equal):
./hydra -l test -p test -m PLAIN 127.0.0.1 imap
./hydra -l test -p test 127.0.0.1 imap PLAIN
./hydra -l test -p test imap://127.0.0.1/PLAIN
```
./hydra -l test -p test -m PLAIN 127.0.0.1 imap
./hydra -l test -p test 127.0.0.1 imap PLAIN
./hydra -l test -p test imap://127.0.0.1/PLAIN
```
RESTORING AN ABORTED/CRASHED SESSION
------------------------------------
@@ -249,27 +295,37 @@ When hydra is aborted with Control-C, killed or crashes, it leaves a
"hydra.restore" file behind which contains all necessary information to
restore the session. This session file is written every 5 minutes.
NOTE: the hydra.restore file can NOT be copied to a different platform (e.g.
from little endian to big endian, or from solaris to aix)
from little endian to big endian, or from Solaris to AIX)
HOW TO SCAN/CRACK OVER A PROXY
------------------------------
The environment variable HYDRA_PROXY_HTTP defines the web proxy (this works
just for the http/www service!).
just for the http services!).
The following syntax is valid:
HYDRA_PROXY_HTTP="http://123.45.67.89:8080/"
For all other services, use the HYDRA_PROXY variable to scan/crack
via by default a web proxy's CONNECT call. It uses the same syntax. eg:
HYDRA_PROXY=[http|socks4|socks5]://proxy_addr:proxy_port
```
HYDRA_PROXY_HTTP="http://123.45.67.89:8080/"
HYDRA_PROXY_HTTP="http://login:password@123.45.67.89:8080/"
HYDRA_PROXY_HTTP="proxylist.txt"
```
The last example is a text file containing up to 64 proxies (in the same
format definition as the other examples).
For all other services, use the HYDRA_PROXY variable to scan/crack.
It uses the same syntax. eg:
```
HYDRA_PROXY=[connect|socks4|socks5]://[login:password@]proxy_addr:proxy_port
```
for example:
HYDRA_PROXY=http://proxy.anonymizer.com:8000
If you require authentication for the proxy, use the HYDRA_PROXY_AUTH
environment variable:
HYDRA_PROXY_AUTH="the_login:the_password"
```
HYDRA_PROXY=connect://proxy.anonymizer.com:8000
HYDRA_PROXY=socks4://auth:pw@127.0.0.1:1080
HYDRA_PROXY=socksproxylist.txt
```
ADDITIONAL HINTS
----------------
@@ -278,12 +334,83 @@ ADDITIONAL HINTS
* uniq your dictionary files! this can save you a lot of time :-)
cat words.txt | sort | uniq > dictionary.txt
* if you know that the target is using a password policy (allowing users
only to choose password with a minimum length of 6, containing a least one
only to choose a password with a minimum length of 6, containing a least one
letter and one number, etc. use the tool pw-inspector which comes along
with the hydra package to reduce the password list:
cat dictionary.txt | pw-inspector -m 6 -c 2 -n > passlist.txt
RESULTS OUTPUT
--------------
The results are output to stdio along with the other information. Via the -o
command line option, the results can also be written to a file. Using -b,
the format of the output can be specified. Currently, these are supported:
* `text` - plain text format
* `jsonv1` - JSON data using version 1.x of the schema (defined below).
* `json` - JSON data using the latest version of the schema, currently there
is only version 1.
If using JSON output, the results file may not be valid JSON if there are
serious errors in booting Hydra.
JSON Schema
-----------
Here is an example of the JSON output. Notes on some of the fields:
* `errormessages` - an array of zero or more strings that are normally printed
to stderr at the end of the Hydra's run. The text is very free form.
* `success` - indication if Hydra ran correctly without error (**NOT** if
passwords were detected). This parameter is either the JSON value `true`
or `false` depending on completion.
* `quantityfound` - How many username+password combinations discovered.
* `jsonoutputversion` - Version of the schema, 1.00, 1.01, 1.11, 2.00,
2.03, etc. Hydra will make second tuple of the version to always be two
digits to make it easier for downstream processors (as opposed to v1.1 vs
v1.10). The minor-level versions are additive, so 1.02 will contain more
fields than version 1.00 and will be backward compatible. Version 2.x will
break something from version 1.x output.
Version 1.00 example:
```
{
"errormessages": [
"[ERROR] Error Message of Something",
"[ERROR] Another Message",
"These are very free form"
],
"generator": {
"built": "2021-03-01 14:44:22",
"commandline": "hydra -b jsonv1 -o results.json ... ...",
"jsonoutputversion": "1.00",
"server": "127.0.0.1",
"service": "http-post-form",
"software": "Hydra",
"version": "v8.5"
},
"quantityfound": 2,
"results": [
{
"host": "127.0.0.1",
"login": "bill@example.com",
"password": "bill",
"port": 9999,
"service": "http-post-form"
},
{
"host": "127.0.0.1",
"login": "joe@example.com",
"password": "joe",
"port": 9999,
"service": "http-post-form"
}
],
"success": false
}
```
SPEED
-----
@@ -301,6 +428,7 @@ Run against a SuSE Linux 7.2 on localhost with a "-C FILE" containing
295 entries (294 tries invalid logins, 1 valid). Every test was run three
times (only for "1 task" just once), and the average noted down.
```
P A R A L L E L T A S K S
SERVICE 1 4 8 16 32 50 64 100 128
------- --------------------------------------------------------------------
@@ -308,6 +436,7 @@ telnet 23:20 5:58 2:58 1:34 1:05 0:33 0:45* 0:25* 0:55*
ftp 45:54 11:51 5:54 3:06 1:25 0:58 0:46 0:29 0:32
pop3 92:10 27:16 13:56 6:42 2:55 1:57 1:24 1:14 0:50
imap 31:05 7:41 3:51 1:58 1:01 0:39 0:32 0:25 0:21
```
(*)
Note: telnet timings can be VERY different for 64 to 128 tasks! e.g. with
@@ -315,10 +444,12 @@ Note: telnet timings can be VERY different for 64 to 128 tasks! e.g. with
The reason for this is unknown...
guesses per task (rounded up):
295 74 38 19 10 6 5 3 3
295 74 38 19 10 6 5 3 3
guesses possible per connect (depends on the server software and config):
telnet 4
telnet 4
ftp 6
pop3 1
imap 3
@@ -334,6 +465,7 @@ vh@thc.org (and put "antispam" in the subject line)
You should use PGP to encrypt emails to vh@thc.org :
```
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v3.3.3 (vh@thc.org)
@@ -399,3 +531,4 @@ zlGuZP1S6Y7S13ytiULSzTfUxJmyGYgNo+4ygh0i6Dudf9NLmV+i9aEIbLbd6bni
zB3yrr+vYBT0uDWmxwPjiJs=
=ytEf
-----END PGP PUBLIC KEY BLOCK-----
```
+5
View File
@@ -1,4 +1,9 @@
./configure:
- add test for -march=native
--- this is old ---
Prio 1:
* add cookie support to hydra-http.c
* hydra-smb more than 1 connection?
+2
View File
@@ -0,0 +1,2 @@
title: "thc-hydra"
theme: jekyll-theme-midnight
+120 -92
View File
@@ -1,26 +1,65 @@
/* code original by Jan Dlabal <dlabaljan@gmail.com>, partially rewritten by vh */
/* code original by Jan Dlabal <dlabaljan@gmail.com>, partially rewritten by vh. */
#include <ctype.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#ifdef __sun
#include <sys/int_types.h>
#elif defined(__FreeBSD__) || defined(__IBMCPP__) || defined(_AIX)
#include <inttypes.h>
#else
#include <stdint.h>
#endif
#include "bfg.h"
bf_option bf_options;
#ifdef HAVE_MATH_H
extern int debug;
extern int32_t debug;
static int32_t add_single_char(char ch, char flags, int32_t *crs_len) {
if ((ch >= '2' && ch <= '9') || ch == '0') {
if ((flags & BF_NUMS) > 0) {
printf("[ERROR] character %c defined in -x although the whole number "
"range was already defined by '1', ignored\n",
ch);
return 0;
}
// printf("[WARNING] adding character %c for -x, note that '1' will add all
// numbers from 0-9\n", ch);
}
if (tolower((int32_t)ch) >= 'b' && tolower((int32_t)ch) <= 'z') {
if ((ch <= 'Z' && (flags & BF_UPPER) > 0) || (ch > 'Z' && (flags & BF_UPPER) > 0)) {
printf("[ERROR] character %c defined in -x although the whole letter "
"range was already defined by '%c', ignored\n",
ch, ch <= 'Z' ? 'A' : 'a');
return 0;
}
// printf("[WARNING] adding character %c for -x, note that '%c' will add all
// %scase letters\n", ch, ch <= 'Z' ? 'A' : 'a', ch <= 'Z' ? "up" : "low");
}
(*crs_len)++;
if (BF_CHARSMAX - *crs_len < 1) {
free(bf_options.crs);
fprintf(stderr, "Error: charset specification exceeds %d characters.\n", BF_CHARSMAX);
return 1;
} else {
bf_options.crs[*crs_len - 1] = ch;
bf_options.crs[*crs_len] = '\0';
}
return 0;
}
// return values : 0 on success, 1 on error
//
// note that we check for -x .:.:ab but not for -x .:.:ba
//
int bf_init(char *arg) {
int i = 0;
int crs_len = 0;
int32_t bf_init(char *arg) {
int32_t i = 0;
int32_t crs_len = 0;
char flags = 0;
char *tmp = strchr(arg, ':');
@@ -32,7 +71,8 @@ int bf_init(char *arg) {
}
bf_options.from = atoi(arg);
if (bf_options.from < 1 || bf_options.from > 127) {
fprintf(stderr, "Error: minimum length must be between 1 and 127, format: -x min:max:types\n");
fprintf(stderr, "Error: minimum length must be between 1 and 127, format: "
"-x min:max:types\n");
return 1;
}
arg = tmp + 1;
@@ -52,7 +92,8 @@ int bf_init(char *arg) {
tmp++;
if (bf_options.from > bf_options.to) {
fprintf(stderr, "Error: you specified a minimum length higher than the maximum length!\n");
fprintf(stderr, "Error: you specified a minimum length higher than the "
"maximum length!\n");
return 1;
}
@@ -69,102 +110,88 @@ int bf_init(char *arg) {
bf_options.crs[0] = 0;
for (; tmp[i]; i++) {
switch (tmp[i]) {
case 'a':
crs_len += 26;
if (BF_CHARSMAX - crs_len < 1) {
free(bf_options.crs);
fprintf(stderr, "Error: charset specification exceeds %d characters.\n", BF_CHARSMAX);
if (bf_options.disable_symbols) {
if (add_single_char(tmp[i], flags, &crs_len) == -1)
return 1;
} else if (flags & BF_LOWER) {
free(bf_options.crs);
fprintf(stderr, "Error: 'a' specified more than once in charset!\n");
return 1;
} else {
strcat(bf_options.crs, "abcdefghijklmnopqrstuvwxyz");
flags |= BF_LOWER;
}
break;
case 'A':
crs_len += 26;
if (BF_CHARSMAX - crs_len < 1) {
free(bf_options.crs);
fprintf(stderr, "Error: charset specification exceeds %d characters.\n", BF_CHARSMAX);
return 1;
} else if (flags & BF_UPPER) {
free(bf_options.crs);
fprintf(stderr, "Error: 'A' specified more than once in charset!\n");
return 1;
} else {
strcat(bf_options.crs, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
flags |= BF_UPPER;
}
break;
case '1':
crs_len += 10;
if (BF_CHARSMAX - crs_len < 1) {
free(bf_options.crs);
fprintf(stderr, "Error: charset specification exceeds %d characters.\n", BF_CHARSMAX);
return 1;
} else if (flags & BF_NUMS) {
free(bf_options.crs);
fprintf(stderr, "Error: '1' specified more than once in charset!\n");
return 1;
} else {
strcat(bf_options.crs, "0123456789");
flags |= BF_NUMS;
}
break;
default:
if ((tmp[i] >= '2' && tmp[i] <= '9') || tmp[i] == '0') {
if ((flags & BF_NUMS) > 0) {
printf("[ERROR] character %c defined in -x although the whole number range was already defined by '1', ignored\n", tmp[i]);
continue;
} else {
switch (tmp[i]) {
case 'a':
crs_len += 26;
if (BF_CHARSMAX - crs_len < 1) {
free(bf_options.crs);
fprintf(stderr, "Error: charset specification exceeds %d characters.\n", BF_CHARSMAX);
return 1;
} else if (flags & BF_LOWER) {
free(bf_options.crs);
fprintf(stderr, "Error: 'a' specified more than once in charset!\n");
return 1;
} else {
strcat(bf_options.crs, "abcdefghijklmnopqrstuvwxyz");
flags |= BF_LOWER;
}
printf("[WARNING] adding character %c for -x, note that '1' will add all numbers from 0-9\n", tmp[i]);
}
if (tolower((int) tmp[i]) >= 'b' && tolower((int) tmp[i]) <= 'z') {
if ((tmp[i] <= 'Z' && (flags & BF_UPPER) > 0) || (tmp[i] > 'Z' && (flags & BF_UPPER) > 0)) {
printf("[ERROR] character %c defined in -x although the whole letter range was already defined by '%c', ignored\n", tmp[i], tmp[i] <= 'Z' ? 'A' : 'a');
continue;
break;
case 'A':
crs_len += 26;
if (BF_CHARSMAX - crs_len < 1) {
free(bf_options.crs);
fprintf(stderr, "Error: charset specification exceeds %d characters.\n", BF_CHARSMAX);
return 1;
} else if (flags & BF_UPPER) {
free(bf_options.crs);
fprintf(stderr, "Error: 'A' specified more than once in charset!\n");
return 1;
} else {
strcat(bf_options.crs, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
flags |= BF_UPPER;
}
printf("[WARNING] adding character %c for -x, note that '%c' will add all %scase letters\n", tmp[i], tmp[i] <= 'Z' ? 'A' : 'a', tmp[i] <= 'Z' ? "up" : "low");
break;
case '1':
crs_len += 10;
if (BF_CHARSMAX - crs_len < 1) {
free(bf_options.crs);
fprintf(stderr, "Error: charset specification exceeds %d characters.\n", BF_CHARSMAX);
return 1;
} else if (flags & BF_NUMS) {
free(bf_options.crs);
fprintf(stderr, "Error: '1' specified more than once in charset!\n");
return 1;
} else {
strcat(bf_options.crs, "0123456789");
flags |= BF_NUMS;
}
break;
default:
if (add_single_char(tmp[i], flags, &crs_len) == -1)
return 1;
break;
}
crs_len++;
if (BF_CHARSMAX - crs_len < 1) {
free(bf_options.crs);
fprintf(stderr, "Error: charset specification exceeds %d characters.\n", BF_CHARSMAX);
return 1;
} else {
bf_options.crs[crs_len - 1] = tmp[i];
bf_options.crs[crs_len] = '\0';
}
break;
}
}
bf_options.crs_len = crs_len;
bf_options.current = bf_options.from;
memset((char *) bf_options.state, 0, sizeof(bf_options.state));
memset((char *)bf_options.state, 0, sizeof(bf_options.state));
if (debug)
printf("[DEBUG] bfg INIT: from %u, to %u, len: %u, set: %s\n", bf_options.from, bf_options.to, bf_options.crs_len, bf_options.crs);
return 0;
}
unsigned long int bf_get_pcount() {
int i;
uint64_t bf_get_pcount() {
int32_t i;
double count = 0;
unsigned long int foo;
uint64_t foo;
for (i = bf_options.from; i <= bf_options.to; i++)
count += (pow((double) bf_options.crs_len, (double) i));
count += (pow((double)bf_options.crs_len, (double)i));
if (count >= 0xffffffff) {
fprintf(stderr, "\n[ERROR] definition for password bruteforce (-x) generates more than 4 billion passwords\n");
fprintf(stderr, "\n[ERROR] definition for password bruteforce (-x) "
"generates more than 4 billion passwords - this is not a bug in the program, it is just not feasible to try so many attempts. Try a calculator how long that would take. duh.\n");
exit(-1);
}
@@ -172,20 +199,20 @@ unsigned long int bf_get_pcount() {
return foo;
}
char *bf_next() {
int i, pos = bf_options.current - 1;
int32_t i, pos = bf_options.current - 1;
if (bf_options.current > bf_options.to)
return NULL; // we are done
return NULL; // we are done
if ((bf_options.ptr = malloc(BF_CHARSMAX)) == NULL) {
fprintf(stderr, "Error: Can not allocate memory for -x data!\n");
return NULL;
}
for (i = 0; i < bf_options.current; i++)
for (i = 0; i < bf_options.current; ++i)
bf_options.ptr[i] = bf_options.crs[bf_options.state[i]];
// we don't subtract the same depending on wether the length is odd or even
bf_options.ptr[bf_options.current] = 0;
if (debug) {
@@ -195,14 +222,15 @@ char *bf_next() {
printf(", x: %s\n", bf_options.ptr);
}
// we revert the ordering of the bruteforce to fix the first static character
while (pos >= 0 && (++bf_options.state[pos]) >= bf_options.crs_len) {
bf_options.state[pos] = 0;
pos--;
}
if (pos < 0) {
if (pos < 0 || pos >= bf_options.current) {
bf_options.current++;
memset((char *) bf_options.state, 0, sizeof(bf_options.state));
memset((char *)bf_options.state, 0, sizeof(bf_options.state));
}
return bf_options.ptr;
+11 -8
View File
@@ -24,7 +24,9 @@
#define BF_WEBSITE "http://houbysoft.com/bfg/"
#define BF_BUFLEN 1024
#define BF_CHARSMAX 256 /* how many max possibilities there are for characters, normally it's 2^8 = 256 */
#define BF_CHARSMAX \
256 /* how many max possibilities there are for characters, normally it's \
2^8 = 256 */
#define BF_LOWER 1
#define BF_UPPER 2
@@ -35,18 +37,19 @@ typedef struct {
unsigned char to;
unsigned char current;
unsigned char state[BF_CHARSMAX]; /* which position has which character */
unsigned char pos; /* where in current string length is the position */
unsigned char crs_len; /* length of selected charset */
char *arg; /* argument received for bfg commandline option */
char *crs; /* internal representation of charset */
char *ptr; /* ptr to the last generated password */
unsigned char pos; /* where in current string length is the position */
unsigned char crs_len; /* length of selected charset */
char *arg; /* argument received for bfg commandline option */
char *crs; /* internal representation of charset */
char *ptr; /* ptr to the last generated password */
uint32_t disable_symbols;
} bf_option;
extern bf_option bf_options;
#ifdef HAVE_MATH_H
extern unsigned long int bf_get_pcount();
extern int bf_init(char *arg);
extern uint64_t bf_get_pcount();
extern int32_t bf_init(char *arg);
extern char *bf_next();
#endif
Vendored
+613 -81
View File
File diff suppressed because it is too large Load Diff
+56 -88
View File
@@ -1,99 +1,67 @@
/*-
* COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or
* code or tables extracted from it, as desired without restriction.
*
* First, the polynomial itself and its table of feedback terms. The
* polynomial is
* X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0
*
* Note that we take it "backwards" and put the highest-order term in
* the lowest-order bit. The X^32 term is "implied"; the LSB is the
* X^31 term, etc. The X^0 term (usually shown as "+1") results in
* the MSB being 1
*
* Note that the usual hardware shift register implementation, which
* is what we're using (we're merely optimizing it by doing eight-bit
* chunks at a time) shifts bits into the lowest-order term. In our
* implementation, that means shifting towards the right. Why do we
* do it this way? Because the calculated CRC must be transmitted in
* order from highest-order term to lowest-order term. UARTs transmit
* characters in order from LSB to MSB. By storing the CRC this way
* we hand it to the UART in the order low-byte to high-byte; the UART
* sends each low-bit to hight-bit; and the result is transmission bit
* by bit from highest- to lowest-order term without requiring any bit
* shuffling on our part. Reception works similarly
*
* The feedback terms table consists of 256, 32-bit entries. Notes
*
* The table can be generated at runtime if desired; code to do so
* is shown later. It might not be obvious, but the feedback
* terms simply represent the results of eight shift/xor opera
* tions for all combinations of data and CRC register values
*
* The values must be right-shifted by eight bits by the "updcrc
* logic; the shift must be unsigned (bring in zeroes). On some
* hardware you could probably optimize the shift in assembler by
* using byte-swap instructions
* polynomial $edb88320
*
*
* CRC32 code derived from work by Gary S. Brown.
*/
* COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or
* code or tables extracted from it, as desired without restriction.
*
* First, the polynomial itself and its table of feedback terms. The
* polynomial is
* X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0
*
* Note that we take it "backwards" and put the highest-order term in
* the lowest-order bit. The X^32 term is "implied"; the LSB is the
* X^31 term, etc. The X^0 term (usually shown as "+1") results in
* the MSB being 1
*
* Note that the usual hardware shift register implementation, which
* is what we're using (we're merely optimizing it by doing eight-bit
* chunks at a time) shifts bits into the lowest-order term. In our
* implementation, that means shifting towards the right. Why do we
* do it this way? Because the calculated CRC must be transmitted in
* order from highest-order term to lowest-order term. UARTs transmit
* characters in order from LSB to MSB. By storing the CRC this way
* we hand it to the UART in the order low-byte to high-byte; the UART
* sends each low-bit to hight-bit; and the result is transmission bit
* by bit from highest- to lowest-order term without requiring any bit
* shuffling on our part. Reception works similarly
*
* The feedback terms table consists of 256, 32-bit entries. Notes
*
* The table can be generated at runtime if desired; code to do so
* is shown later. It might not be obvious, but the feedback
* terms simply represent the results of eight shift/xor opera
* tions for all combinations of data and CRC register values
*
* The values must be right-shifted by eight bits by the "updcrc
* logic; the shift must be unsigned (bring in zeroes). On some
* hardware you could probably optimize the shift in assembler by
* using byte-swap instructions
* polynomial $edb88320
*
*
* CRC32 code derived from work by Gary S. Brown.
*/
#include <sys/types.h>
#ifdef __sun
#include <sys/int_types.h>
#elif defined(__FreeBSD__) || defined(__IBMCPP__) || defined(_AIX)
#include <inttypes.h>
#else
#include <stdint.h>
#endif
unsigned int crc32_tab[] = {
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c,
0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106,
0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d,
0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7,
0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa,
0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84,
0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55,
0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28,
0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69,
0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,
0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693,
0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
};
uint32_t crc32_tab[] = {0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1,
0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934,
0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f,
0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe,
0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69,
0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d};
#ifndef HAVE_ZLIB
unsigned int crc32(const void *buf, unsigned int size) {
uint32_t crc32(const void *buf, uint32_t size) {
const unsigned char *p;
unsigned int crc;
uint32_t crc;
p = buf;
crc = ~0U;
+1 -1
View File
@@ -4,7 +4,7 @@
#include <sys/types.h>
#ifndef HAVE_ZLIB
unsigned int crc32(const void *buf, unsigned int size);
uint32_t crc32(const void *buf, uint32_t size);
#endif
#endif
+39 -195
View File
@@ -1,4 +1,3 @@
/* 2001 van Hauser for Hydra: commented out KnR Kn3 and Df_Key to remove
compiler warnings for unused definitions.
*/
@@ -38,55 +37,34 @@ static void unscrun(unsigned long *, unsigned char *);
static void desfunc(unsigned long *, unsigned long *);
static void cookey(unsigned long *);
static unsigned long KnL[32] = { 0L };
static unsigned long KnL[32] = {0L};
/* not needed ...
static unsigned long KnR[32] = { 0L };
static unsigned long Kn3[32] = { 0L };
static unsigned char Df_Key[24] = {
0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,
0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10,
0x89,0xab,0xcd,0xef,0x01,0x23,0x45,0x67 };
0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,
0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10,
0x89,0xab,0xcd,0xef,0x01,0x23,0x45,0x67 };
*/
static unsigned short bytebit[8] = {
01, 02, 04, 010, 020, 040, 0100, 0200
};
static unsigned short bytebit[8] = {01, 02, 04, 010, 020, 040, 0100, 0200};
static unsigned long bigbyte[24] = {
0x800000L, 0x400000L, 0x200000L, 0x100000L,
0x80000L, 0x40000L, 0x20000L, 0x10000L,
0x8000L, 0x4000L, 0x2000L, 0x1000L,
0x800L, 0x400L, 0x200L, 0x100L,
0x80L, 0x40L, 0x20L, 0x10L,
0x8L, 0x4L, 0x2L, 0x1L
};
static unsigned long bigbyte[24] = {0x800000L, 0x400000L, 0x200000L, 0x100000L, 0x80000L, 0x40000L, 0x20000L, 0x10000L, 0x8000L, 0x4000L, 0x2000L, 0x1000L, 0x800L, 0x400L, 0x200L, 0x100L, 0x80L, 0x40L, 0x20L, 0x10L, 0x8L, 0x4L, 0x2L, 0x1L};
/* Use the key schedule specified in the Standard (ANSI X3.92-1981). */
static unsigned char pc1[56] = {
56, 48, 40, 32, 24, 16, 8, 0, 57, 49, 41, 33, 25, 17,
9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35,
62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21,
13, 5, 60, 52, 44, 36, 28, 20, 12, 4, 27, 19, 11, 3
};
static unsigned char pc1[56] = {56, 48, 40, 32, 24, 16, 8, 0, 57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 60, 52, 44, 36, 28, 20, 12, 4, 27, 19, 11, 3};
static unsigned char totrot[16] = {
1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28
};
static unsigned char totrot[16] = {1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28};
static unsigned char pc2[48] = {
13, 16, 10, 23, 0, 4, 2, 27, 14, 5, 20, 9,
22, 18, 11, 3, 25, 7, 15, 6, 26, 19, 12, 1,
40, 51, 30, 36, 46, 54, 29, 39, 50, 44, 32, 47,
43, 48, 38, 55, 33, 52, 45, 41, 49, 35, 28, 31
};
static unsigned char pc2[48] = {13, 16, 10, 23, 0, 4, 2, 27, 14, 5, 20, 9, 22, 18, 11, 3, 25, 7, 15, 6, 26, 19, 12, 1, 40, 51, 30, 36, 46, 54, 29, 39, 50, 44, 32, 47, 43, 48, 38, 55, 33, 52, 45, 41, 49, 35, 28, 31};
void deskey(key, edf) /* Thanks to James Gillogly & Phil Karn! */
unsigned char *key;
int edf;
void deskey(key, edf) /* Thanks to James Gillogly & Phil Karn! */
unsigned char *key;
int32_t edf;
{
register int i, j, l, m, n;
register int32_t i, j, l, m, n;
unsigned char pc1m[56], pcr[56];
unsigned long kn[32];
@@ -127,12 +105,11 @@ void deskey(key, edf) /* Thanks to James Gillogly & Phil Karn! */
return;
}
static void cookey(raw1)
register unsigned long *raw1;
static void cookey(raw1) register unsigned long *raw1;
{
register unsigned long *cook, *raw0;
unsigned long dough[32];
register int i;
register int32_t i;
cook = dough;
for (i = 0; i < 16; i++, raw1++) {
@@ -150,8 +127,7 @@ static void cookey(raw1)
return;
}
void cpkey(into)
register unsigned long *into;
void cpkey(into) register unsigned long *into;
{
register unsigned long *from, *endp;
@@ -161,8 +137,7 @@ void cpkey(into)
return;
}
void usekey(from)
register unsigned long *from;
void usekey(from) register unsigned long *from;
{
register unsigned long *to, *endp;
@@ -181,9 +156,8 @@ void des(unsigned char *inblock, unsigned char *outblock) {
return;
}
static void scrunch(outof, into)
register unsigned char *outof;
register unsigned long *into;
static void scrunch(outof, into) register unsigned char *outof;
register unsigned long *into;
{
*into = (*outof++ & 0xffL) << 24;
*into |= (*outof++ & 0xffL) << 16;
@@ -196,9 +170,8 @@ static void scrunch(outof, into)
return;
}
static void unscrun(outof, into)
register unsigned long *outof;
register unsigned char *into;
static void unscrun(outof, into) register unsigned long *outof;
register unsigned char *into;
{
*into++ = (*outof >> 24) & 0xffL;
*into++ = (*outof >> 16) & 0xffL;
@@ -211,163 +184,34 @@ static void unscrun(outof, into)
return;
}
static unsigned long SP1[64] = {
0x01010400L, 0x00000000L, 0x00010000L, 0x01010404L,
0x01010004L, 0x00010404L, 0x00000004L, 0x00010000L,
0x00000400L, 0x01010400L, 0x01010404L, 0x00000400L,
0x01000404L, 0x01010004L, 0x01000000L, 0x00000004L,
0x00000404L, 0x01000400L, 0x01000400L, 0x00010400L,
0x00010400L, 0x01010000L, 0x01010000L, 0x01000404L,
0x00010004L, 0x01000004L, 0x01000004L, 0x00010004L,
0x00000000L, 0x00000404L, 0x00010404L, 0x01000000L,
0x00010000L, 0x01010404L, 0x00000004L, 0x01010000L,
0x01010400L, 0x01000000L, 0x01000000L, 0x00000400L,
0x01010004L, 0x00010000L, 0x00010400L, 0x01000004L,
0x00000400L, 0x00000004L, 0x01000404L, 0x00010404L,
0x01010404L, 0x00010004L, 0x01010000L, 0x01000404L,
0x01000004L, 0x00000404L, 0x00010404L, 0x01010400L,
0x00000404L, 0x01000400L, 0x01000400L, 0x00000000L,
0x00010004L, 0x00010400L, 0x00000000L, 0x01010004L
};
static unsigned long SP1[64] = {0x01010400L, 0x00000000L, 0x00010000L, 0x01010404L, 0x01010004L, 0x00010404L, 0x00000004L, 0x00010000L, 0x00000400L, 0x01010400L, 0x01010404L, 0x00000400L, 0x01000404L, 0x01010004L, 0x01000000L, 0x00000004L, 0x00000404L, 0x01000400L, 0x01000400L, 0x00010400L, 0x00010400L, 0x01010000L, 0x01010000L, 0x01000404L, 0x00010004L, 0x01000004L, 0x01000004L, 0x00010004L, 0x00000000L, 0x00000404L, 0x00010404L, 0x01000000L,
0x00010000L, 0x01010404L, 0x00000004L, 0x01010000L, 0x01010400L, 0x01000000L, 0x01000000L, 0x00000400L, 0x01010004L, 0x00010000L, 0x00010400L, 0x01000004L, 0x00000400L, 0x00000004L, 0x01000404L, 0x00010404L, 0x01010404L, 0x00010004L, 0x01010000L, 0x01000404L, 0x01000004L, 0x00000404L, 0x00010404L, 0x01010400L, 0x00000404L, 0x01000400L, 0x01000400L, 0x00000000L, 0x00010004L, 0x00010400L, 0x00000000L, 0x01010004L};
static unsigned long SP2[64] = {
0x80108020L, 0x80008000L, 0x00008000L, 0x00108020L,
0x00100000L, 0x00000020L, 0x80100020L, 0x80008020L,
0x80000020L, 0x80108020L, 0x80108000L, 0x80000000L,
0x80008000L, 0x00100000L, 0x00000020L, 0x80100020L,
0x00108000L, 0x00100020L, 0x80008020L, 0x00000000L,
0x80000000L, 0x00008000L, 0x00108020L, 0x80100000L,
0x00100020L, 0x80000020L, 0x00000000L, 0x00108000L,
0x00008020L, 0x80108000L, 0x80100000L, 0x00008020L,
0x00000000L, 0x00108020L, 0x80100020L, 0x00100000L,
0x80008020L, 0x80100000L, 0x80108000L, 0x00008000L,
0x80100000L, 0x80008000L, 0x00000020L, 0x80108020L,
0x00108020L, 0x00000020L, 0x00008000L, 0x80000000L,
0x00008020L, 0x80108000L, 0x00100000L, 0x80000020L,
0x00100020L, 0x80008020L, 0x80000020L, 0x00100020L,
0x00108000L, 0x00000000L, 0x80008000L, 0x00008020L,
0x80000000L, 0x80100020L, 0x80108020L, 0x00108000L
};
static unsigned long SP2[64] = {0x80108020L, 0x80008000L, 0x00008000L, 0x00108020L, 0x00100000L, 0x00000020L, 0x80100020L, 0x80008020L, 0x80000020L, 0x80108020L, 0x80108000L, 0x80000000L, 0x80008000L, 0x00100000L, 0x00000020L, 0x80100020L, 0x00108000L, 0x00100020L, 0x80008020L, 0x00000000L, 0x80000000L, 0x00008000L, 0x00108020L, 0x80100000L, 0x00100020L, 0x80000020L, 0x00000000L, 0x00108000L, 0x00008020L, 0x80108000L, 0x80100000L, 0x00008020L,
0x00000000L, 0x00108020L, 0x80100020L, 0x00100000L, 0x80008020L, 0x80100000L, 0x80108000L, 0x00008000L, 0x80100000L, 0x80008000L, 0x00000020L, 0x80108020L, 0x00108020L, 0x00000020L, 0x00008000L, 0x80000000L, 0x00008020L, 0x80108000L, 0x00100000L, 0x80000020L, 0x00100020L, 0x80008020L, 0x80000020L, 0x00100020L, 0x00108000L, 0x00000000L, 0x80008000L, 0x00008020L, 0x80000000L, 0x80100020L, 0x80108020L, 0x00108000L};
static unsigned long SP3[64] = {
0x00000208L, 0x08020200L, 0x00000000L, 0x08020008L,
0x08000200L, 0x00000000L, 0x00020208L, 0x08000200L,
0x00020008L, 0x08000008L, 0x08000008L, 0x00020000L,
0x08020208L, 0x00020008L, 0x08020000L, 0x00000208L,
0x08000000L, 0x00000008L, 0x08020200L, 0x00000200L,
0x00020200L, 0x08020000L, 0x08020008L, 0x00020208L,
0x08000208L, 0x00020200L, 0x00020000L, 0x08000208L,
0x00000008L, 0x08020208L, 0x00000200L, 0x08000000L,
0x08020200L, 0x08000000L, 0x00020008L, 0x00000208L,
0x00020000L, 0x08020200L, 0x08000200L, 0x00000000L,
0x00000200L, 0x00020008L, 0x08020208L, 0x08000200L,
0x08000008L, 0x00000200L, 0x00000000L, 0x08020008L,
0x08000208L, 0x00020000L, 0x08000000L, 0x08020208L,
0x00000008L, 0x00020208L, 0x00020200L, 0x08000008L,
0x08020000L, 0x08000208L, 0x00000208L, 0x08020000L,
0x00020208L, 0x00000008L, 0x08020008L, 0x00020200L
};
static unsigned long SP3[64] = {0x00000208L, 0x08020200L, 0x00000000L, 0x08020008L, 0x08000200L, 0x00000000L, 0x00020208L, 0x08000200L, 0x00020008L, 0x08000008L, 0x08000008L, 0x00020000L, 0x08020208L, 0x00020008L, 0x08020000L, 0x00000208L, 0x08000000L, 0x00000008L, 0x08020200L, 0x00000200L, 0x00020200L, 0x08020000L, 0x08020008L, 0x00020208L, 0x08000208L, 0x00020200L, 0x00020000L, 0x08000208L, 0x00000008L, 0x08020208L, 0x00000200L, 0x08000000L,
0x08020200L, 0x08000000L, 0x00020008L, 0x00000208L, 0x00020000L, 0x08020200L, 0x08000200L, 0x00000000L, 0x00000200L, 0x00020008L, 0x08020208L, 0x08000200L, 0x08000008L, 0x00000200L, 0x00000000L, 0x08020008L, 0x08000208L, 0x00020000L, 0x08000000L, 0x08020208L, 0x00000008L, 0x00020208L, 0x00020200L, 0x08000008L, 0x08020000L, 0x08000208L, 0x00000208L, 0x08020000L, 0x00020208L, 0x00000008L, 0x08020008L, 0x00020200L};
static unsigned long SP4[64] = {
0x00802001L, 0x00002081L, 0x00002081L, 0x00000080L,
0x00802080L, 0x00800081L, 0x00800001L, 0x00002001L,
0x00000000L, 0x00802000L, 0x00802000L, 0x00802081L,
0x00000081L, 0x00000000L, 0x00800080L, 0x00800001L,
0x00000001L, 0x00002000L, 0x00800000L, 0x00802001L,
0x00000080L, 0x00800000L, 0x00002001L, 0x00002080L,
0x00800081L, 0x00000001L, 0x00002080L, 0x00800080L,
0x00002000L, 0x00802080L, 0x00802081L, 0x00000081L,
0x00800080L, 0x00800001L, 0x00802000L, 0x00802081L,
0x00000081L, 0x00000000L, 0x00000000L, 0x00802000L,
0x00002080L, 0x00800080L, 0x00800081L, 0x00000001L,
0x00802001L, 0x00002081L, 0x00002081L, 0x00000080L,
0x00802081L, 0x00000081L, 0x00000001L, 0x00002000L,
0x00800001L, 0x00002001L, 0x00802080L, 0x00800081L,
0x00002001L, 0x00002080L, 0x00800000L, 0x00802001L,
0x00000080L, 0x00800000L, 0x00002000L, 0x00802080L
};
static unsigned long SP4[64] = {0x00802001L, 0x00002081L, 0x00002081L, 0x00000080L, 0x00802080L, 0x00800081L, 0x00800001L, 0x00002001L, 0x00000000L, 0x00802000L, 0x00802000L, 0x00802081L, 0x00000081L, 0x00000000L, 0x00800080L, 0x00800001L, 0x00000001L, 0x00002000L, 0x00800000L, 0x00802001L, 0x00000080L, 0x00800000L, 0x00002001L, 0x00002080L, 0x00800081L, 0x00000001L, 0x00002080L, 0x00800080L, 0x00002000L, 0x00802080L, 0x00802081L, 0x00000081L,
0x00800080L, 0x00800001L, 0x00802000L, 0x00802081L, 0x00000081L, 0x00000000L, 0x00000000L, 0x00802000L, 0x00002080L, 0x00800080L, 0x00800081L, 0x00000001L, 0x00802001L, 0x00002081L, 0x00002081L, 0x00000080L, 0x00802081L, 0x00000081L, 0x00000001L, 0x00002000L, 0x00800001L, 0x00002001L, 0x00802080L, 0x00800081L, 0x00002001L, 0x00002080L, 0x00800000L, 0x00802001L, 0x00000080L, 0x00800000L, 0x00002000L, 0x00802080L};
static unsigned long SP5[64] = {
0x00000100L, 0x02080100L, 0x02080000L, 0x42000100L,
0x00080000L, 0x00000100L, 0x40000000L, 0x02080000L,
0x40080100L, 0x00080000L, 0x02000100L, 0x40080100L,
0x42000100L, 0x42080000L, 0x00080100L, 0x40000000L,
0x02000000L, 0x40080000L, 0x40080000L, 0x00000000L,
0x40000100L, 0x42080100L, 0x42080100L, 0x02000100L,
0x42080000L, 0x40000100L, 0x00000000L, 0x42000000L,
0x02080100L, 0x02000000L, 0x42000000L, 0x00080100L,
0x00080000L, 0x42000100L, 0x00000100L, 0x02000000L,
0x40000000L, 0x02080000L, 0x42000100L, 0x40080100L,
0x02000100L, 0x40000000L, 0x42080000L, 0x02080100L,
0x40080100L, 0x00000100L, 0x02000000L, 0x42080000L,
0x42080100L, 0x00080100L, 0x42000000L, 0x42080100L,
0x02080000L, 0x00000000L, 0x40080000L, 0x42000000L,
0x00080100L, 0x02000100L, 0x40000100L, 0x00080000L,
0x00000000L, 0x40080000L, 0x02080100L, 0x40000100L
};
static unsigned long SP5[64] = {0x00000100L, 0x02080100L, 0x02080000L, 0x42000100L, 0x00080000L, 0x00000100L, 0x40000000L, 0x02080000L, 0x40080100L, 0x00080000L, 0x02000100L, 0x40080100L, 0x42000100L, 0x42080000L, 0x00080100L, 0x40000000L, 0x02000000L, 0x40080000L, 0x40080000L, 0x00000000L, 0x40000100L, 0x42080100L, 0x42080100L, 0x02000100L, 0x42080000L, 0x40000100L, 0x00000000L, 0x42000000L, 0x02080100L, 0x02000000L, 0x42000000L, 0x00080100L,
0x00080000L, 0x42000100L, 0x00000100L, 0x02000000L, 0x40000000L, 0x02080000L, 0x42000100L, 0x40080100L, 0x02000100L, 0x40000000L, 0x42080000L, 0x02080100L, 0x40080100L, 0x00000100L, 0x02000000L, 0x42080000L, 0x42080100L, 0x00080100L, 0x42000000L, 0x42080100L, 0x02080000L, 0x00000000L, 0x40080000L, 0x42000000L, 0x00080100L, 0x02000100L, 0x40000100L, 0x00080000L, 0x00000000L, 0x40080000L, 0x02080100L, 0x40000100L};
static unsigned long SP6[64] = {
0x20000010L, 0x20400000L, 0x00004000L, 0x20404010L,
0x20400000L, 0x00000010L, 0x20404010L, 0x00400000L,
0x20004000L, 0x00404010L, 0x00400000L, 0x20000010L,
0x00400010L, 0x20004000L, 0x20000000L, 0x00004010L,
0x00000000L, 0x00400010L, 0x20004010L, 0x00004000L,
0x00404000L, 0x20004010L, 0x00000010L, 0x20400010L,
0x20400010L, 0x00000000L, 0x00404010L, 0x20404000L,
0x00004010L, 0x00404000L, 0x20404000L, 0x20000000L,
0x20004000L, 0x00000010L, 0x20400010L, 0x00404000L,
0x20404010L, 0x00400000L, 0x00004010L, 0x20000010L,
0x00400000L, 0x20004000L, 0x20000000L, 0x00004010L,
0x20000010L, 0x20404010L, 0x00404000L, 0x20400000L,
0x00404010L, 0x20404000L, 0x00000000L, 0x20400010L,
0x00000010L, 0x00004000L, 0x20400000L, 0x00404010L,
0x00004000L, 0x00400010L, 0x20004010L, 0x00000000L,
0x20404000L, 0x20000000L, 0x00400010L, 0x20004010L
};
static unsigned long SP6[64] = {0x20000010L, 0x20400000L, 0x00004000L, 0x20404010L, 0x20400000L, 0x00000010L, 0x20404010L, 0x00400000L, 0x20004000L, 0x00404010L, 0x00400000L, 0x20000010L, 0x00400010L, 0x20004000L, 0x20000000L, 0x00004010L, 0x00000000L, 0x00400010L, 0x20004010L, 0x00004000L, 0x00404000L, 0x20004010L, 0x00000010L, 0x20400010L, 0x20400010L, 0x00000000L, 0x00404010L, 0x20404000L, 0x00004010L, 0x00404000L, 0x20404000L, 0x20000000L,
0x20004000L, 0x00000010L, 0x20400010L, 0x00404000L, 0x20404010L, 0x00400000L, 0x00004010L, 0x20000010L, 0x00400000L, 0x20004000L, 0x20000000L, 0x00004010L, 0x20000010L, 0x20404010L, 0x00404000L, 0x20400000L, 0x00404010L, 0x20404000L, 0x00000000L, 0x20400010L, 0x00000010L, 0x00004000L, 0x20400000L, 0x00404010L, 0x00004000L, 0x00400010L, 0x20004010L, 0x00000000L, 0x20404000L, 0x20000000L, 0x00400010L, 0x20004010L};
static unsigned long SP7[64] = {
0x00200000L, 0x04200002L, 0x04000802L, 0x00000000L,
0x00000800L, 0x04000802L, 0x00200802L, 0x04200800L,
0x04200802L, 0x00200000L, 0x00000000L, 0x04000002L,
0x00000002L, 0x04000000L, 0x04200002L, 0x00000802L,
0x04000800L, 0x00200802L, 0x00200002L, 0x04000800L,
0x04000002L, 0x04200000L, 0x04200800L, 0x00200002L,
0x04200000L, 0x00000800L, 0x00000802L, 0x04200802L,
0x00200800L, 0x00000002L, 0x04000000L, 0x00200800L,
0x04000000L, 0x00200800L, 0x00200000L, 0x04000802L,
0x04000802L, 0x04200002L, 0x04200002L, 0x00000002L,
0x00200002L, 0x04000000L, 0x04000800L, 0x00200000L,
0x04200800L, 0x00000802L, 0x00200802L, 0x04200800L,
0x00000802L, 0x04000002L, 0x04200802L, 0x04200000L,
0x00200800L, 0x00000000L, 0x00000002L, 0x04200802L,
0x00000000L, 0x00200802L, 0x04200000L, 0x00000800L,
0x04000002L, 0x04000800L, 0x00000800L, 0x00200002L
};
static unsigned long SP7[64] = {0x00200000L, 0x04200002L, 0x04000802L, 0x00000000L, 0x00000800L, 0x04000802L, 0x00200802L, 0x04200800L, 0x04200802L, 0x00200000L, 0x00000000L, 0x04000002L, 0x00000002L, 0x04000000L, 0x04200002L, 0x00000802L, 0x04000800L, 0x00200802L, 0x00200002L, 0x04000800L, 0x04000002L, 0x04200000L, 0x04200800L, 0x00200002L, 0x04200000L, 0x00000800L, 0x00000802L, 0x04200802L, 0x00200800L, 0x00000002L, 0x04000000L, 0x00200800L,
0x04000000L, 0x00200800L, 0x00200000L, 0x04000802L, 0x04000802L, 0x04200002L, 0x04200002L, 0x00000002L, 0x00200002L, 0x04000000L, 0x04000800L, 0x00200000L, 0x04200800L, 0x00000802L, 0x00200802L, 0x04200800L, 0x00000802L, 0x04000002L, 0x04200802L, 0x04200000L, 0x00200800L, 0x00000000L, 0x00000002L, 0x04200802L, 0x00000000L, 0x00200802L, 0x04200000L, 0x00000800L, 0x04000002L, 0x04000800L, 0x00000800L, 0x00200002L};
static unsigned long SP8[64] = {
0x10001040L, 0x00001000L, 0x00040000L, 0x10041040L,
0x10000000L, 0x10001040L, 0x00000040L, 0x10000000L,
0x00040040L, 0x10040000L, 0x10041040L, 0x00041000L,
0x10041000L, 0x00041040L, 0x00001000L, 0x00000040L,
0x10040000L, 0x10000040L, 0x10001000L, 0x00001040L,
0x00041000L, 0x00040040L, 0x10040040L, 0x10041000L,
0x00001040L, 0x00000000L, 0x00000000L, 0x10040040L,
0x10000040L, 0x10001000L, 0x00041040L, 0x00040000L,
0x00041040L, 0x00040000L, 0x10041000L, 0x00001000L,
0x00000040L, 0x10040040L, 0x00001000L, 0x00041040L,
0x10001000L, 0x00000040L, 0x10000040L, 0x10040000L,
0x10040040L, 0x10000000L, 0x00040000L, 0x10001040L,
0x00000000L, 0x10041040L, 0x00040040L, 0x10000040L,
0x10040000L, 0x10001000L, 0x10001040L, 0x00000000L,
0x10041040L, 0x00041000L, 0x00041000L, 0x00001040L,
0x00001040L, 0x00040040L, 0x10000000L, 0x10041000L
};
static unsigned long SP8[64] = {0x10001040L, 0x00001000L, 0x00040000L, 0x10041040L, 0x10000000L, 0x10001040L, 0x00000040L, 0x10000000L, 0x00040040L, 0x10040000L, 0x10041040L, 0x00041000L, 0x10041000L, 0x00041040L, 0x00001000L, 0x00000040L, 0x10040000L, 0x10000040L, 0x10001000L, 0x00001040L, 0x00041000L, 0x00040040L, 0x10040040L, 0x10041000L, 0x00001040L, 0x00000000L, 0x00000000L, 0x10040040L, 0x10000040L, 0x10001000L, 0x00041040L, 0x00040000L,
0x00041040L, 0x00040000L, 0x10041000L, 0x00001000L, 0x00000040L, 0x10040040L, 0x00001000L, 0x00041040L, 0x10001000L, 0x00000040L, 0x10000040L, 0x10040000L, 0x10040040L, 0x10000000L, 0x00040000L, 0x10001040L, 0x00000000L, 0x10041040L, 0x00040040L, 0x10000040L, 0x10040000L, 0x10001000L, 0x10001040L, 0x00000000L, 0x10041040L, 0x00041000L, 0x00041000L, 0x00001040L, 0x00001040L, 0x00040040L, 0x10000000L, 0x10041000L};
static void desfunc(block, keys)
register unsigned long *block, *keys;
static void desfunc(block, keys) register unsigned long *block, *keys;
{
register unsigned long fval, work, right, leftt;
register int round;
register int32_t round;
leftt = block[0];
right = block[1];
+10 -3
View File
@@ -1,3 +1,10 @@
#ifdef __sun
#include <sys/int_types.h>
#elif defined(__FreeBSD__) || defined(__IBMCPP__) || defined(_AIX)
#include <inttypes.h>
#else
#include <stdint.h>
#endif
/*
* This is D3DES (V5.09) by Richard Outerbridge with the double and
@@ -20,10 +27,10 @@
* (GEnie : OUTER; CIS : [71755,204])
*/
#define EN0 0 /* MODE == encrypt */
#define DE1 1 /* MODE == decrypt */
#define EN0 0 /* MODE == encrypt */
#define DE1 1 /* MODE == decrypt */
extern void deskey(unsigned char *, int);
extern void deskey(unsigned char *, int32_t);
/* hexkey[8] MODE
* Sets the internal key register according to the hexadecimal
+9 -10
View File
@@ -64,7 +64,7 @@ refresh ()
echo "done."
echo
cat $INDEXSITE | grep td | awk -F"\"" '{ print $8 }' | grep http > $SUBSITES
cat $INDEXSITE | grep -i 'href=./passwd-' | sed 's/.*href=.\/passwd-/\/passwd-/' | sed 's/".*//' > $SUBSITES
rm $INDEXSITE
if [ -r $FULLFILE ]; then
@@ -74,14 +74,13 @@ refresh ()
fi
for SUBSITE in `cat $SUBSITES`; do
VENDOR=`echo $SUBSITE | awk -F"-" '{ print $3 }' | sed 's/.htm//'`
echo "Downloading default passwords for ${VENDOR}... " | tr -d "\n"
$FETCH $SUBSITE | grep -i tr | grep -i td | grep -i celltext | sed 's/<[^>]*>/,/g' | sed 's/,,*/,/g' | sed 's/^,//g' | tr -d "\r" >dpl4hydra_${VENDOR}.tmp || { echo "not found - skipping... " | tr -d "\n" ; }
while read SYSTEM; do
echo "${VENDOR}," | tr -d "\n" >> $FULLFILE
echo "$SYSTEM" >> $FULLFILE
done < dpl4hydra_${VENDOR}.tmp
VENDOR=`echo $SUBSITE | sed 's/\.htm*//' | sed 's/.*-//'`
echo "Downloading default passwords for ${VENDOR} ... " | tr -d "\n"
$FETCH "${SITE}${SUBSITE}" | tr -d '\n\r' | sed 's/<tr/\n/gi' | sed 's/<\/tr/\n/gi' | \
grep -iw celltext | sed 's/.*celltext">/,/i' | sed 's/<\/td>/,/g' | sed 's/<[a-z =/":;-]*>//gi' | \
sed 's/[\t ]*,[\t ]*/,/g' | sed 's/&[a-z]*;//gi' | sed 's/(unknown)//gi' | sed 's/(none)//gi' | sed 's/,unknown,/,,/gi' | sed 's/,none,/,,/gi' > dpl4hydra_${VENDOR}.tmp
cat dpl4hydra_${VENDOR}.tmp | awk -F, '{print"'$VENDOR',"$2","$3","$4","$5","$6","$7","$8","$9}' >> $FULLFILE
rm dpl4hydra_${VENDOR}.tmp
echo "done."
@@ -163,7 +162,7 @@ LOCALFILE="$DPLPATH/dpl4hydra_local.csv"
INDEXSITE="$DPLPATH/dpl4hydra_index.tmp"
SUBSITES="$DPLPATH/dpl4hydra_subs.tmp"
CLEANFILE="$DPLPATH/dpl4hydra_clean.tmp"
SITE="http://open-sez.me/passwd.htm"
SITE="http://open-sez.me"
case $# in
0) usage
+2245 -26
View File
File diff suppressed because it is too large Load Diff
+2245 -26
View File
File diff suppressed because it is too large Load Diff
+14 -17
View File
@@ -1,24 +1,24 @@
/*
/*
Unix SMB/CIFS implementation.
HMAC MD5 code for use in NTLMv2
Copyright (C) Luke Kenneth Casson Leighton 1996-2000
Copyright (C) Andrew Tridgell 1992-2000
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc.
Free Software Foundation
51 Franklin Street, Fifth Floor
Boston, MA 02110-1335
@@ -34,8 +34,8 @@
*/
#ifdef LIBOPENSSL
#include <string.h>
#include "hmacmd5.h"
#include <string.h>
#define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x))
@@ -43,8 +43,8 @@
the rfc 2104 version of hmac_md5 initialisation.
***********************************************************************/
void hmac_md5_init_rfc2104(const unsigned char *key, int key_len, HMACMD5Context * ctx) {
int i;
void hmac_md5_init_rfc2104(const unsigned char *key, int32_t key_len, HMACMD5Context *ctx) {
int32_t i;
unsigned char tk[16];
/* if key is longer than 64 bytes reset it to key=MD5(key) */
@@ -52,7 +52,7 @@ void hmac_md5_init_rfc2104(const unsigned char *key, int key_len, HMACMD5Context
MD5_CTX tctx;
MD5_Init(&tctx);
MD5_Update(&tctx, (void *) key, key_len);
MD5_Update(&tctx, (void *)key, key_len);
MD5_Final(tk, &tctx);
key = tk;
@@ -79,8 +79,8 @@ void hmac_md5_init_rfc2104(const unsigned char *key, int key_len, HMACMD5Context
the microsoft version of hmac_md5 initialisation.
***********************************************************************/
void hmac_md5_init_limK_to_64(const unsigned char *key, int key_len, HMACMD5Context * ctx) {
int i;
void hmac_md5_init_limK_to_64(const unsigned char *key, int32_t key_len, HMACMD5Context *ctx) {
int32_t i;
/* if key is longer than 64 bytes truncate it */
if (key_len > 64) {
@@ -107,15 +107,12 @@ void hmac_md5_init_limK_to_64(const unsigned char *key, int key_len, HMACMD5Cont
update hmac_md5 "inner" buffer
***********************************************************************/
void hmac_md5_update(const unsigned char *text, int text_len, HMACMD5Context * ctx) {
MD5_Update(&ctx->ctx, (void *) text, text_len); /* then text of datagram */
}
void hmac_md5_update(const unsigned char *text, int32_t text_len, HMACMD5Context *ctx) { MD5_Update(&ctx->ctx, (void *)text, text_len); /* then text of datagram */ }
/***********************************************************************
finish off hmac_md5 "inner" buffer and generate outer one.
***********************************************************************/
void hmac_md5_final(unsigned char *digest, HMACMD5Context * ctx)
{
void hmac_md5_final(unsigned char *digest, HMACMD5Context *ctx) {
MD5_CTX ctx_o;
MD5_Final(digest, &ctx->ctx);
@@ -131,7 +128,7 @@ void hmac_md5_final(unsigned char *digest, HMACMD5Context * ctx)
use the microsoft hmacmd5 init method because the key is 16 bytes.
************************************************************/
void hmac_md5(unsigned char key[16], unsigned char *data, int data_len, unsigned char *digest) {
void hmac_md5(unsigned char key[16], unsigned char *data, int32_t data_len, unsigned char *digest) {
HMACMD5Context ctx;
hmac_md5_init_limK_to_64(key, 16, &ctx);
+18 -14
View File
@@ -1,19 +1,19 @@
/*
/*
Unix SMB/CIFS implementation.
Interface header: Scheduler service
Copyright (C) Luke Kenneth Casson Leighton 1996-1999
Copyright (C) Andrew Tridgell 1992-1999
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc.
@@ -29,22 +29,26 @@
*/
#ifdef __sun
#include <sys/int_types.h>
#elif defined(__FreeBSD__) || defined(__IBMCPP__) || defined(_AIX)
#include <inttypes.h>
#else
#include <stdint.h>
#endif
#include <openssl/md5.h>
#ifndef _HMAC_MD5_H
typedef struct {
MD5_CTX ctx;
unsigned char k_ipad[65];
unsigned char k_opad[65];
MD5_CTX ctx;
unsigned char k_ipad[65];
unsigned char k_opad[65];
} HMACMD5Context;
#endif /* _HMAC_MD5_H */
void hmac_md5_init_rfc2104(const unsigned char *key, int key_len, HMACMD5Context *ctx);
void hmac_md5_init_limK_to_64(const unsigned char* key, int key_len,HMACMD5Context *ctx);
void hmac_md5_update(const unsigned char *text, int text_len, HMACMD5Context *ctx);
void hmac_md5_init_rfc2104(const unsigned char *key, int32_t key_len, HMACMD5Context *ctx);
void hmac_md5_init_limK_to_64(const unsigned char *key, int32_t key_len, HMACMD5Context *ctx);
void hmac_md5_update(const unsigned char *text, int32_t text_len, HMACMD5Context *ctx);
void hmac_md5_final(unsigned char *digest, HMACMD5Context *ctx);
void hmac_md5( unsigned char key[16], unsigned char *data, int data_len, unsigned char *digest);
void hmac_md5(unsigned char key[16], unsigned char *data, int32_t data_len, unsigned char *digest);
+118
View File
@@ -0,0 +1,118 @@
#ifdef PALM
#include "palm/hydra-mod.h"
#else
#include "hydra-mod.h"
#endif
extern char *HYDRA_EXIT;
unsigned char adam6500_req1[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x01, 0x10, 0x27, 0x0f, 0x00, 0x08, 0x10, 0x24, 0x30, 0x31, 0x50, 0x57, 0x30, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x0d, 0x00};
unsigned char adam6500_resp1[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x01, 0x10, 0x27, 0x0f, 0x00, 0x08};
unsigned char adam6500_req2[] = {0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0x01, 0x03, 0x27, 0x0f, 0x00, 0x7d};
unsigned char adam6500_resp2[] = {0x01, 0x00, 0x00, 0x00, 0x00, 0xfd, 0x01, 0x03, 0xfa, 0x3f, 0x30, 0x31, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
int32_t start_adam6500(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
char *empty = "";
char *pass;
unsigned char buffer[300];
int32_t i;
if (strlen(pass = hydra_get_next_password()) == 0)
pass = empty;
memcpy(buffer, adam6500_req1, sizeof(adam6500_req1));
for (i = 0; i < 8 && i < strlen(pass); i++)
buffer[19 + i] = pass[i] ^ 0x3f;
if (hydra_send(s, buffer, sizeof(adam6500_req1), 0) < 0)
return 1;
if (recv(s, buffer, sizeof(buffer), 0) == 12 && memcmp(buffer, adam6500_resp1, sizeof(adam6500_resp1)) == 0) {
if (hydra_send(s, adam6500_req2, sizeof(adam6500_req2), 0) < 0)
return 1;
if (recv(s, buffer, sizeof(buffer), 0) == 259 && memcmp(buffer, adam6500_resp2, sizeof(adam6500_resp2)) == 0) {
hydra_completed_pair();
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return 3;
return 1;
}
}
hydra_report_found_host(port, ip, "adam6500", fp);
hydra_completed_pair_found();
return 1;
}
void service_adam6500(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
int32_t run = 1, next_run = 1, sock = -1;
int32_t myport = PORT_ADAM6500, mysslport = PORT_ADAM6500_SSL;
hydra_register_socket(sp);
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return;
while (1) {
next_run = 0;
switch (run) {
case 1: /* connect and service init function */
{
if (sock >= 0)
sock = hydra_disconnect(sock);
// usleepn(275);
if ((options & OPTION_SSL) == 0) {
if (port != 0)
myport = port;
sock = hydra_connect_tcp(ip, myport);
port = myport;
} else {
if (port != 0)
mysslport = port;
sock = hydra_connect_ssl(ip, mysslport, hostname);
port = mysslport;
}
if (sock < 0) {
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
hydra_child_exit(1);
}
next_run = 2;
break;
}
case 2: /* run the cracking function */
next_run = start_adam6500(sock, ip, port, options, miscptr, fp);
break;
case 3: /* clean exit */
if (sock >= 0)
sock = hydra_disconnect(sock);
hydra_child_exit(0);
return;
default:
hydra_report(stderr, "[ERROR] Caught unknown return code, exiting!\n");
hydra_child_exit(0);
#ifdef PALM
return;
#else
hydra_child_exit(2);
#endif
}
run = next_run;
}
}
int32_t service_adam6500_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
//
// fill if needed.
//
// return codes:
// 0 all OK
// -1 error, hydra will exit, so print a good error message here
return 0;
}
+34 -37
View File
@@ -1,7 +1,6 @@
/*
* Apple Filing Protocol Support - by David Maciejak @ GMAIL dot com
*
*
* tested with afpfs-ng 0.8.1
* AFPFS-NG: http://alexthepuffin.googlepages.com/home
*
@@ -10,52 +9,51 @@
#include "hydra-mod.h"
#ifndef LIBAFP
void dummy_afp() {
printf("\n");
}
void dummy_afp() { printf("\n"); }
#else
#define FREE(x) \
if (x != NULL) { \
free(x); \
x = NULL; \
}
#define FREE(x) \
if (x != NULL) { \
free(x); \
x = NULL; \
}
#include <stdio.h>
#include <afpfs-ng/afp.h>
#include <afpfs-ng/libafpclient.h>
#include <stdio.h>
extern char *HYDRA_EXIT;
void stdout_fct(void *priv, enum loglevels loglevel, int logtype, const char *message) {
//fprintf(stderr, "[ERROR] Caught unknown error %s\n", message);
void stdout_fct(void *priv, enum loglevels loglevel, int32_t logtype, const char *message) {
// fprintf(stderr, "[ERROR] Caught unknown error %s\n", message);
}
static struct libafpclient afpclient = {
.unmount_volume = NULL,
.log_for_client = stdout_fct,
.forced_ending_hook = NULL,
.scan_extra_fds = NULL,
.loop_started = NULL,
.unmount_volume = NULL,
.log_for_client = stdout_fct,
.forced_ending_hook = NULL,
.scan_extra_fds = NULL,
.loop_started = NULL,
};
static int server_subconnect(struct afp_url url) {
static int32_t server_subconnect(struct afp_url url) {
struct afp_connection_request *conn_req;
struct afp_server *server = NULL;
conn_req = malloc(sizeof(struct afp_connection_request));
// server = malloc(sizeof(struct afp_server));
// server = malloc(sizeof(struct afp_server));
memset(conn_req, 0, sizeof(struct afp_connection_request));
conn_req->url = url;
conn_req->url.requested_version = 31;
//fprintf(stderr, "AFP connection - username: %s password: %s server: %s\n", url.username, url.password, url.servername);
// fprintf(stderr, "AFP connection - username: %s password: %s server: %s\n",
// url.username, url.password, url.servername);
if (strlen(url.uamname) > 0) {
if ((conn_req->uam_mask = find_uam_by_name(url.uamname)) == 0) {
fprintf(stderr, "[ERROR] Unknown UAM: %s", url.uamname);
fprintf(stderr, "[ERROR] Unknown UAM: %s\n", url.uamname);
FREE(conn_req);
FREE(server);
return -1;
@@ -64,13 +62,14 @@ static int server_subconnect(struct afp_url url) {
conn_req->uam_mask = default_uams_mask();
}
//fprintf(stderr, "Initiating connection attempt.\n");
// fprintf(stderr, "Initiating connection attempt.\n");
if ((server = afp_server_full_connect(NULL, conn_req)) == NULL) {
FREE(conn_req);
// FREE(server);
// FREE(server);
return -1;
}
//fprintf(stderr, "Connected to server: %s via UAM: %s\n", server->server_name_printable, uam_bitmap_to_string(server->using_uam));
// fprintf(stderr, "Connected to server: %s via UAM: %s\n",
// server->server_name_printable, uam_bitmap_to_string(server->using_uam));
FREE(conn_req);
FREE(server);
@@ -78,7 +77,7 @@ static int server_subconnect(struct afp_url url) {
return 0;
}
int start_afp(int s, char *ip, int port, unsigned char options, char *miscptr, FILE * fp) {
int32_t start_afp(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
char *empty = "";
char *login, *pass, mlogin[AFP_MAX_USERNAME_LEN], mpass[AFP_MAX_PASSWORD_LEN];
struct afp_url tmpurl;
@@ -89,7 +88,6 @@ int start_afp(int s, char *ip, int port, unsigned char options, char *miscptr, F
init_uams();
afp_default_url(&tmpurl);
if (strlen(login = hydra_get_next_login()) == 0)
login = empty;
if (strlen(pass = hydra_get_next_password()) == 0)
@@ -111,7 +109,6 @@ int start_afp(int s, char *ip, int port, unsigned char options, char *miscptr, F
return 3;
return 2;
} else {
hydra_completed_pair();
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return 2;
@@ -119,18 +116,17 @@ int start_afp(int s, char *ip, int port, unsigned char options, char *miscptr, F
return 1;
}
void service_afp(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int run = 1, next_run = 1, sock = -1;
int myport = PORT_AFP;
void service_afp(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
int32_t run = 1, next_run = 1, sock = -1;
int32_t myport = PORT_AFP;
hydra_register_socket(sp);
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return;
while (1) {
switch (run) {
case 1: /* connect and service init function */
case 1: /* connect and service init function */
if (sock >= 0)
sock = hydra_disconnect(sock);
if ((options & OPTION_SSL) == 0) {
@@ -140,7 +136,8 @@ void service_afp(char *ip, int sp, unsigned char options, char *miscptr, FILE *
port = myport;
}
if (sock < 0) {
if (quiet != 1) fprintf(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int) getpid());
if (quiet != 1)
fprintf(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
hydra_child_exit(1);
}
@@ -150,7 +147,7 @@ void service_afp(char *ip, int sp, unsigned char options, char *miscptr, FILE *
case 2:
/*
* Here we start the password cracking process
* Here we start the password cracking process
*/
next_run = start_afp(sock, ip, port, options, miscptr, fp);
@@ -173,13 +170,13 @@ void service_afp(char *ip, int sp, unsigned char options, char *miscptr, FILE *
#endif
int service_afp_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int32_t service_afp_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
//
// fill if needed.
//
//
// return codes:
// 0 all OK
// -1 error, hydra will exit, so print a good error message here
+26 -20
View File
@@ -1,17 +1,16 @@
//This plugin was written by david@
// This plugin was written by david@
//
//This plugin is written for Asterisk Call Manager
//which is running by default on TCP/5038
// This plugin is written for Asterisk Call Manager
// which is running by default on TCP/5038
//
#include "hydra-mod.h"
extern char *HYDRA_EXIT;
char *buf;
int start_asterisk(int s, char *ip, int port, unsigned char options, char *miscptr, FILE * fp) {
int32_t start_asterisk(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
char *empty = "\"\"";
char *login, *pass, buffer[1024];
@@ -41,7 +40,10 @@ int start_asterisk(int s, char *ip, int port, unsigned char options, char *miscp
hydra_report(stderr, "[DEBUG] S: %s\n", buf);
if (buf == NULL || (strstr(buf, "Response: ") == NULL)) {
hydra_report(stderr, "[ERROR] Asterisk Call Manager protocol error or service shutdown: %s\n", buf);
hydra_report(stderr,
"[ERROR] Asterisk Call Manager protocol error or service "
"shutdown: %s\n",
buf);
free(buf);
return 4;
}
@@ -62,19 +64,19 @@ int start_asterisk(int s, char *ip, int port, unsigned char options, char *miscp
return 2;
}
void service_asterisk(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int run = 1, next_run = 1, sock = -1;
int myport = PORT_ASTERISK, mysslport = PORT_ASTERISK_SSL;
void service_asterisk(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
int32_t run = 1, next_run = 1, sock = -1;
int32_t myport = PORT_ASTERISK, mysslport = PORT_ASTERISK_SSL;
hydra_register_socket(sp);
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return;
while (1) {
switch (run) {
case 1: /* connect and service init function */
case 1: /* connect and service init function */
if (sock >= 0)
sock = hydra_disconnect(sock);
// sleepn(300);
// usleepn(300);
if ((options & OPTION_SSL) == 0) {
if (port != 0)
myport = port;
@@ -89,31 +91,35 @@ void service_asterisk(char *ip, int sp, unsigned char options, char *miscptr, FI
if (sock < 0) {
if (verbose || debug)
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int) getpid());
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
hydra_child_exit(1);
}
buf = hydra_receive_line(sock);
//fprintf(stderr, "%s\n",buf);
//banner should look like:
//Asterisk Call Manager/1.1
// fprintf(stderr, "%s\n",buf);
// banner should look like:
// Asterisk Call Manager/1.1
if (buf == NULL || strstr(buf, "Asterisk Call Manager/") == NULL) {
/* check the first line */
if (verbose || debug)
hydra_report(stderr, "[ERROR] Not an Asterisk Call Manager protocol or service shutdown: %s\n", buf);
hydra_report(stderr,
"[ERROR] Not an Asterisk Call Manager protocol or "
"service shutdown: %s\n",
buf);
hydra_child_exit(2);
}
free(buf);
next_run = 2;
break;
case 2: /* run the cracking function */
case 2: /* run the cracking function */
next_run = start_asterisk(sock, ip, port, options, miscptr, fp);
break;
case 3: /* clean exit */
case 3: /* clean exit */
if (sock >= 0)
sock = hydra_disconnect(sock);
hydra_child_exit(0);
break;
default:
hydra_report(stderr, "[ERROR] Caught unknown return code, exiting!\n");
hydra_child_exit(2);
@@ -122,13 +128,13 @@ void service_asterisk(char *ip, int sp, unsigned char options, char *miscptr, FI
}
}
int service_asterisk_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int32_t service_asterisk_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
//
// fill if needed.
//
//
// return codes:
// 0 all OK
// -1 error, hydra will exit, so print a good error message here
+130 -104
View File
@@ -3,7 +3,7 @@
extern char *HYDRA_EXIT;
char *buf;
int start_cisco_enable(int s, char *ip, int port, unsigned char options, char *miscptr, FILE * fp) {
int32_t start_cisco_enable(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
char *empty = "";
char *pass, buffer[300];
@@ -42,8 +42,7 @@ int start_cisco_enable(int s, char *ip, int port, unsigned char options, char *m
}
}
if (buf != NULL
&& (strstr(buf, "assw") != NULL || strstr(buf, "ad ") != NULL || strstr(buf, "attempt") != NULL || strstr(buf, "fail") != NULL || strstr(buf, "denied") != NULL)) {
if (buf != NULL && (strstr(buf, "assw") != NULL || strstr(buf, "ad ") != NULL || strstr(buf, "attempt") != NULL || strstr(buf, "fail") != NULL || strstr(buf, "denied") != NULL)) {
free(buf);
hydra_completed_pair();
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
@@ -58,9 +57,9 @@ int start_cisco_enable(int s, char *ip, int port, unsigned char options, char *m
return 3;
}
void service_cisco_enable(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int run = 1, failc = 0, retry = 1, next_run = 1, sock = -1;
int myport = PORT_TELNET, mysslport = PORT_TELNET_SSL;
void service_cisco_enable(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
int32_t run = 1, failc = 0, retry = 1, next_run = 1, sock = -1;
int32_t myport = PORT_TELNET, mysslport = PORT_TELNET_SSL;
char buffer[300];
char *login;
@@ -70,117 +69,130 @@ void service_cisco_enable(char *ip, int sp, unsigned char options, char *miscptr
while (1) {
next_run = 0;
switch (run) {
case 1: /* connect and service init function */
{
if (sock >= 0)
sock = hydra_disconnect(sock);
// sleepn(275);
if ((options & OPTION_SSL) == 0) {
if (port != 0)
myport = port;
sock = hydra_connect_tcp(ip, myport);
port = myport;
} else {
if (port != 0)
mysslport = port;
sock = hydra_connect_ssl(ip, mysslport, hostname);
port = mysslport;
}
if (sock < 0) {
if (quiet != 1) fprintf(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int) getpid());
hydra_child_exit(1);
case 1: /* connect and service init function */
{
if (sock >= 0)
sock = hydra_disconnect(sock);
// usleepn(275);
if ((options & OPTION_SSL) == 0) {
if (port != 0)
myport = port;
sock = hydra_connect_tcp(ip, myport);
port = myport;
} else {
if (port != 0)
mysslport = port;
sock = hydra_connect_ssl(ip, mysslport, hostname);
port = mysslport;
}
if (sock < 0) {
if (quiet != 1)
fprintf(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
hydra_child_exit(1);
}
/* Cisco AAA Support */
if (strlen(login = hydra_get_next_login()) != 0) {
while ((buf = hydra_receive_line(sock)) != NULL && strstr(buf, "name:") == NULL && strstr(buf, "ogin:") == NULL) {
if (hydra_strcasestr(buf, "ress ENTER") != NULL)
hydra_send(sock, "\r\n", 2, 0);
free(buf);
}
/* Cisco AAA Support */
if (strlen(login = hydra_get_next_login()) != 0) {
while ((buf = hydra_receive_line(sock)) != NULL && strstr(buf, "name:") == NULL && strstr(buf, "ogin:") == NULL) {
if (hydra_strcasestr(buf, "ress ENTER") != NULL)
hydra_send(sock, "\r\n", 2, 0);
free(buf);
}
sprintf(buffer, "%.250s\r\n", login);
if (hydra_send(sock, buffer, strlen(buffer), 0) < 0) {
if (quiet != 1) fprintf(stderr, "[ERROR] Child with pid %d terminating, can not send login\n", (int) getpid());
hydra_child_exit(2);
}
}
if (miscptr != NULL) {
if (buf != NULL)
free(buf);
while ((buf = hydra_receive_line(sock)) != NULL && strstr(buf, "assw") == NULL) {
if (hydra_strcasestr(buf, "ress ENTER") != NULL)
hydra_send(sock, "\r\n", 2, 0);
free(buf);
}
sprintf(buffer, "%.250s\r\n", miscptr);
if (hydra_send(sock, buffer, strlen(buffer), 0) < 0) {
if (quiet != 1) fprintf(stderr, "[ERROR] Child with pid %d terminating, can not send login\n", (int) getpid());
hydra_child_exit(2);
}
sprintf(buffer, "%.250s\r\n", login);
if (hydra_send(sock, buffer, strlen(buffer), 0) < 0) {
if (quiet != 1)
fprintf(stderr, "[ERROR] Child with pid %d terminating, can not send login\n", (int32_t)getpid());
hydra_child_exit(2);
}
}
if (miscptr != NULL) {
if (buf != NULL)
free(buf);
buf = hydra_receive_line(sock);
if (hydra_strcasestr(buf, "ress ENTER") != NULL) {
hydra_send(sock, "\r\n", 2, 0);
while ((buf = hydra_receive_line(sock)) != NULL && strstr(buf, "assw") == NULL) {
if (hydra_strcasestr(buf, "ress ENTER") != NULL)
hydra_send(sock, "\r\n", 2, 0);
free(buf);
buf = hydra_receive_line(sock);
}
if (strstr(buf, "assw") != NULL) {
if (quiet != 1) fprintf(stderr, "[ERROR] Child with pid %d terminating - can not login, can not login\n", (int) getpid());
hydra_child_exit(2);
}
free(buf);
next_run = 2;
break;
}
case 2: /* run the cracking function */
{
unsigned char *buf2;
int f = 0;
sprintf(buffer, "%.250s\r\n", "ena");
sprintf(buffer, "%.250s\r\n", miscptr);
if (hydra_send(sock, buffer, strlen(buffer), 0) < 0) {
if (quiet != 1) fprintf(stderr, "[ERROR] Child with pid %d terminating, can not send 'ena'\n", (int) getpid());
if (quiet != 1)
fprintf(stderr, "[ERROR] Child with pid %d terminating, can not send login\n", (int32_t)getpid());
hydra_child_exit(2);
}
do {
if (f != 0)
free(buf2);
else
f = 1;
if ((buf2 = (unsigned char *) hydra_receive_line(sock)) == NULL) {
if (failc < retry) {
next_run = 1;
failc++;
if (quiet != 1) fprintf(stderr, "[ERROR] Child with pid %d was disconnected - retrying (%d of %d retries)\n", (int) getpid(), failc, retry);
sleep(3);
break;
} else {
fprintf(stderr, "[ERROR] Child with pid %d was disconnected - exiting\n", (int) getpid());
hydra_child_exit(0);
}
}
} while (strstr((char *) buf2, "assw") == NULL);
free(buf2);
if (next_run != 0)
break;
failc = 0;
next_run = start_cisco_enable(sock, ip, port, options, miscptr, fp);
break;
}
case 3: /* clean exit */
if (buf != NULL)
free(buf);
buf = hydra_receive_line(sock);
if (hydra_strcasestr(buf, "ress ENTER") != NULL) {
hydra_send(sock, "\r\n", 2, 0);
free(buf);
buf = hydra_receive_line(sock);
}
if (strstr(buf, "assw") != NULL) {
if (quiet != 1)
fprintf(stderr,
"[ERROR] Child with pid %d terminating - can not login, can "
"not login\n",
(int32_t)getpid());
hydra_child_exit(2);
}
free(buf);
next_run = 2;
break;
}
case 2: /* run the cracking function */
{
unsigned char *buf2;
int32_t f = 0;
sprintf(buffer, "%.250s\r\n", "ena");
if (hydra_send(sock, buffer, strlen(buffer), 0) < 0) {
if (quiet != 1)
fprintf(stderr, "[ERROR] Child with pid %d terminating, can not send 'ena'\n", (int32_t)getpid());
hydra_child_exit(2);
}
do {
if (f != 0)
free(buf2);
else
f = 1;
if ((buf2 = (unsigned char *)hydra_receive_line(sock)) == NULL) {
if (failc < retry) {
next_run = 1;
failc++;
if (quiet != 1)
fprintf(stderr,
"[ERROR] Child with pid %d was disconnected - retrying "
"(%d of %d retries)\n",
(int32_t)getpid(), failc, retry);
sleep(3);
break;
} else {
fprintf(stderr, "[ERROR] Child with pid %d was disconnected - exiting\n", (int32_t)getpid());
hydra_child_exit(0);
}
}
} while (strstr((char *)buf2, "assw") == NULL);
free(buf2);
if (next_run != 0)
break;
failc = 0;
next_run = start_cisco_enable(sock, ip, port, options, miscptr, fp);
break;
}
case 3: /* clean exit */
sprintf(buffer, "%.250s\r\n", "exit");
if (hydra_send(sock, buffer, strlen(buffer), 0) < 0) {
if (quiet != 1) fprintf(stderr, "[ERROR] Child with pid %d terminating, can not send 'exit'\n", (int) getpid());
if (quiet != 1)
fprintf(stderr, "[ERROR] Child with pid %d terminating, can not send 'exit'\n", (int32_t)getpid());
hydra_child_exit(0);
}
if (sock >= 0)
@@ -196,16 +208,30 @@ void service_cisco_enable(char *ip, int sp, unsigned char options, char *miscptr
}
}
int service_cisco_enable_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int32_t service_cisco_enable_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
//
// fill if needed.
//
//
// return codes:
// 0 all OK
// -1 error, hydra will exit, so print a good error message here
return 0;
}
void usage_cisco_enable(const char *service) {
printf("Module cisco-enable is optionally taking the logon password for the "
"cisco device\n"
"Note: if AAA authentication is used, use the -l option for the "
"username\n"
"and the optional parameter for the password of the user.\n"
"Examples:\n"
" hydra -P pass.txt target cisco-enable (direct console access)\n"
" hydra -P pass.txt -m cisco target cisco-enable (Logon password "
"cisco)\n"
" hydra -l foo -m bar -P pass.txt target cisco-enable (AAA Login "
"foo, password bar)\n");
}
+72 -61
View File
@@ -5,9 +5,9 @@
#endif
extern char *HYDRA_EXIT;
char *buf = NULL;
static char *buf = NULL;
int start_cisco(int s, char *ip, int port, unsigned char options, char *miscptr, FILE * fp) {
int32_t start_cisco(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
char *empty = "";
char *pass, buffer[300];
@@ -52,7 +52,7 @@ int start_cisco(int s, char *ip, int port, unsigned char options, char *miscptr,
if (hydra_send(s, buffer, strlen(buffer), 0) < 0) {
return 1;
}
buf = NULL;
do {
if (buf != NULL)
@@ -95,7 +95,6 @@ int start_cisco(int s, char *ip, int port, unsigned char options, char *miscptr,
}
} while (buf != NULL && strlen(buf) <= 1);
}
}
if (buf != NULL && (strstr(buf, "assw") != NULL || strstr(buf, "ad ") != NULL || strstr(buf, "attempt") != NULL || strstr(buf, "ailur") != NULL)) {
@@ -115,9 +114,9 @@ int start_cisco(int s, char *ip, int port, unsigned char options, char *miscptr,
return 1;
}
void service_cisco(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int run = 1, failc = 0, retry = 1, next_run = 1, sock = -1;
int myport = PORT_TELNET, mysslport = PORT_TELNET_SSL;
void service_cisco(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
int32_t run = 1, failc = 0, retry = 1, next_run = 1, sock = -1;
int32_t myport = PORT_TELNET, mysslport = PORT_TELNET_SSL;
hydra_register_socket(sp);
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
@@ -125,62 +124,68 @@ void service_cisco(char *ip, int sp, unsigned char options, char *miscptr, FILE
while (1) {
next_run = 0;
switch (run) {
case 1: /* connect and service init function */
{
unsigned char *buf2;
int f = 0;
case 1: /* connect and service init function */
{
unsigned char *buf2 = NULL;
int32_t f = 0;
if (sock >= 0)
sock = hydra_disconnect(sock);
// sleepn(275);
if ((options & OPTION_SSL) == 0) {
if (port != 0)
myport = port;
sock = hydra_connect_tcp(ip, myport);
port = myport;
if (miscptr != NULL && hydra_strcasestr(miscptr, "enter") != NULL)
hydra_send(sock, "\r\n", 2, 0);
} else {
if (port != 0)
mysslport = port;
sock = hydra_connect_ssl(ip, mysslport, hostname);
port = mysslport;
}
if (sock < 0) {
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int) getpid());
hydra_child_exit(1);
}
do {
if (f != 0)
free(buf2);
else
f = 1;
if ((buf2 = (unsigned char *) hydra_receive_line(sock)) == NULL) {
if (failc < retry) {
next_run = 1;
failc++;
if (quiet != 1) hydra_report(stderr, "[ERROR] Child with pid %d was disconnected - retrying (%d of %d retries)\n", (int) getpid(), failc, retry);
sleep(3);
break;
} else {
if (quiet != 1) hydra_report(stderr, "[ERROR] Child with pid %d was disconnected - exiting\n", (int) getpid());
hydra_child_exit(0);
}
}
if (buf2 != NULL && hydra_strcasestr((char*)buf2, "ress ENTER") != NULL)
hydra_send(sock, "\r\n", 2, 0);
} while (strstr((char *) buf2, "assw") == NULL);
free(buf2);
if (next_run != 0)
break;
failc = 0;
next_run = 2;
break;
if (sock >= 0)
sock = hydra_disconnect(sock);
// usleepn(275);
if ((options & OPTION_SSL) == 0) {
if (port != 0)
myport = port;
sock = hydra_connect_tcp(ip, myport);
port = myport;
if (miscptr != NULL && hydra_strcasestr(miscptr, "enter") != NULL)
hydra_send(sock, "\r\n", 2, 0);
} else {
if (port != 0)
mysslport = port;
sock = hydra_connect_ssl(ip, mysslport, hostname);
port = mysslport;
}
case 2: /* run the cracking function */
if (sock < 0) {
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
hydra_child_exit(1);
}
do {
if (f != 0) {
free(buf2);
buf2 = NULL;
} else
f = 1;
if ((buf2 = (unsigned char *)hydra_receive_line(sock)) == NULL) {
if (failc < retry) {
next_run = 1;
failc++;
if (quiet != 1)
hydra_report(stderr,
"[ERROR] Child with pid %d was disconnected - "
"retrying (%d of %d retries)\n",
(int32_t)getpid(), failc, retry);
sleep(3);
break;
} else {
if (quiet != 1)
hydra_report(stderr, "[ERROR] Child with pid %d was disconnected - exiting\n", (int32_t)getpid());
hydra_child_exit(0);
}
}
if (buf2 != NULL && hydra_strcasestr((char *)buf2, "ress ENTER") != NULL)
hydra_send(sock, "\r\n", 2, 0);
} while (buf2 != NULL && strstr((char *)buf2, "assw") == NULL);
free(buf2);
if (next_run != 0)
break;
failc = 0;
next_run = 2;
break;
}
case 2: /* run the cracking function */
next_run = start_cisco(sock, ip, port, options, miscptr, fp);
break;
case 3: /* clean exit */
case 3: /* clean exit */
if (sock >= 0)
sock = hydra_disconnect(sock);
hydra_child_exit(0);
@@ -198,16 +203,22 @@ void service_cisco(char *ip, int sp, unsigned char options, char *miscptr, FILE
}
}
int service_cisco_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int32_t service_cisco_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
//
// fill if needed.
//
//
// return codes:
// 0 all OK
// -1 error, hydra will exit, so print a good error message here
return 0;
}
void usage_cisco(const char *service) {
printf("Module cisco is optionally taking the keyword ENTER, it then sends "
"an initial\n"
"ENTER when connecting to the service.\n");
}
+126
View File
@@ -0,0 +1,126 @@
#include "hydra-mod.h"
#define CSLEN 256
extern char *HYDRA_EXIT;
char *buf;
int32_t start_cobaltstrike(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
char *empty = "";
char *pass, buffer[4 + 1 + 256];
char cs_pass[CSLEN + 1];
unsigned char len_pass;
unsigned char reply_byte_0;
unsigned char reply_byte_1;
unsigned char reply_byte_2;
unsigned char reply_byte_3;
int32_t ret = -1;
if (strlen(pass = hydra_get_next_password()) == 0)
pass = empty;
if (strlen(pass) > CSLEN)
pass[CSLEN - 1] = 0;
len_pass = strlen(pass);
memset(cs_pass, 0, CSLEN + 1);
strcpy(cs_pass, pass);
memset(buffer, 0x41, sizeof(buffer));
buffer[0] = 0x00;
buffer[1] = 0x00;
buffer[2] = 0xBE;
buffer[3] = 0xEF;
memcpy(buffer + 4, &len_pass, 1);
memcpy(buffer + 5, cs_pass, len_pass);
if (hydra_send(s, buffer, sizeof(buffer), 0) < 0)
return 1;
reply_byte_0 = 0x00;
ret = hydra_recv_nb(s, &reply_byte_0, 1);
if (ret <= 0)
return 3;
reply_byte_1 = 0x00;
ret = hydra_recv_nb(s, &reply_byte_1, 1);
if (ret <= 0)
return 3;
reply_byte_2 = 0x00;
ret = hydra_recv_nb(s, &reply_byte_2, 1);
if (ret <= 0)
return 3;
reply_byte_3 = 0x00;
ret = hydra_recv_nb(s, &reply_byte_3, 1);
if (ret <= 0)
return 3;
if (reply_byte_0 == 0x00 && reply_byte_1 == 0x00 && reply_byte_2 == 0xCA && reply_byte_3 == 0xFE) {
hydra_report_found_host(port, ip, "cobaltstrike", fp);
hydra_completed_pair_found();
free(buf);
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return 2;
return 1;
}
free(buf);
hydra_completed_pair();
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return 2;
return 1;
}
void service_cobaltstrike(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
int32_t run = 1, next_run = 1, sock = -1;
int32_t mysslport = PORT_COBALTSTRIKE_SSL;
hydra_register_socket(sp);
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return;
while (1) {
switch (run) {
case 1: /* connect and service init function */
if (port != 0)
mysslport = port;
sock = hydra_connect_ssl(ip, mysslport, hostname);
port = mysslport;
if (sock < 0) {
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
hydra_child_exit(1);
}
next_run = start_cobaltstrike(sock, ip, port, options, miscptr, fp);
hydra_disconnect(sock);
break;
case 2: /* clean exit */
if (sock >= 0)
sock = hydra_disconnect(sock);
hydra_child_exit(0);
return;
case 3: /* clean exit */
if (sock >= 0)
sock = hydra_disconnect(sock);
hydra_child_exit(2);
return;
default:
hydra_report(stderr, "[ERROR] Caught unknown return code, exiting!\n");
hydra_child_exit(2);
}
run = next_run;
}
}
int32_t service_cobaltstrike_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
//
// fill if needed.
//
// return codes:
// 0 all OK
// -1 error, hydra will exit, so print a good error message here
return 0;
}
+37 -38
View File
@@ -1,42 +1,36 @@
#include "hydra-mod.h"
extern int hydra_data_ready_timed(int socket, long sec, long usec);
extern int32_t hydra_data_ready_timed(int32_t socket, long sec, long usec);
extern char *HYDRA_EXIT;
char *buf;
int start_cvs(int s, char *ip, int port, unsigned char options, char *miscptr, FILE * fp) {
int32_t start_cvs(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
char *empty = "";
char *login, *pass, buffer[1024], pass2[513];
int i;
int32_t i;
char *directory = miscptr;
/* evil cvs encryption sheme...
0 111 P 125 p 58
! 120 1 52 A 57 Q 55 a 121 q 113
" 53 2 75 B 83 R 54 b 117 r 32
3 119 C 43 S 66 c 104 s 90
4 49 D 46 T 124 d 101 t 44
% 109 5 34 E 102 U 126 e 100 u 98
& 72 6 82 F 40 V 59 f 69 v 60
' 108 7 81 G 89 W 47 g 73 w 51
( 70 8 95 H 38 X 92 h 99 x 33
) 64 9 65 I 103 Y 71 i 63 y 97
* 76 : 112 J 45 Z 115 j 94 z 62
+ 67 ; 86 K 50 k 93
, 116 < 118 L 42 l 39
- 74 = 110 M 123 m 37
. 68 > 122 N 91 n 61
/ 87 ? 105 O 35 _ 56 o 48
*/
/* evil cvs encryption sheme...
0 111 P 125 p 58
! 120 1 52 A 57 Q 55 a 121 q 113
" 53 2 75 B 83 R 54 b 117 r 32
3 119 C 43 S 66 c 104 s 90
4 49 D 46 T 124 d 101 t 44
% 109 5 34 E 102 U 126 e 100 u 98
& 72 6 82 F 40 V 59 f 69 v 60
' 108 7 81 G 89 W 47 g 73 w 51
( 70 8 95 H 38 X 92 h 99 x 33
) 64 9 65 I 103 Y 71 i 63 y 97
* 76 : 112 J 45 Z 115 j 94 z 62
+ 67 ; 86 K 50 k 93
, 116 < 118 L 42 l 39
- 74 = 110 M 123 m 37
. 68 > 122 N 91 n 61
/ 87 ? 105 O 35 _ 56 o 48
*/
char key[] = { 0, 120, 53, 0, 0, 109, 72, 108, 70, 64, 76, 67, 116, 74, 68, 87,
111, 52, 75, 119, 49, 34, 82, 81, 95, 65, 112, 86, 118, 110, 122, 105,
0, 57, 83, 43, 46, 102, 40, 89, 38, 103, 45, 50, 42, 123, 91, 35,
125, 55, 54, 66, 124, 126, 59, 47, 92, 71, 115, 0, 0, 0, 0, 56,
0, 121, 117, 104, 101, 100, 69, 73, 99, 63, 94, 93, 39, 37, 61, 48,
58, 113, 32, 90, 44, 98, 60, 51, 33, 97, 62
};
char key[] = {0, 120, 53, 0, 0, 109, 72, 108, 70, 64, 76, 67, 116, 74, 68, 87, 111, 52, 75, 119, 49, 34, 82, 81, 95, 65, 112, 86, 118, 110, 122, 105, 0, 57, 83, 43, 46, 102, 40, 89, 38, 103, 45, 50, 42, 123, 91, 35, 125, 55, 54, 66, 124, 126, 59, 47, 92, 71, 115, 0, 0, 0, 0, 56, 0, 121, 117, 104, 101, 100, 69, 73, 99, 63, 94, 93, 39, 37, 61, 48, 58, 113, 32, 90, 44, 98, 60, 51, 33, 97, 62};
if (strlen(login = hydra_get_next_login()) == 0)
login = empty;
@@ -69,7 +63,7 @@ int start_cvs(int s, char *ip, int port, unsigned char options, char *miscptr, F
}
} else if (strstr(buf, "no such user") || strstr(buf, "E PAM start error: Critical error - immediate abort\n")) {
if (verbose) {
hydra_report(stderr, "[VERBOSE] User %s does not exist\n", login);
hydra_report(stderr, "[INFO] User %s does not exist, skipping\n", login);
}
hydra_completed_pair_skip();
free(buf);
@@ -85,9 +79,9 @@ int start_cvs(int s, char *ip, int port, unsigned char options, char *miscptr, F
return 3;
}
void service_cvs(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int run = 1, next_run = 1, sock = -1;
int myport = PORT_CVS, mysslport = PORT_CVS_SSL;
void service_cvs(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
int32_t run = 1, next_run = 1, sock = -1;
int32_t myport = PORT_CVS, mysslport = PORT_CVS_SSL;
hydra_register_socket(sp);
@@ -100,11 +94,11 @@ void service_cvs(char *ip, int sp, unsigned char options, char *miscptr, FILE *
return;
switch (run) {
case 1: /* connect and service init function */
case 1: /* connect and service init function */
if (sock >= 0)
sock = hydra_disconnect(sock);
// sleepn(300);
// usleepn(300);
if ((options & OPTION_SSL) == 0) {
if (port != 0)
myport = port;
@@ -118,12 +112,12 @@ void service_cvs(char *ip, int sp, unsigned char options, char *miscptr, FILE *
}
if (sock < 0) {
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int) getpid());
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
hydra_child_exit(1);
}
next_run = start_cvs(sock, ip, port, options, miscptr, fp);
break;
case 3: /* clean exit */
case 3: /* clean exit */
if (sock >= 0)
sock = hydra_disconnect(sock);
hydra_child_exit(2);
@@ -136,16 +130,21 @@ void service_cvs(char *ip, int sp, unsigned char options, char *miscptr, FILE *
}
}
int service_cvs_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int32_t service_cvs_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
//
// fill if needed.
//
//
// return codes:
// 0 all OK
// -1 error, hydra will exit, so print a good error message here
return 0;
}
void usage_cvs(const char *service) {
printf("Module cvs is optionally taking the repository name to attack, "
"default is \"/root\"\n\n");
}
+24 -21
View File
@@ -1,8 +1,7 @@
/*
Firebird Support - by David Maciejak @ GMAIL dot com
you need to pass full path to the fdb file as argument
default account is SYSDBA/masterkey
@@ -15,28 +14,26 @@ the msg: "no permission for direct access to security database"
#include "hydra-mod.h"
#ifndef LIBFIREBIRD
void dummy_firebird() {
printf("\n");
}
void dummy_firebird() { printf("\n"); }
#else
#include <stdio.h>
#include <ibase.h>
#include <stdio.h>
#define DEFAULT_DB "C:\\Program Files\\Firebird\\Firebird_1_5\\security.fdb"
extern char *HYDRA_EXIT;
int start_firebird(int s, char *ip, int port, unsigned char options, char *miscptr, FILE * fp) {
int32_t start_firebird(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
char *empty = "";
char *login, *pass;
char database[256];
char connection_string[1024];
isc_db_handle db; /* database handle */
ISC_STATUS_ARRAY status; /* status vector */
isc_db_handle db; /* database handle */
ISC_STATUS_ARRAY status; /* status vector */
char *dpb = NULL; /* DB parameter buffer */
char *dpb = NULL; /* DB parameter buffer */
short dpb_length = 0;
if (miscptr)
@@ -50,8 +47,8 @@ int start_firebird(int s, char *ip, int port, unsigned char options, char *miscp
if (strlen(pass = hydra_get_next_password()) == 0)
pass = empty;
dpb_length = (short) (1 + strlen(login) + 2 + strlen(pass) + 2);
if ((dpb = (char *) malloc(dpb_length)) == NULL) {
dpb_length = (short)(1 + strlen(login) + 2 + strlen(pass) + 2);
if ((dpb = (char *)malloc(dpb_length)) == NULL) {
hydra_report(stderr, "[ERROR] Can't allocate memory\n");
return 1;
}
@@ -87,18 +84,17 @@ int start_firebird(int s, char *ip, int port, unsigned char options, char *miscp
return 1;
}
void service_firebird(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int run = 1, next_run = 1, sock = -1;
int myport = PORT_FIREBIRD, mysslport = PORT_FIREBIRD_SSL;
void service_firebird(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
int32_t run = 1, next_run = 1, sock = -1;
int32_t myport = PORT_FIREBIRD, mysslport = PORT_FIREBIRD_SSL;
hydra_register_socket(sp);
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return;
while (1) {
switch (run) {
case 1: /* connect and service init function */
case 1: /* connect and service init function */
if (sock >= 0)
sock = hydra_disconnect(sock);
if ((options & OPTION_SSL) == 0) {
@@ -113,7 +109,8 @@ void service_firebird(char *ip, int sp, unsigned char options, char *miscptr, FI
port = mysslport;
}
if (sock < 0) {
if (quiet != 1) fprintf(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int) getpid());
if (quiet != 1)
fprintf(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
hydra_child_exit(1);
}
@@ -123,7 +120,7 @@ void service_firebird(char *ip, int sp, unsigned char options, char *miscptr, FI
case 2:
/*
* Here we start the password cracking process
* Here we start the password cracking process
*/
next_run = start_firebird(sock, ip, port, options, miscptr, fp);
@@ -146,16 +143,22 @@ void service_firebird(char *ip, int sp, unsigned char options, char *miscptr, FI
#endif
int service_firebird_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int32_t service_firebird_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
//
// fill if needed.
//
//
// return codes:
// 0 all OK
// -1 error, hydra will exit, so print a good error message here
return 0;
}
void usage_firebird(const char *service) {
printf("Module firebird is optionally taking the database path to attack,\n"
"default is \"C:\\Program "
"Files\\Firebird\\Firebird_1_5\\security.fdb\"\n\n");
}
+22 -21
View File
@@ -3,7 +3,7 @@
extern char *HYDRA_EXIT;
char *buf;
int start_ftp(int s, char *ip, int port, unsigned char options, char *miscptr, FILE * fp) {
int32_t start_ftp(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
char *empty = "\"\"";
char *login, *pass, buffer[510];
@@ -20,8 +20,11 @@ int start_ftp(int s, char *ip, int port, unsigned char options, char *miscptr, F
buf = hydra_receive_line(s);
if (buf == NULL)
return 1;
/* special hack to identify 530 user unknown msg. suggested by Jean-Baptiste.BEAUFRETON@turbomeca.fr */
/* special hack to identify 530 user unknown msg. suggested by
* Jean-Baptiste.BEAUFRETON@turbomeca.fr */
if (buf[0] == '5' && buf[1] == '3' && buf[2] == '0') {
if (verbose)
printf("[INFO] user %s does not exist, skipping\n", login);
hydra_completed_pair_skip();
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return 4;
@@ -72,19 +75,19 @@ int start_ftp(int s, char *ip, int port, unsigned char options, char *miscptr, F
return 2;
}
void service_ftp_core(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname, int tls) {
int run = 1, next_run = 1, sock = -1;
int myport = PORT_FTP, mysslport = PORT_FTP_SSL;
void service_ftp_core(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname, int32_t tls) {
int32_t run = 1, next_run = 1, sock = -1;
int32_t myport = PORT_FTP, mysslport = PORT_FTP_SSL;
hydra_register_socket(sp);
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
hydra_child_exit(0);
while (1) {
switch (run) {
case 1: /* connect and service init function */
case 1: /* connect and service init function */
if (sock >= 0)
sock = hydra_disconnect(sock);
// sleepn(300);
// usleepn(300);
if ((options & OPTION_SSL) == 0) {
if (port != 0)
myport = port;
@@ -98,12 +101,12 @@ void service_ftp_core(char *ip, int sp, unsigned char options, char *miscptr, FI
}
if (sock < 0) {
if (verbose || debug)
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int) getpid());
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
hydra_child_exit(1);
}
usleepn(250);
buf = hydra_receive_line(sock);
if (buf == NULL || buf[0] != '2') { /* check the first line */
if (buf == NULL || buf[0] != '2') { /* check the first line */
if (verbose || debug)
hydra_report(stderr, "[ERROR] Not an FTP protocol or service shutdown: %s\n", buf);
hydra_child_exit(2);
@@ -118,7 +121,7 @@ void service_ftp_core(char *ip, int sp, unsigned char options, char *miscptr, FI
}
free(buf);
//this mode is manually chosen, so if it fails we giving up
// this mode is manually chosen, so if it fails we giving up
if (tls) {
if (hydra_send(sock, "AUTH TLS\r\n", strlen("AUTH TLS\r\n"), 0) < 0) {
hydra_child_exit(2);
@@ -146,17 +149,19 @@ void service_ftp_core(char *ip, int sp, unsigned char options, char *miscptr, FI
next_run = 2;
break;
case 2: /* run the cracking function */
case 2: /* run the cracking function */
next_run = start_ftp(sock, ip, port, options, miscptr, fp);
break;
case 3: /* error exit */
case 3: /* error exit */
if (sock >= 0)
sock = hydra_disconnect(sock);
hydra_child_exit(2);
case 4: /* clean exit */
break;
case 4: /* clean exit */
if (sock >= 0)
sock = hydra_disconnect(sock);
hydra_child_exit(0);
break;
default:
hydra_report(stderr, "[ERROR] Caught unknown return code, exiting!\n");
hydra_child_exit(2);
@@ -165,21 +170,17 @@ void service_ftp_core(char *ip, int sp, unsigned char options, char *miscptr, FI
}
}
void service_ftp(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
service_ftp_core(ip, sp, options, miscptr, fp, port, hostname, 0);
}
void service_ftp(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) { service_ftp_core(ip, sp, options, miscptr, fp, port, hostname, 0); }
void service_ftps(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
service_ftp_core(ip, sp, options, miscptr, fp, port, hostname, 1);
}
void service_ftps(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) { service_ftp_core(ip, sp, options, miscptr, fp, port, hostname, 1); }
int service_ftp_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int32_t service_ftp_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
//
// fill if needed.
//
//
// return codes:
// 0 all OK
// -1 error, hydra will exit, so print a good error message here
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
+3 -2
View File
@@ -61,8 +61,9 @@ CC = @CC@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
PACKAGE = @PACKAGE@
PACKAGE_CFLAGS = @PACKAGE_CFLAGS@
PACKAGE_LIBS = @PACKAGE_LIBS@
PACKAGE_CFLAGS = @PACKAGE_CFLAGS@ -fcommon -Wl,--allow-multiple-definition
PACKAGE_LDFLAGS = -fcommon -Wl,--allow-multiple-definition
PACKAGE_LIBS = -fcommon -Wl,--allow-multiple-definition @PACKAGE_LIBS@
PKG_CONFIG = @PKG_CONFIG@
VERSION = @VERSION@
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Vendored Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
+4 -4
View File
@@ -2233,15 +2233,15 @@ if test "$ac_test_CFLAGS" = set; then
CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
if test "$GCC" = yes; then
CFLAGS="-g -O2"
CFLAGS="-g -O2 -fcommon -Wl,--allow-multiple-definition"
else
CFLAGS="-g"
CFLAGS="-g -fcommon -Wl,--allow-multiple-definition"
fi
else
if test "$GCC" = yes; then
CFLAGS="-O2"
CFLAGS="-O2 -fcommon -Wl,--allow-multiple-definition"
else
CFLAGS=
CFLAGS="-fcommon -Wl,--allow-multiple-definition"
fi
fi
echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/bash
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/opt/gnome/lib/pkgconfig
export PKG_CONFIG_PATH
echo "Trying to compile xhydra now (hydra gtk gui) - dont worry if this fails, this is really optional ..."
echo "Trying to compile xhydra now (hydra gtk gui) - don't worry if this fails, this is really optional ..."
./configure > /dev/null 2> errors
test -e Makefile || {
echo "Error: configure wasnt happy. Analyse this:"
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
+2 -2
View File
@@ -61,8 +61,8 @@ CC = @CC@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
PACKAGE = @PACKAGE@
PACKAGE_CFLAGS = @PACKAGE_CFLAGS@
PACKAGE_LIBS = @PACKAGE_LIBS@
PACKAGE_CFLAGS = @PACKAGE_CFLAGS@ -fcommon -Wl,--allow-multiple-definition
PACKAGE_LIBS = -fcommon -Wl,--allow-multiple-definition @PACKAGE_LIBS@
PKG_CONFIG = @PKG_CONFIG@
VERSION = @VERSION@
Executable → Regular
+123 -128
View File
@@ -1,7 +1,7 @@
/*
* This file handles all that needs to be done...
* Some stuff is stolen from gcombust since I never used pipes... ok, i
* Some stuff is stolen from gcombust since I never used pipes... ok, i
* only used them in reallife :)
*/
@@ -15,38 +15,35 @@
#include "interface.h"
#include "support.h"
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <fcntl.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
int hydra_pid = 0;
char port[10];
char tasks[10];
char timeout[10];
char smbparm[12];
char smbparm[128];
char sapr3id[4];
char passLoginNull[4];
#define BUF_S 1024
void hydra_select_file(GtkEntry * widget, char *text) {
void hydra_select_file(GtkEntry *widget, char *text) {
#ifdef GTK_TYPE_FILE_CHOOSER
GtkWidget *dialog;
char *filename;
dialog = gtk_file_chooser_dialog_new(text, (GtkWindow *) wndMain, GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL);
dialog = gtk_file_chooser_dialog_new(text, (GtkWindow *)wndMain, GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL);
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
@@ -70,7 +67,7 @@ int hydra_get_options(char *options[]) {
/* get the port */
widget = lookup_widget(GTK_WIDGET(wndMain), "spnPort");
j = gtk_spin_button_get_value_as_int((GtkSpinButton *) widget);
j = gtk_spin_button_get_value_as_int((GtkSpinButton *)widget);
if (j != 0) {
snprintf(port, 10, "%d", j);
options[i++] = "-s";
@@ -79,107 +76,107 @@ int hydra_get_options(char *options[]) {
/* prefer ipv6 */
widget = lookup_widget(GTK_WIDGET(wndMain), "chkIPV6");
if (gtk_toggle_button_get_active((GtkToggleButton *) widget)) {
if (gtk_toggle_button_get_active((GtkToggleButton *)widget)) {
options[i++] = "-6";
}
/* use SSL? */
widget = lookup_widget(GTK_WIDGET(wndMain), "chkSSL");
if (gtk_toggle_button_get_active((GtkToggleButton *) widget)) {
if (gtk_toggle_button_get_active((GtkToggleButton *)widget)) {
options[i++] = "-S";
}
/* use old SSL? */
widget = lookup_widget(GTK_WIDGET(wndMain), "chkOldSSL");
if (gtk_toggle_button_get_active((GtkToggleButton *) widget)) {
if (gtk_toggle_button_get_active((GtkToggleButton *)widget)) {
options[i++] = "-O";
}
/* be verbose? */
widget = lookup_widget(GTK_WIDGET(wndMain), "chkVerbose");
if (gtk_toggle_button_get_active((GtkToggleButton *) widget)) {
if (gtk_toggle_button_get_active((GtkToggleButton *)widget)) {
options[i++] = "-v";
}
/* show attempts */
widget = lookup_widget(GTK_WIDGET(wndMain), "chkAttempts");
if (gtk_toggle_button_get_active((GtkToggleButton *) widget)) {
if (gtk_toggle_button_get_active((GtkToggleButton *)widget)) {
options[i++] = "-V";
}
/* debug mode? */
widget = lookup_widget(GTK_WIDGET(wndMain), "chkDebug");
if (gtk_toggle_button_get_active((GtkToggleButton *) widget)) {
if (gtk_toggle_button_get_active((GtkToggleButton *)widget)) {
options[i++] = "-d";
}
/* COMPLETE HELP */
widget = lookup_widget(GTK_WIDGET(wndMain), "chkCompleteHelp");
if (gtk_toggle_button_get_active((GtkToggleButton *) widget)) {
if (gtk_toggle_button_get_active((GtkToggleButton *)widget)) {
options[i++] = "-h";
}
/* Service Module Usage Details */
widget = lookup_widget(GTK_WIDGET(wndMain), "chkServiceDetails");
if (gtk_toggle_button_get_active((GtkToggleButton *) widget)) {
if (gtk_toggle_button_get_active((GtkToggleButton *)widget)) {
options[i++] = "-U";
}
/* use colon separated list? */
widget = lookup_widget(GTK_WIDGET(wndMain), "chkColon");
if (gtk_toggle_button_get_active((GtkToggleButton *) widget)) {
if (gtk_toggle_button_get_active((GtkToggleButton *)widget)) {
options[i++] = "-C";
widget = lookup_widget(GTK_WIDGET(wndMain), "entColonFile");
options[i++] = (char *) gtk_entry_get_text((GtkEntry *) widget);
options[i++] = (char *)gtk_entry_get_text((GtkEntry *)widget);
} else {
/* disable usernames */
widget = lookup_widget(GTK_WIDGET(wndMain), "chkDisUser");
if (gtk_toggle_button_get_active((GtkToggleButton *) widget)) {
if (gtk_toggle_button_get_active((GtkToggleButton *)widget)) {
} else {
/* get the username, or username list */
widget = lookup_widget(GTK_WIDGET(wndMain), "radioUsername1");
if (gtk_toggle_button_get_active((GtkToggleButton *) widget)) {
if (gtk_toggle_button_get_active((GtkToggleButton *)widget)) {
options[i++] = "-l";
widget = lookup_widget(GTK_WIDGET(wndMain), "entUsername");
options[i++] = (char *) gtk_entry_get_text((GtkEntry *) widget);
options[i++] = (char *)gtk_entry_get_text((GtkEntry *)widget);
} else {
options[i++] = "-L";
widget = lookup_widget(GTK_WIDGET(wndMain), "entUsernameFile");
options[i++] = (char *) gtk_entry_get_text((GtkEntry *) widget);
options[i++] = (char *)gtk_entry_get_text((GtkEntry *)widget);
}
}
/* get the pass, pass list, or generate */
/* The "generate" button was implemented by Petar Kaleychev <petar.kaleychev@gmail.com> */
/* The "generate" button was implemented by Petar Kaleychev <petar.kaleychev@gmail.com> */
widget = lookup_widget(GTK_WIDGET(wndMain), "radioPass1");
if (gtk_toggle_button_get_active((GtkToggleButton *) widget)) {
if (gtk_toggle_button_get_active((GtkToggleButton *)widget)) {
options[i++] = "-p";
widget = lookup_widget(GTK_WIDGET(wndMain), "entPass");
options[i++] = (char *) gtk_entry_get_text((GtkEntry *) widget);
}
widget = lookup_widget(GTK_WIDGET(wndMain), "radioPass2");
if (gtk_toggle_button_get_active((GtkToggleButton *) widget)) {
options[i++] = (char *)gtk_entry_get_text((GtkEntry *)widget);
}
widget = lookup_widget(GTK_WIDGET(wndMain), "radioPass2");
if (gtk_toggle_button_get_active((GtkToggleButton *)widget)) {
options[i++] = "-P";
widget = lookup_widget(GTK_WIDGET(wndMain), "entPassFile");
options[i++] = (char *) gtk_entry_get_text((GtkEntry *) widget);
options[i++] = (char *)gtk_entry_get_text((GtkEntry *)widget);
}
widget = lookup_widget(GTK_WIDGET(wndMain), "radioGenerate");
if (gtk_toggle_button_get_active((GtkToggleButton *) widget)) {
options[i++] = "-x";
widget = lookup_widget(GTK_WIDGET(wndMain), "entGeneration");
options[i++] = (char *) gtk_entry_get_text((GtkEntry *) widget);
widget = lookup_widget(GTK_WIDGET(wndMain), "radioGenerate");
if (gtk_toggle_button_get_active((GtkToggleButton *)widget)) {
options[i++] = "-x";
widget = lookup_widget(GTK_WIDGET(wndMain), "entGeneration");
options[i++] = (char *)gtk_entry_get_text((GtkEntry *)widget);
}
}
/* empty passes / login as pass / reversed login? */
memset(passLoginNull, 0, 4);
widget = lookup_widget(GTK_WIDGET(wndMain), "chkPassNull");
if (gtk_toggle_button_get_active((GtkToggleButton *) widget)) {
if (gtk_toggle_button_get_active((GtkToggleButton *)widget)) {
passLoginNull[0] = 'n';
}
widget = lookup_widget(GTK_WIDGET(wndMain), "chkPassLogin");
if (gtk_toggle_button_get_active((GtkToggleButton *) widget)) {
if (gtk_toggle_button_get_active((GtkToggleButton *)widget)) {
if (passLoginNull[0] == 0) {
passLoginNull[0] = 's';
} else {
@@ -188,7 +185,7 @@ int hydra_get_options(char *options[]) {
}
/* The "Try reversed login" button was implemented by Petar Kaleychev <petar.kaleychev@gmail.com> */
widget = lookup_widget(GTK_WIDGET(wndMain), "chkPassReverse");
if (gtk_toggle_button_get_active((GtkToggleButton *) widget)) {
if (gtk_toggle_button_get_active((GtkToggleButton *)widget)) {
if (passLoginNull[0] == 0) {
passLoginNull[0] = 'r';
} else if (passLoginNull[1] == 0) {
@@ -204,7 +201,7 @@ int hydra_get_options(char *options[]) {
/* #of tasks */
widget = lookup_widget(GTK_WIDGET(wndMain), "spnTasks");
j = gtk_spin_button_get_value_as_int((GtkSpinButton *) widget);
j = gtk_spin_button_get_value_as_int((GtkSpinButton *)widget);
if (j != 40) {
snprintf(tasks, 10, "%d", j);
options[i++] = "-t";
@@ -213,7 +210,7 @@ int hydra_get_options(char *options[]) {
/* timeout */
widget = lookup_widget(GTK_WIDGET(wndMain), "spnTimeout");
j = gtk_spin_button_get_value_as_int((GtkSpinButton *) widget);
j = gtk_spin_button_get_value_as_int((GtkSpinButton *)widget);
if (j != 30) {
snprintf(timeout, 10, "%d", j);
options[i++] = "-w";
@@ -222,59 +219,59 @@ int hydra_get_options(char *options[]) {
/* loop around users? */
widget = lookup_widget(GTK_WIDGET(wndMain), "chkUsernameLoop");
if (gtk_toggle_button_get_active((GtkToggleButton *) widget)) {
if (gtk_toggle_button_get_active((GtkToggleButton *)widget)) {
options[i++] = "-u";
}
/* exit after first found pair? */
/* per host */
widget = lookup_widget(GTK_WIDGET(wndMain), "chkExitf");
if (gtk_toggle_button_get_active((GtkToggleButton *) widget)) {
if (gtk_toggle_button_get_active((GtkToggleButton *)widget)) {
options[i++] = "-f";
}
/* global */
widget = lookup_widget(GTK_WIDGET(wndMain), "chkExitF");
if (gtk_toggle_button_get_active((GtkToggleButton *) widget)) {
if (gtk_toggle_button_get_active((GtkToggleButton *)widget)) {
options[i++] = "-F";
}
/* Do not print messages about connection errors */
widget = lookup_widget(GTK_WIDGET(wndMain), "chkNoErr");
if (gtk_toggle_button_get_active((GtkToggleButton *) widget)) {
if (gtk_toggle_button_get_active((GtkToggleButton *)widget)) {
options[i++] = "-q";
}
/* get additional parameters */
widget = lookup_widget(GTK_WIDGET(wndMain), "entProtocol");
tmp = (char *) gtk_entry_get_text((GtkEntry *) widget);
tmp = (char *)gtk_entry_get_text((GtkEntry *)widget);
if (!strncmp(tmp, "http-proxy", 10)) {
widget = lookup_widget(GTK_WIDGET(wndMain), "entHTTPProxyURL");
options[i++] = "-m";
options[i++] = (char *) gtk_entry_get_text((GtkEntry *) widget);
options[i++] = (char *)gtk_entry_get_text((GtkEntry *)widget);
} else if (!strncmp(tmp, "http-", 5) || !strncmp(tmp, "https-", 6)) {
options[i++] = "-m";
widget = lookup_widget(GTK_WIDGET(wndMain), "entHTTPURL");
options[i++] = (char *) gtk_entry_get_text((GtkEntry *) widget);
options[i++] = (char *)gtk_entry_get_text((GtkEntry *)widget);
} else if (!strcmp(tmp, "cisco-enable")) {
options[i++] = "-m";
widget = lookup_widget(GTK_WIDGET(wndMain), "entCiscoPass");
options[i++] = (char *) gtk_entry_get_text((GtkEntry *) widget);
options[i++] = (char *)gtk_entry_get_text((GtkEntry *)widget);
} else if (!strcmp(tmp, "ldap3-crammd5")) {
options[i++] = "-m";
widget = lookup_widget(GTK_WIDGET(wndMain), "entLDAPDN");
options[i++] = (char *) gtk_entry_get_text((GtkEntry *) widget);
options[i++] = (char *)gtk_entry_get_text((GtkEntry *)widget);
} else if (!strcmp(tmp, "ldap3-digestmd5")) {
options[i++] = "-m";
widget = lookup_widget(GTK_WIDGET(wndMain), "entLDAPDN");
options[i++] = (char *) gtk_entry_get_text((GtkEntry *) widget);
options[i++] = (char *)gtk_entry_get_text((GtkEntry *)widget);
} else if (!strcmp(tmp, "smb")) {
memset(smbparm, 0, 12);
memset(smbparm, 0, sizeof(smbparm));
widget = lookup_widget(GTK_WIDGET(wndMain), "chkDomain");
widget2 = lookup_widget(GTK_WIDGET(wndMain), "chkLocal");
@@ -282,12 +279,12 @@ int hydra_get_options(char *options[]) {
strncpy(smbparm, "Both", sizeof(smbparm));
smbparm[strlen("Both")] = '\0';
if (gtk_toggle_button_get_active((GtkToggleButton *) widget)) {
if (gtk_toggle_button_get_active((GtkToggleButton *)widget)) {
strncpy(smbparm, "Domain", sizeof(smbparm));
smbparm[strlen("Domain")] = '\0';
}
if (gtk_toggle_button_get_active((GtkToggleButton *) widget2)) {
if (gtk_toggle_button_get_active((GtkToggleButton *) widget)) {
if (gtk_toggle_button_get_active((GtkToggleButton *)widget2)) {
if (gtk_toggle_button_get_active((GtkToggleButton *)widget)) {
strncpy(smbparm, "Both", sizeof(smbparm));
smbparm[strlen("Both")] = '\0';
} else {
@@ -296,14 +293,25 @@ int hydra_get_options(char *options[]) {
}
}
widget = lookup_widget(GTK_WIDGET(wndMain), "chkNTLM");
if (gtk_toggle_button_get_active((GtkToggleButton *) widget)) {
strcat(smbparm, "Hash");
if (gtk_toggle_button_get_active((GtkToggleButton *)widget)) {
strcat(smbparm, "Hash");
}
options[i++] = smbparm;
} else if (!strcmp(tmp, "smb2")) {
memset(smbparm, 0, sizeof(smbparm));
options[i++] = "-m";
options[i++] = smbparm;
widget = lookup_widget(GTK_WIDGET(wndMain), "chkNTLM");
int pth = gtk_toggle_button_get_active((GtkToggleButton *)widget);
widget = lookup_widget(GTK_WIDGET(wndMain), "entSMB2Workgroup");
snprintf(smbparm, sizeof(smbparm) - 1, "nthash:%s workgroup:{%s}", pth ? "true" : "false", (char *)gtk_entry_get_text((GtkEntry *)widget));
} else if (!strcmp(tmp, "sapr3")) {
widget = lookup_widget(GTK_WIDGET(wndMain), "spnSAPR3");
j = gtk_spin_button_get_value_as_int((GtkSpinButton *) widget);
j = gtk_spin_button_get_value_as_int((GtkSpinButton *)widget);
snprintf(sapr3id, sizeof(sapr3id), "%d", j);
options[i++] = "-m";
options[i++] = sapr3id;
@@ -311,18 +319,18 @@ int hydra_get_options(char *options[]) {
} else if (!strcmp(tmp, "cvs") || !strcmp(tmp, "svn")) {
widget = lookup_widget(GTK_WIDGET(wndMain), "entCVS");
options[i++] = "-m";
options[i++] = (char *) gtk_entry_get_text((GtkEntry *) widget);
options[i++] = (char *)gtk_entry_get_text((GtkEntry *)widget);
} else if (!strcmp(tmp, "snmp")) {
widget = lookup_widget(GTK_WIDGET(wndMain), "entSNMP");
options[i++] = "-m";
options[i++] = (char *) gtk_entry_get_text((GtkEntry *) widget);
options[i++] = (char *)gtk_entry_get_text((GtkEntry *)widget);
} else if (!strcmp(tmp, "telnet")) {
widget = lookup_widget(GTK_WIDGET(wndMain), "entTelnet");
if ((char *) gtk_entry_get_text((GtkEntry *) widget) != NULL) {
if ((char *)gtk_entry_get_text((GtkEntry *)widget) != NULL) {
options[i++] = "-m";
options[i++] = (char *) gtk_entry_get_text((GtkEntry *) widget);
options[i++] = (char *)gtk_entry_get_text((GtkEntry *)widget);
}
}
@@ -334,45 +342,44 @@ int hydra_get_options(char *options[]) {
/* proxy support */
widget = lookup_widget(GTK_WIDGET(wndMain), "radioProxy");
if (!gtk_toggle_button_get_active((GtkToggleButton *) widget)) {
if (!gtk_toggle_button_get_active((GtkToggleButton *)widget)) {
widget2 = lookup_widget(GTK_WIDGET(wndMain), "entHTTPProxy");
widget = lookup_widget(GTK_WIDGET(wndMain), "radioProxy2");
/* which variable do we set? */
if ((!strncmp(tmp, "http-", 5)) && (gtk_toggle_button_get_active((GtkToggleButton *) widget))) {
setenv("HYDRA_PROXY_HTTP", gtk_entry_get_text((GtkEntry *) widget2), 1);
if ((!strncmp(tmp, "http-", 5)) && (gtk_toggle_button_get_active((GtkToggleButton *)widget))) {
setenv("HYDRA_PROXY_HTTP", gtk_entry_get_text((GtkEntry *)widget2), 1);
} else {
setenv("HYDRA_PROXY_CONNECT", (char *) gtk_entry_get_text((GtkEntry *) widget2), 1);
setenv("HYDRA_PROXY_CONNECT", (char *)gtk_entry_get_text((GtkEntry *)widget2), 1);
}
/* do we need to provide user and pass? */
widget = lookup_widget(GTK_WIDGET(wndMain), "chkProxyAuth");
if (gtk_toggle_button_get_active((GtkToggleButton *) widget)) {
if (gtk_toggle_button_get_active((GtkToggleButton *)widget)) {
widget = lookup_widget(GTK_WIDGET(wndMain), "entProxyUser");
widget2 = lookup_widget(GTK_WIDGET(wndMain), "entProxyPass");
a = g_string_new((gchar *) gtk_entry_get_text((GtkEntry *) widget));
a = g_string_new((gchar *)gtk_entry_get_text((GtkEntry *)widget));
a = g_string_append_c(a, ':');
a = g_string_append(a, gtk_entry_get_text((GtkEntry *) widget2));
a = g_string_append(a, gtk_entry_get_text((GtkEntry *)widget2));
setenv("HYDRA_PROXY_AUTH", a->str, 1);
(void) g_string_free(a, TRUE);
(void)g_string_free(a, TRUE);
}
}
/* get the target, or target list */
widget = lookup_widget(GTK_WIDGET(wndMain), "radioTarget1");
if (gtk_toggle_button_get_active((GtkToggleButton *) widget)) {
if (gtk_toggle_button_get_active((GtkToggleButton *)widget)) {
widget = lookup_widget(GTK_WIDGET(wndMain), "entTarget");
options[i++] = (char *) gtk_entry_get_text((GtkEntry *) widget);
options[i++] = (char *)gtk_entry_get_text((GtkEntry *)widget);
} else {
options[i++] = "-M";
widget = lookup_widget(GTK_WIDGET(wndMain), "entTargetFile");
options[i++] = (char *) gtk_entry_get_text((GtkEntry *) widget);
options[i++] = (char *)gtk_entry_get_text((GtkEntry *)widget);
}
/* get the service */
widget = lookup_widget(GTK_WIDGET(wndMain), "entProtocol");
options[i++] = (char *) gtk_entry_get_text((GtkEntry *) widget);
options[i++] = (char *)gtk_entry_get_text((GtkEntry *)widget);
options[i] = NULL;
return i;
@@ -389,12 +396,11 @@ int update_statusbar() {
i = hydra_get_options(options);
for (j = 1; j < i; j++) {
statustext = g_string_append(statustext, options[j]);
statustext = g_string_append_c(statustext, ' ');
}
statusbar = (GtkStatusbar *) lookup_widget(GTK_WIDGET(wndMain), "statusbar");
statusbar = (GtkStatusbar *)lookup_widget(GTK_WIDGET(wndMain), "statusbar");
context_id = gtk_statusbar_get_context_id(statusbar, "status");
/* an old message in stack? */
@@ -402,9 +408,9 @@ int update_statusbar() {
gtk_statusbar_remove(statusbar, context_id, message_id);
}
message_id = gtk_statusbar_push(statusbar, context_id, (gchar *) statustext->str);
message_id = gtk_statusbar_push(statusbar, context_id, (gchar *)statustext->str);
(void) g_string_free(statustext, TRUE);
(void)g_string_free(statustext, TRUE);
return TRUE;
}
@@ -428,11 +434,10 @@ int read_into(int fd) {
}
output = lookup_widget(GTK_WIDGET(wndMain), "txtOutput");
outputbuf = gtk_text_view_get_buffer((GtkTextView *) output);
outputbuf = gtk_text_view_get_buffer((GtkTextView *)output);
gtk_text_buffer_get_iter_at_offset(outputbuf, &outputiter, -1);
if ((passline = strstr(in_buf, "password: ")) == NULL) {
gtk_text_buffer_insert(outputbuf, &outputiter, in_buf, result);
} else {
@@ -450,15 +455,13 @@ int read_into(int fd) {
if (end - in_buf - result > 0) {
gtk_text_buffer_insert(outputbuf, &outputiter, end + 1, -1);
}
}
if (strstr(in_buf, " finished at ") != NULL) {
gtk_text_buffer_insert_with_tags_by_name(outputbuf, &outputiter, "<finished>\n\n", -1, "bold", NULL);
}
if (result == BUF_S - 1) /* there might be more available, recurse baby! */
if (result == BUF_S - 1) /* there might be more available, recurse baby! */
return read_into(fd);
else
return TRUE;
@@ -515,7 +518,6 @@ static int wait_hydra_output(gpointer data) {
return TRUE;
}
/* assumes a successfull pipe() won't set the fd's to -1 */
static void close_pipe(int *pipe) {
if (-1 != pipe[0]) {
@@ -535,11 +537,11 @@ static void close_pipe(int *pipe) {
*/
int *popen_re_unbuffered(char *command) {
static int p_r[2] = { -1, -1 }, p_e[2] = {
-1, -1};
static int p_r[2] = {-1, -1}, p_e[2] = {-1, -1};
static int *pfd = NULL;
char *options[128];
hydra_pid = 0;
update_statusbar();
@@ -560,8 +562,9 @@ int *popen_re_unbuffered(char *command) {
if ((hydra_pid = fork()) < 0) {
g_warning("popen_rw_unbuffered: Error forking!");
return NULL;
} else if (hydra_pid == 0) { /* child */
} else if (hydra_pid == 0) { /* child */
int k;
if (setpgid(getpid(), getpid()) < 0)
g_warning("popen_rw_unbuffered: setpgid() failed");
if (close(p_r[0]) < 0)
@@ -580,17 +583,17 @@ int *popen_re_unbuffered(char *command) {
if (close(p_e[1]) < 0)
g_warning("popen_rw_unbuffered: close(p_e[1]) failed");
(void) hydra_get_options(options);
(void)hydra_get_options(options);
execv(HYDRA_BIN, options);
g_warning("%s %i: popen_rw_unbuffered: execv() returned", __FILE__, __LINE__);
for (k = 0; options[k] != NULL; k++) {
g_warning("%s", options[k]);
}
gtk_main_quit();
} else { /* parent */
} else { /* parent */
if (close(p_r[1]) < 0)
g_warning("popen_rw_unbuffered: close(p_r[1]) (parent) failed");
if (close(p_e[1]) < 0)
@@ -603,32 +606,25 @@ int *popen_re_unbuffered(char *command) {
return pfd;
}
void on_quit1_activate(GtkMenuItem * menuitem, gpointer user_data) {
gtk_main_quit();
}
void on_quit1_activate(GtkMenuItem *menuitem, gpointer user_data) { gtk_main_quit(); }
void on_about1_activate(GtkMenuItem *menuitem, gpointer user_data) {}
void on_about1_activate(GtkMenuItem * menuitem, gpointer user_data) {
}
void on_btnStart_clicked(GtkButton * button, gpointer user_data) {
void on_btnStart_clicked(GtkButton *button, gpointer user_data) {
int *fd = NULL;
fd = popen_re_unbuffered(NULL);
g_timeout_add(200, wait_hydra_output, fd);
}
void on_btnStop_clicked(GtkButton * button, gpointer user_data) {
void on_btnStop_clicked(GtkButton *button, gpointer user_data) {
if (hydra_pid != 0) {
kill(hydra_pid, SIGTERM);
hydra_pid = 0;
}
}
void on_wndMain_destroy(GtkObject * object, gpointer user_data) {
void on_wndMain_destroy(GtkObject *object, gpointer user_data) {
if (hydra_pid != 0) {
kill(hydra_pid, SIGTERM);
hydra_pid = 0;
@@ -636,35 +632,31 @@ void on_wndMain_destroy(GtkObject * object, gpointer user_data) {
gtk_main_quit();
}
gboolean on_entTargetFile_button_press_event(GtkWidget * widget, GdkEventButton * event, gpointer user_data) {
hydra_select_file((GtkEntry *) widget, "Select target list");
gboolean on_entTargetFile_button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer user_data) {
hydra_select_file((GtkEntry *)widget, "Select target list");
gtk_widget_grab_focus(widget);
return TRUE;
}
gboolean on_entUsernameFile_button_press_event(GtkWidget * widget, GdkEventButton * event, gpointer user_data) {
hydra_select_file((GtkEntry *) widget, "Select username list");
gboolean on_entUsernameFile_button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer user_data) {
hydra_select_file((GtkEntry *)widget, "Select username list");
gtk_widget_grab_focus(widget);
return TRUE;
}
gboolean on_entPassFile_button_press_event(GtkWidget * widget, GdkEventButton * event, gpointer user_data) {
hydra_select_file((GtkEntry *) widget, "Select password list");
gboolean on_entPassFile_button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer user_data) {
hydra_select_file((GtkEntry *)widget, "Select password list");
gtk_widget_grab_focus(widget);
return TRUE;
}
gboolean on_entColonFile_button_press_event(GtkWidget * widget, GdkEventButton * event, gpointer user_data) {
hydra_select_file((GtkEntry *) widget, "Select colon separated user,password list");
gboolean on_entColonFile_button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer user_data) {
hydra_select_file((GtkEntry *)widget, "Select colon separated user,password list");
gtk_widget_grab_focus(widget);
return TRUE;
}
void on_btnSave_clicked(GtkButton * button, gpointer user_data) {
void on_btnSave_clicked(GtkButton *button, gpointer user_data) {
#ifdef GTK_TYPE_FILE_CHOOSER
GtkWidget *dialog;
char *filename;
@@ -675,20 +667,19 @@ void on_btnSave_clicked(GtkButton * button, gpointer user_data) {
GtkTextIter start;
GtkTextIter end;
dialog = gtk_file_chooser_dialog_new("Save output", (GtkWindow *) wndMain, GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL);
dialog = gtk_file_chooser_dialog_new("Save output", (GtkWindow *)wndMain, GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL);
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
output = lookup_widget(GTK_WIDGET(wndMain), "txtOutput");
outputbuf = gtk_text_view_get_buffer((GtkTextView *) output);
outputbuf = gtk_text_view_get_buffer((GtkTextView *)output);
gtk_text_buffer_get_start_iter(outputbuf, &start);
gtk_text_buffer_get_end_iter(outputbuf, &end);
text = gtk_text_buffer_get_text(outputbuf, &start, &end, TRUE);
fd = open(filename, O_CREAT | O_TRUNC | O_WRONLY, 0644);
if (fd > 0) {
if (fd >= 0) {
write(fd, text, strlen(text));
close(fd);
}
@@ -699,9 +690,11 @@ void on_btnSave_clicked(GtkButton * button, gpointer user_data) {
#endif
}
void on_chkColon_toggled(GtkToggleButton * togglebutton, gpointer user_data) {
void on_chkColon_toggled(GtkToggleButton *togglebutton, gpointer user_data) {
GtkWidget *user, *pass;
user = lookup_widget(GTK_WIDGET(wndMain), "frmUsername");;
user = lookup_widget(GTK_WIDGET(wndMain), "frmUsername");
;
pass = lookup_widget(GTK_WIDGET(wndMain), "frmPass");
if (gtk_toggle_button_get_active(togglebutton)) {
@@ -713,9 +706,11 @@ void on_chkColon_toggled(GtkToggleButton * togglebutton, gpointer user_data) {
}
}
void on_chkDisUser_toggled(GtkToggleButton * togglebutton, gpointer user_data) {
void on_chkDisUser_toggled(GtkToggleButton *togglebutton, gpointer user_data) {
GtkWidget *radioUsername1, *radioUsername2, *entUsername, *entUsernameFile;
radioUsername1 = lookup_widget(GTK_WIDGET(wndMain), "radioUsername1");;
radioUsername1 = lookup_widget(GTK_WIDGET(wndMain), "radioUsername1");
;
radioUsername2 = lookup_widget(GTK_WIDGET(wndMain), "radioUsername2");
entUsername = lookup_widget(GTK_WIDGET(wndMain), "entUsername");
entUsernameFile = lookup_widget(GTK_WIDGET(wndMain), "entUsernameFile");
@@ -733,11 +728,11 @@ void on_chkDisUser_toggled(GtkToggleButton * togglebutton, gpointer user_data) {
}
}
void on_btnClear_clicked(GtkButton * button, gpointer user_data) {
void on_btnClear_clicked(GtkButton *button, gpointer user_data) {
GtkWidget *output;
GtkTextBuffer *outputbuf;
output = lookup_widget(GTK_WIDGET(wndMain), "txtOutput");
outputbuf = gtk_text_view_get_buffer((GtkTextView *) output);
outputbuf = gtk_text_view_get_buffer((GtkTextView *)output);
gtk_text_buffer_set_text(outputbuf, "", -1);
}
Executable → Regular
+13 -13
View File
@@ -2,28 +2,28 @@
int update_statusbar();
void on_quit1_activate(GtkMenuItem * menuitem, gpointer user_data);
void on_quit1_activate(GtkMenuItem *menuitem, gpointer user_data);
void on_about1_activate(GtkMenuItem * menuitem, gpointer user_data);
void on_about1_activate(GtkMenuItem *menuitem, gpointer user_data);
void on_btnStart_clicked(GtkButton * button, gpointer user_data);
void on_btnStart_clicked(GtkButton *button, gpointer user_data);
void on_wndMain_destroy(GtkObject * object, gpointer user_data);
void on_wndMain_destroy(GtkObject *object, gpointer user_data);
void on_btnStop_clicked(GtkButton * button, gpointer user_data);
void on_btnStop_clicked(GtkButton *button, gpointer user_data);
gboolean on_entTargetFile_button_press_event(GtkWidget * widget, GdkEventButton * event, gpointer user_data);
gboolean on_entTargetFile_button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer user_data);
gboolean on_entUsernameFile_button_press_event(GtkWidget * widget, GdkEventButton * event, gpointer user_data);
gboolean on_entUsernameFile_button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer user_data);
gboolean on_entPassFile_button_press_event(GtkWidget * widget, GdkEventButton * event, gpointer user_data);
gboolean on_entPassFile_button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer user_data);
void on_btnSave_clicked(GtkButton * button, gpointer user_data);
void on_btnSave_clicked(GtkButton *button, gpointer user_data);
gboolean on_entColonFile_button_press_event(GtkWidget * widget, GdkEventButton * event, gpointer user_data);
gboolean on_entColonFile_button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer user_data);
void on_chkColon_toggled(GtkToggleButton * togglebutton, gpointer user_data);
void on_chkColon_toggled(GtkToggleButton *togglebutton, gpointer user_data);
void on_btnClear_clicked(GtkButton * button, gpointer user_data);
void on_btnClear_clicked(GtkButton *button, gpointer user_data);
void on_chkDisUser_toggled(GtkToggleButton * togglebutton, gpointer user_data);
void on_chkDisUser_toggled(GtkToggleButton *togglebutton, gpointer user_data);
Executable → Regular
+136 -126
View File
@@ -7,13 +7,13 @@
#include <config.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <string.h>
#include <stdio.h>
#include <string.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
@@ -22,12 +22,9 @@
#include "interface.h"
#include "support.h"
#define GLADE_HOOKUP_OBJECT(component,widget,name) \
g_object_set_data_full (G_OBJECT (component), name, \
gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)
#define GLADE_HOOKUP_OBJECT(component, widget, name) g_object_set_data_full(G_OBJECT(component), name, gtk_widget_ref(widget), (GDestroyNotify)gtk_widget_unref)
#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \
g_object_set_data (G_OBJECT (component), name, widget)
#define GLADE_HOOKUP_OBJECT_NO_REF(component, widget, name) g_object_set_data(G_OBJECT(component), name, widget)
GtkWidget *create_wndMain(void) {
GtkWidget *wndMain;
@@ -171,6 +168,9 @@ GtkWidget *create_wndMain(void) {
GtkWidget *btnClear;
GtkWidget *label4;
GtkWidget *statusbar;
GtkWidget *lblSMB2;
GtkWidget *entSMB2Workgroup;
GtkWidget *fraSMB2;
GtkAccelGroup *accel_group;
GtkTooltips *tooltips;
@@ -221,7 +221,8 @@ GtkWidget *create_wndMain(void) {
g_object_set_data(G_OBJECT(GTK_COMBO(cmbProtocol)->popwin), "GladeParentKey", cmbProtocol);
gtk_widget_set_name(cmbProtocol, "cmbProtocol");
gtk_widget_show(cmbProtocol);
gtk_table_attach(GTK_TABLE(table8), cmbProtocol, 1, 2, 4, 5, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_table_attach(GTK_TABLE(table8), cmbProtocol, 1, 2, 4, 5, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
cmbProtocol_items = g_list_append(cmbProtocol_items, (gpointer) "adam6500");
cmbProtocol_items = g_list_append(cmbProtocol_items, (gpointer) "afp");
cmbProtocol_items = g_list_append(cmbProtocol_items, (gpointer) "asterisk");
cmbProtocol_items = g_list_append(cmbProtocol_items, (gpointer) "cisco");
@@ -247,6 +248,8 @@ GtkWidget *create_wndMain(void) {
cmbProtocol_items = g_list_append(cmbProtocol_items, (gpointer) "ldap3");
cmbProtocol_items = g_list_append(cmbProtocol_items, (gpointer) "ldap3-crammd5");
cmbProtocol_items = g_list_append(cmbProtocol_items, (gpointer) "ldap3-digestmd5");
cmbProtocol_items = g_list_append(cmbProtocol_items, (gpointer) "memcached");
cmbProtocol_items = g_list_append(cmbProtocol_items, (gpointer) "mongodb");
cmbProtocol_items = g_list_append(cmbProtocol_items, (gpointer) "mssql");
cmbProtocol_items = g_list_append(cmbProtocol_items, (gpointer) "mysql");
cmbProtocol_items = g_list_append(cmbProtocol_items, (gpointer) "ncp");
@@ -258,15 +261,19 @@ GtkWidget *create_wndMain(void) {
cmbProtocol_items = g_list_append(cmbProtocol_items, (gpointer) "pop3");
cmbProtocol_items = g_list_append(cmbProtocol_items, (gpointer) "pcanywhere");
cmbProtocol_items = g_list_append(cmbProtocol_items, (gpointer) "postgres");
cmbProtocol_items = g_list_append(cmbProtocol_items, (gpointer) "radmin2");
cmbProtocol_items = g_list_append(cmbProtocol_items, (gpointer) "rdp");
cmbProtocol_items = g_list_append(cmbProtocol_items, (gpointer) "redis");
cmbProtocol_items = g_list_append(cmbProtocol_items, (gpointer) "rexec");
cmbProtocol_items = g_list_append(cmbProtocol_items, (gpointer) "rlogin");
cmbProtocol_items = g_list_append(cmbProtocol_items, (gpointer) "rpcap");
cmbProtocol_items = g_list_append(cmbProtocol_items, (gpointer) "rsh");
cmbProtocol_items = g_list_append(cmbProtocol_items, (gpointer) "rtsp");
cmbProtocol_items = g_list_append(cmbProtocol_items, (gpointer) "s7-300");
cmbProtocol_items = g_list_append(cmbProtocol_items, (gpointer) "sapr3");
cmbProtocol_items = g_list_append(cmbProtocol_items, (gpointer) "sip");
cmbProtocol_items = g_list_append(cmbProtocol_items, (gpointer) "smb");
cmbProtocol_items = g_list_append(cmbProtocol_items, (gpointer) "smb2");
cmbProtocol_items = g_list_append(cmbProtocol_items, (gpointer) "smtp");
cmbProtocol_items = g_list_append(cmbProtocol_items, (gpointer) "snmp");
cmbProtocol_items = g_list_append(cmbProtocol_items, (gpointer) "socks5");
@@ -289,53 +296,52 @@ GtkWidget *create_wndMain(void) {
label7 = gtk_label_new("Protocol");
gtk_widget_set_name(label7, "label7");
gtk_widget_show(label7);
gtk_table_attach(GTK_TABLE(table8), label7, 0, 1, 4, 5, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_table_attach(GTK_TABLE(table8), label7, 0, 1, 4, 5, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
gtk_misc_set_alignment(GTK_MISC(label7), 0, 0.5);
spnPort_adj = gtk_adjustment_new(0, 0, 65535, 1, 10, 0);
spnPort = gtk_spin_button_new(GTK_ADJUSTMENT(spnPort_adj), 1, 0);
gtk_widget_set_name(spnPort, "spnPort");
gtk_widget_show(spnPort);
gtk_table_attach(GTK_TABLE(table8), spnPort, 1, 2, 3, 4, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_table_attach(GTK_TABLE(table8), spnPort, 1, 2, 3, 4, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
gtk_tooltips_set_tip(tooltips, spnPort, "select the port on which the daemon you want to brute force runs, 0 means default", NULL);
label6 = gtk_label_new("Port");
gtk_widget_set_name(label6, "label6");
gtk_widget_show(label6);
gtk_table_attach(GTK_TABLE(table8), label6, 0, 1, 3, 4, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_table_attach(GTK_TABLE(table8), label6, 0, 1, 3, 4, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
gtk_misc_set_alignment(GTK_MISC(label6), 0, 0.5);
chkIPV6 = gtk_check_button_new_with_mnemonic("Prefer IPV6");
gtk_widget_set_name(chkIPV6, "chkIPV6");
gtk_widget_show(chkIPV6);
gtk_table_attach(GTK_TABLE(table8), chkIPV6, 0, 2, 2, 3, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_table_attach(GTK_TABLE(table8), chkIPV6, 0, 2, 2, 3, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
gtk_tooltips_set_tip(tooltips, chkIPV6, "Enable to use IPV6", NULL);
radioTarget2 = gtk_radio_button_new_with_mnemonic(NULL, "Target List");
gtk_widget_set_name(radioTarget2, "radioTarget2");
gtk_widget_show(radioTarget2);
gtk_table_attach(GTK_TABLE(table8), radioTarget2, 0, 1, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_table_attach(GTK_TABLE(table8), radioTarget2, 0, 1, 1, 2, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
gtk_radio_button_set_group(GTK_RADIO_BUTTON(radioTarget2), radioTarget2_group);
radioTarget2_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radioTarget2));
entTargetFile = gtk_entry_new();
gtk_widget_set_name(entTargetFile, "entTargetFile");
gtk_widget_show(entTargetFile);
gtk_table_attach(GTK_TABLE(table8), entTargetFile, 1, 2, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_table_attach(GTK_TABLE(table8), entTargetFile, 1, 2, 1, 2, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
gtk_tooltips_set_tip(tooltips, entTargetFile, "A file which contains the targets to attack. One entry per line. IP\naddresses and/or DNS names.", NULL);
entTarget = gtk_entry_new();
gtk_widget_set_name(entTarget, "entTarget");
gtk_widget_show(entTarget);
gtk_table_attach(GTK_TABLE(table8), entTarget, 1, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_table_attach(GTK_TABLE(table8), entTarget, 1, 2, 0, 1, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
gtk_tooltips_set_tip(tooltips, entTarget, "The target to attack - DNS name or IP address", NULL);
gtk_entry_set_text(GTK_ENTRY(entTarget), "127.0.0.1");
radioTarget1 = gtk_radio_button_new_with_mnemonic(NULL, "Single Target");
gtk_widget_set_name(radioTarget1, "radioTarget1");
gtk_widget_show(radioTarget1);
gtk_table_attach(GTK_TABLE(table8), radioTarget1, 0, 1, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_table_attach(GTK_TABLE(table8), radioTarget1, 0, 1, 0, 1, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
gtk_radio_button_set_group(GTK_RADIO_BUTTON(radioTarget1), radioTarget2_group);
radioTarget2_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radioTarget1));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radioTarget1), TRUE);
@@ -358,50 +364,44 @@ GtkWidget *create_wndMain(void) {
chkVerbose = gtk_check_button_new_with_mnemonic("Be Verbose");
gtk_widget_set_name(chkVerbose, "chkVerbose");
gtk_widget_show(chkVerbose);
gtk_table_attach(GTK_TABLE(table9), chkVerbose, 2, 3, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_table_attach(GTK_TABLE(table9), chkVerbose, 2, 3, 0, 1, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
gtk_tooltips_set_tip(tooltips, chkVerbose, "be verbose", NULL);
chkDebug = gtk_check_button_new_with_mnemonic("Debug");
gtk_widget_set_name(chkDebug, "chkDebug");
gtk_widget_show(chkDebug);
gtk_table_attach(GTK_TABLE(table9), chkDebug, 2, 3, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_table_attach(GTK_TABLE(table9), chkDebug, 2, 3, 1, 2, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
gtk_tooltips_set_tip(tooltips, chkDebug, "Enable debug mode", NULL);
chkAttempts = gtk_check_button_new_with_mnemonic("Show Attempts");
gtk_widget_set_name(chkAttempts, "chkAttempts");
gtk_widget_show(chkAttempts);
gtk_table_attach(GTK_TABLE(table9), chkAttempts, 0, 2, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_table_attach(GTK_TABLE(table9), chkAttempts, 0, 2, 1, 2, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
gtk_tooltips_set_tip(tooltips, chkAttempts, "Show attempts", NULL);
chkSSL = gtk_check_button_new_with_mnemonic("Use SSL");
gtk_widget_set_name(chkSSL, "chkSSL");
gtk_widget_show(chkSSL);
gtk_table_attach(GTK_TABLE(table9), chkSSL, 0, 1, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_table_attach(GTK_TABLE(table9), chkSSL, 0, 1, 0, 1, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
gtk_tooltips_set_tip(tooltips, chkSSL, "Enable to use SSL (the target must have SSL enabled!)", NULL);
chkServiceDetails = gtk_check_button_new_with_mnemonic ("Service Module Usage Details");
gtk_widget_set_name (chkServiceDetails, "chkServiceDetails");
gtk_widget_show (chkServiceDetails);
gtk_table_attach (GTK_TABLE (table9), chkServiceDetails, 2, 3, 2, 3,
(GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK),
(GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_tooltips_set_tip (tooltips, chkServiceDetails, "Service Module Usage Details", NULL);
chkServiceDetails = gtk_check_button_new_with_mnemonic("Service Module Usage Details");
gtk_widget_set_name(chkServiceDetails, "chkServiceDetails");
gtk_widget_show(chkServiceDetails);
gtk_table_attach(GTK_TABLE(table9), chkServiceDetails, 2, 3, 2, 3, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
gtk_tooltips_set_tip(tooltips, chkServiceDetails, "Service Module Usage Details", NULL);
chkCompleteHelp = gtk_check_button_new_with_mnemonic ("COMPLETE HELP");
gtk_widget_set_name (chkCompleteHelp, "chkCompleteHelp");
gtk_widget_show (chkCompleteHelp);
gtk_table_attach (GTK_TABLE (table9), chkCompleteHelp, 0, 2, 2, 3,
(GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK),
(GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_tooltips_set_tip (tooltips, chkCompleteHelp, "Complete Help", NULL);
chkCompleteHelp = gtk_check_button_new_with_mnemonic("COMPLETE HELP");
gtk_widget_set_name(chkCompleteHelp, "chkCompleteHelp");
gtk_widget_show(chkCompleteHelp);
gtk_table_attach(GTK_TABLE(table9), chkCompleteHelp, 0, 2, 2, 3, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
gtk_tooltips_set_tip(tooltips, chkCompleteHelp, "Complete Help", NULL);
chkOldSSL = gtk_check_button_new_with_mnemonic ("Use old SSL");
gtk_widget_set_name (chkOldSSL, "chkOldSSL");
gtk_widget_show (chkOldSSL);
gtk_table_attach (GTK_TABLE (table9), chkOldSSL, 1, 2, 0, 1,
(GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK),
(GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_tooltips_set_tip (tooltips, chkOldSSL, "Enable to use old SSL (the target must have SSL enabled!)", NULL);
chkOldSSL = gtk_check_button_new_with_mnemonic("Use old SSL");
gtk_widget_set_name(chkOldSSL, "chkOldSSL");
gtk_widget_show(chkOldSSL);
gtk_table_attach(GTK_TABLE(table9), chkOldSSL, 1, 2, 0, 1, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
gtk_tooltips_set_tip(tooltips, chkOldSSL, "Enable to use old SSL (the target must have SSL enabled!)", NULL);
label29 = gtk_label_new("Output Options");
gtk_widget_set_name(label29, "label29");
@@ -431,20 +431,20 @@ GtkWidget *create_wndMain(void) {
entUsernameFile = gtk_entry_new();
gtk_widget_set_name(entUsernameFile, "entUsernameFile");
gtk_widget_show(entUsernameFile);
gtk_table_attach(GTK_TABLE(table2), entUsernameFile, 1, 2, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), 0, 0);
gtk_table_attach(GTK_TABLE(table2), entUsernameFile, 1, 2, 1, 2, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), 0, 0);
gtk_tooltips_set_tip(tooltips, entUsernameFile, "File with user logins, one entry per line", NULL);
entUsername = gtk_entry_new();
gtk_widget_set_name(entUsername, "entUsername");
gtk_widget_show(entUsername);
gtk_table_attach(GTK_TABLE(table2), entUsername, 1, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), 0, 0);
gtk_table_attach(GTK_TABLE(table2), entUsername, 1, 2, 0, 1, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), 0, 0);
gtk_tooltips_set_tip(tooltips, entUsername, "The login to use", NULL);
gtk_entry_set_text(GTK_ENTRY(entUsername), "yourname");
radioUsername1 = gtk_radio_button_new_with_mnemonic(NULL, "Username");
gtk_widget_set_name(radioUsername1, "radioUsername1");
gtk_widget_show(radioUsername1);
gtk_table_attach(GTK_TABLE(table2), radioUsername1, 0, 1, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), 0, 0);
gtk_table_attach(GTK_TABLE(table2), radioUsername1, 0, 1, 0, 1, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), 0, 0);
gtk_radio_button_set_group(GTK_RADIO_BUTTON(radioUsername1), radioUsername1_group);
radioUsername1_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radioUsername1));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radioUsername1), TRUE);
@@ -452,20 +452,20 @@ GtkWidget *create_wndMain(void) {
radioUsername2 = gtk_radio_button_new_with_mnemonic(NULL, "Username List");
gtk_widget_set_name(radioUsername2, "radioUsername2");
gtk_widget_show(radioUsername2);
gtk_table_attach(GTK_TABLE(table2), radioUsername2, 0, 1, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), 0, 0);
gtk_table_attach(GTK_TABLE(table2), radioUsername2, 0, 1, 1, 2, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), 0, 0);
gtk_radio_button_set_group(GTK_RADIO_BUTTON(radioUsername2), radioUsername1_group);
radioUsername1_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radioUsername2));
chkUsernameLoop = gtk_check_button_new_with_mnemonic("Loop around users");
gtk_widget_set_name(chkUsernameLoop, "chkUsernameLoop");
gtk_widget_show(chkUsernameLoop);
gtk_table_attach(GTK_TABLE(table2), chkUsernameLoop, 0, 1, 2, 3, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_table_attach(GTK_TABLE(table2), chkUsernameLoop, 0, 1, 2, 3, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
gtk_tooltips_set_tip(tooltips, chkUsernameLoop, "Enable this option to loop around users not passwords", NULL);
chkDisUser = gtk_check_button_new_with_mnemonic("Protocol does not require usernames");
gtk_widget_set_name(chkDisUser, "chkDisUser");
gtk_widget_show(chkDisUser);
gtk_table_attach(GTK_TABLE (table2), chkDisUser, 1, 2, 2, 3, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_table_attach(GTK_TABLE(table2), chkDisUser, 1, 2, 2, 3, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
gtk_tooltips_set_tip(tooltips, chkDisUser, "Protocols like Cisco, Cisco enable, redis, Oracle listener, SNMP, S7-300, VNC etc. are not using usernames", NULL);
label8 = gtk_label_new("Username");
@@ -478,7 +478,7 @@ GtkWidget *create_wndMain(void) {
gtk_widget_show(frmPass);
gtk_box_pack_start(GTK_BOX(vbox2), frmPass, TRUE, TRUE, 0);
table3 = gtk_table_new (3, 2, FALSE);
table3 = gtk_table_new(3, 2, FALSE);
gtk_widget_set_name(table3, "table3");
gtk_widget_show(table3);
gtk_container_add(GTK_CONTAINER(frmPass), table3);
@@ -486,20 +486,20 @@ GtkWidget *create_wndMain(void) {
entPassFile = gtk_entry_new();
gtk_widget_set_name(entPassFile, "entPassFile");
gtk_widget_show(entPassFile);
gtk_table_attach(GTK_TABLE(table3), entPassFile, 1, 2, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), 0, 0);
gtk_table_attach(GTK_TABLE(table3), entPassFile, 1, 2, 1, 2, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), 0, 0);
gtk_tooltips_set_tip(tooltips, entPassFile, "File with passwords to try, one entry per line", NULL);
entPass = gtk_entry_new();
gtk_widget_set_name(entPass, "entPass");
gtk_widget_show(entPass);
gtk_table_attach(GTK_TABLE(table3), entPass, 1, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), 0, 0);
gtk_table_attach(GTK_TABLE(table3), entPass, 1, 2, 0, 1, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), 0, 0);
gtk_tooltips_set_tip(tooltips, entPass, "The password to try", NULL);
gtk_entry_set_text(GTK_ENTRY(entPass), "yourpass");
radioPass1 = gtk_radio_button_new_with_mnemonic(NULL, "Password");
gtk_widget_set_name(radioPass1, "radioPass1");
gtk_widget_show(radioPass1);
gtk_table_attach(GTK_TABLE(table3), radioPass1, 0, 1, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), 0, 0);
gtk_table_attach(GTK_TABLE(table3), radioPass1, 0, 1, 0, 1, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), 0, 0);
gtk_radio_button_set_group(GTK_RADIO_BUTTON(radioPass1), radioPass1_group);
radioPass1_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radioPass1));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radioPass1), TRUE);
@@ -507,26 +507,22 @@ GtkWidget *create_wndMain(void) {
radioPass2 = gtk_radio_button_new_with_mnemonic(NULL, "Password List");
gtk_widget_set_name(radioPass2, "radioPass2");
gtk_widget_show(radioPass2);
gtk_table_attach(GTK_TABLE(table3), radioPass2, 0, 1, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), 0, 0);
gtk_table_attach(GTK_TABLE(table3), radioPass2, 0, 1, 1, 2, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), 0, 0);
gtk_radio_button_set_group(GTK_RADIO_BUTTON(radioPass2), radioPass1_group);
radioPass1_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radioPass2));
radioGenerate = gtk_radio_button_new_with_mnemonic (NULL, "Generate");
gtk_widget_set_name (radioGenerate, "radioGenerate");
gtk_widget_show (radioGenerate);
gtk_table_attach (GTK_TABLE (table3), radioGenerate, 0, 1, 2, 3,
(GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK),
(GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), 0, 0);
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radioGenerate), radioPass1_group);
radioPass1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radioGenerate));
radioGenerate = gtk_radio_button_new_with_mnemonic(NULL, "Generate");
gtk_widget_set_name(radioGenerate, "radioGenerate");
gtk_widget_show(radioGenerate);
gtk_table_attach(GTK_TABLE(table3), radioGenerate, 0, 1, 2, 3, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), 0, 0);
gtk_radio_button_set_group(GTK_RADIO_BUTTON(radioGenerate), radioPass1_group);
radioPass1_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radioGenerate));
entGeneration = gtk_entry_new ();
gtk_widget_set_name (entGeneration, "entGeneration");
gtk_widget_show (entGeneration);
gtk_table_attach (GTK_TABLE (table3), entGeneration, 1, 2, 2, 3,
(GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK),
(GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), 0, 0);
gtk_tooltips_set_tip (tooltips, entGeneration, "Generate passwords", NULL);
gtk_entry_set_text (GTK_ENTRY (entGeneration), "1:1:a");
entGeneration = gtk_entry_new();
gtk_widget_set_name(entGeneration, "entGeneration");
gtk_widget_show(entGeneration);
gtk_table_attach(GTK_TABLE(table3), entGeneration, 1, 2, 2, 3, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), 0, 0);
gtk_tooltips_set_tip(tooltips, entGeneration, "Generate passwords", NULL);
gtk_entry_set_text(GTK_ENTRY(entGeneration), "1:1:a");
labelpass = gtk_label_new("Password");
gtk_widget_set_name(labelpass, "labelpass");
@@ -546,13 +542,13 @@ GtkWidget *create_wndMain(void) {
chkColon = gtk_check_button_new_with_mnemonic("Use Colon separated file");
gtk_widget_set_name(chkColon, "chkColon");
gtk_widget_show(chkColon);
gtk_table_attach(GTK_TABLE(table5), chkColon, 0, 1, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_table_attach(GTK_TABLE(table5), chkColon, 0, 1, 0, 1, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
gtk_tooltips_set_tip(tooltips, chkColon, "Enable this option to use a colon file for login/password attempts", NULL);
entColonFile = gtk_entry_new();
gtk_widget_set_name(entColonFile, "entColonFile");
gtk_widget_show(entColonFile);
gtk_table_attach(GTK_TABLE(table5), entColonFile, 1, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_table_attach(GTK_TABLE(table5), entColonFile, 1, 2, 0, 1, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
gtk_tooltips_set_tip(tooltips, entColonFile, "The colon file to use, each line has to be structured like \"mylogin:mypass\"", NULL);
label20 = gtk_label_new("Colon separated file");
@@ -568,21 +564,21 @@ GtkWidget *create_wndMain(void) {
chkPassLogin = gtk_check_button_new_with_mnemonic("Try login as password");
gtk_widget_set_name(chkPassLogin, "chkPassLogin");
gtk_widget_show(chkPassLogin);
gtk_table_attach(GTK_TABLE(table6), chkPassLogin, 0, 1, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_table_attach(GTK_TABLE(table6), chkPassLogin, 0, 1, 0, 1, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
gtk_tooltips_set_tip(tooltips, chkPassLogin, "Enable this option to try the login as password, in addition to the password/file", NULL);
chkPassNull = gtk_check_button_new_with_mnemonic("Try empty password");
gtk_widget_set_name(chkPassNull, "chkPassNull");
gtk_widget_show(chkPassNull);
gtk_table_attach(GTK_TABLE(table6), chkPassNull, 1, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_table_attach(GTK_TABLE(table6), chkPassNull, 1, 2, 0, 1, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
gtk_tooltips_set_tip(tooltips, chkPassNull, "Enable this option to try an empty password, in addition to the password/file", NULL);
chkPassReverse = gtk_check_button_new_with_mnemonic ("Try reversed login");
gtk_widget_set_name (chkPassReverse, "chkPassReverse");
gtk_widget_show (chkPassReverse);
gtk_table_attach (GTK_TABLE (table6), chkPassReverse, 2, 3, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_tooltips_set_tip (tooltips, chkPassReverse, "Enable this option to try an reverse password, in addition to the password/file", NULL);
chkPassReverse = gtk_check_button_new_with_mnemonic("Try reversed login");
gtk_widget_set_name(chkPassReverse, "chkPassReverse");
gtk_widget_show(chkPassReverse);
gtk_table_attach(GTK_TABLE(table6), chkPassReverse, 2, 3, 0, 1, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
gtk_tooltips_set_tip(tooltips, chkPassReverse, "Enable this option to try an reverse password, in addition to the password/file", NULL);
label2 = gtk_label_new("Passwords");
gtk_widget_set_name(label2, "label2");
gtk_widget_show(label2);
@@ -596,7 +592,7 @@ GtkWidget *create_wndMain(void) {
frame9 = gtk_frame_new(NULL);
gtk_widget_set_name(frame9, "frame9");
gtk_widget_show(frame9);
gtk_table_attach(GTK_TABLE(table4), frame9, 0, 1, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK | GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK | GTK_FILL), 0, 0);
gtk_table_attach(GTK_TABLE(table4), frame9, 0, 1, 1, 2, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK | GTK_FILL), (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK | GTK_FILL), 0, 0);
table7 = gtk_table_new(5, 2, FALSE);
gtk_widget_set_name(table7, "table7");
@@ -606,58 +602,58 @@ GtkWidget *create_wndMain(void) {
label22 = gtk_label_new("Proxy ");
gtk_widget_set_name(label22, "label22");
gtk_widget_show(label22);
gtk_table_attach(GTK_TABLE(table7), label22, 0, 1, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_table_attach(GTK_TABLE(table7), label22, 0, 1, 1, 2, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
gtk_misc_set_alignment(GTK_MISC(label22), 0, 0.5);
entHTTPProxy = gtk_entry_new();
gtk_widget_set_name(entHTTPProxy, "entHTTPProxy");
gtk_widget_show(entHTTPProxy);
gtk_table_attach(GTK_TABLE(table7), entHTTPProxy, 1, 2, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_table_attach(GTK_TABLE(table7), entHTTPProxy, 1, 2, 1, 2, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
gtk_tooltips_set_tip(tooltips, entHTTPProxy, "The address of the proxy. Syntax: \"http://123.45.67.89:8080\"", NULL);
gtk_entry_set_text(GTK_ENTRY(entHTTPProxy), "http://127.0.0.1:8080");
chkProxyAuth = gtk_check_button_new_with_mnemonic("Proxy needs authentication");
gtk_widget_set_name(chkProxyAuth, "chkProxyAuth");
gtk_widget_show(chkProxyAuth);
gtk_table_attach(GTK_TABLE(table7), chkProxyAuth, 0, 1, 2, 3, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_table_attach(GTK_TABLE(table7), chkProxyAuth, 0, 1, 2, 3, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
gtk_tooltips_set_tip(tooltips, chkProxyAuth, "Enable this if the proxy requires authenticatio", NULL);
label23 = gtk_label_new("Username");
gtk_widget_set_name(label23, "label23");
gtk_widget_show(label23);
gtk_table_attach(GTK_TABLE(table7), label23, 0, 1, 3, 4, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_table_attach(GTK_TABLE(table7), label23, 0, 1, 3, 4, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
gtk_misc_set_alignment(GTK_MISC(label23), 0, 0.5);
entProxyUser = gtk_entry_new();
gtk_widget_set_name(entProxyUser, "entProxyUser");
gtk_widget_show(entProxyUser);
gtk_table_attach(GTK_TABLE(table7), entProxyUser, 1, 2, 3, 4, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_table_attach(GTK_TABLE(table7), entProxyUser, 1, 2, 3, 4, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
gtk_tooltips_set_tip(tooltips, entProxyUser, "The user name for proxy authentication", NULL);
gtk_entry_set_text(GTK_ENTRY(entProxyUser), "yourname");
label24 = gtk_label_new("Password");
gtk_widget_set_name(label24, "label24");
gtk_widget_show(label24);
gtk_table_attach(GTK_TABLE(table7), label24, 0, 1, 4, 5, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_table_attach(GTK_TABLE(table7), label24, 0, 1, 4, 5, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
gtk_misc_set_alignment(GTK_MISC(label24), 0, 0.5);
entProxyPass = gtk_entry_new();
gtk_widget_set_name(entProxyPass, "entProxyPass");
gtk_widget_show(entProxyPass);
gtk_table_attach(GTK_TABLE(table7), entProxyPass, 1, 2, 4, 5, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_table_attach(GTK_TABLE(table7), entProxyPass, 1, 2, 4, 5, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
gtk_tooltips_set_tip(tooltips, entProxyPass, "The password for proxy authentication", NULL);
gtk_entry_set_text(GTK_ENTRY(entProxyPass), "yourpass");
label26 = gtk_label_new("");
gtk_widget_set_name(label26, "label26");
gtk_widget_show(label26);
gtk_table_attach(GTK_TABLE(table7), label26, 1, 2, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
gtk_table_attach(GTK_TABLE(table7), label26, 1, 2, 2, 3, (GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(0), 0, 0);
gtk_misc_set_alignment(GTK_MISC(label26), 0, 0.5);
hbox3 = gtk_hbox_new(FALSE, 0);
gtk_widget_set_name(hbox3, "hbox3");
gtk_widget_show(hbox3);
gtk_table_attach(GTK_TABLE(table7), hbox3, 0, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK | GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
gtk_table_attach(GTK_TABLE(table7), hbox3, 0, 2, 0, 1, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK | GTK_FILL), (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 0, 0);
radioProxy = gtk_radio_button_new_with_mnemonic(NULL, "No Proxy");
gtk_widget_set_name(radioProxy, "radioProxy");
@@ -691,7 +687,7 @@ GtkWidget *create_wndMain(void) {
frame13 = gtk_frame_new(NULL);
gtk_widget_set_name(frame13, "frame13");
gtk_widget_show(frame13);
gtk_table_attach(GTK_TABLE(table4), frame13, 0, 1, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
gtk_table_attach(GTK_TABLE(table4), frame13, 0, 1, 0, 1, (GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 0, 0);
table10 = gtk_table_new(5, 2, FALSE);
gtk_widget_set_name(table10, "table10");
@@ -701,50 +697,46 @@ GtkWidget *create_wndMain(void) {
chkExitf = gtk_check_button_new_with_mnemonic("Exit after first found pair (per host)");
gtk_widget_set_name(chkExitf, "chkExitf");
gtk_widget_show(chkExitf);
gtk_table_attach(GTK_TABLE(table10), chkExitf, 0, 2, 2, 3, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_table_attach(GTK_TABLE(table10), chkExitf, 0, 2, 2, 3, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
gtk_tooltips_set_tip(tooltips, chkExitf, "Enable this to stop all attacking processes once a valid login/password pair is found (per host)", NULL);
spnTimeout_adj = gtk_adjustment_new(30, 0, 295, 1, 10, 0);
spnTimeout = gtk_spin_button_new(GTK_ADJUSTMENT(spnTimeout_adj), 1, 0);
gtk_widget_set_name(spnTimeout, "spnTimeout");
gtk_widget_show(spnTimeout);
gtk_table_attach(GTK_TABLE(table10), spnTimeout, 1, 2, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_table_attach(GTK_TABLE(table10), spnTimeout, 1, 2, 1, 2, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
gtk_tooltips_set_tip(tooltips, spnTimeout, "The maximum timeout an attack process is waiting for a response from the target", NULL);
spnTasks_adj = gtk_adjustment_new(16, 0, 128, 1, 10, 0);
spnTasks = gtk_spin_button_new(GTK_ADJUSTMENT(spnTasks_adj), 1, 0);
gtk_widget_set_name(spnTasks, "spnTasks");
gtk_widget_show(spnTasks);
gtk_table_attach(GTK_TABLE(table10), spnTasks, 1, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_table_attach(GTK_TABLE(table10), spnTasks, 1, 2, 0, 1, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
gtk_tooltips_set_tip(tooltips, spnTasks, "The number of attack tasks to run in parallel. The more the faster, the most: computer lockup :-) 16-64 is a good choice", NULL);
label32 = gtk_label_new("Timeout");
gtk_widget_set_name(label32, "label32");
gtk_widget_show(label32);
gtk_table_attach(GTK_TABLE(table10), label32, 0, 1, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_table_attach(GTK_TABLE(table10), label32, 0, 1, 1, 2, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
gtk_misc_set_alignment(GTK_MISC(label32), 0, 0.5);
label31 = gtk_label_new("Number of Tasks");
gtk_widget_set_name(label31, "label31");
gtk_widget_show(label31);
gtk_table_attach(GTK_TABLE(table10), label31, 0, 1, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_table_attach(GTK_TABLE(table10), label31, 0, 1, 0, 1, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
gtk_misc_set_alignment(GTK_MISC(label31), 0, 0.5);
chkExitF = gtk_check_button_new_with_mnemonic ("Exit after first found pair (global)");
gtk_widget_set_name (chkExitF, "chkExitF");
gtk_widget_show (chkExitF);
gtk_table_attach (GTK_TABLE (table10), chkExitF, 0, 2, 3, 4,
(GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK),
(GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_tooltips_set_tip (tooltips, chkExitF, "Enable this to stop all attacking processes once a valid login/password pair is found (global)", NULL);
chkExitF = gtk_check_button_new_with_mnemonic("Exit after first found pair (global)");
gtk_widget_set_name(chkExitF, "chkExitF");
gtk_widget_show(chkExitF);
gtk_table_attach(GTK_TABLE(table10), chkExitF, 0, 2, 3, 4, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
gtk_tooltips_set_tip(tooltips, chkExitF, "Enable this to stop all attacking processes once a valid login/password pair is found (global)", NULL);
chkNoErr = gtk_check_button_new_with_mnemonic ("Do not print messages about connection errors");
gtk_widget_set_name (chkNoErr, "chkNoErr");
gtk_widget_show (chkNoErr);
gtk_table_attach (GTK_TABLE (table10), chkNoErr, 0, 2, 4, 5,
(GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK),
(GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_tooltips_set_tip (tooltips, chkNoErr, "Do not print messages about connection errors", NULL);
chkNoErr = gtk_check_button_new_with_mnemonic("Do not print messages about connection errors");
gtk_widget_set_name(chkNoErr, "chkNoErr");
gtk_widget_show(chkNoErr);
gtk_table_attach(GTK_TABLE(table10), chkNoErr, 0, 2, 4, 5, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_EXPAND), 0, 0);
gtk_tooltips_set_tip(tooltips, chkNoErr, "Do not print messages about connection errors", NULL);
label30 = gtk_label_new("Performance Options");
gtk_widget_set_name(label30, "label30");
@@ -843,25 +835,42 @@ GtkWidget *create_wndMain(void) {
gtk_widget_set_name(chkLocal, "chkLocal");
gtk_widget_show(chkLocal);
gtk_box_pack_start(GTK_BOX(hbox2), chkLocal, TRUE, TRUE, 0);
gtk_tooltips_set_tip(tooltips, chkLocal, "Just attack local accounts", NULL);
gtk_tooltips_set_tip(tooltips, chkLocal, "Just attack local accounts (only valid for smb module)", NULL);
chkDomain = gtk_check_button_new_with_mnemonic("domain accounts");
gtk_widget_set_name(chkDomain, "chkDomain");
gtk_widget_show(chkDomain);
gtk_box_pack_start(GTK_BOX(hbox2), chkDomain, TRUE, TRUE, 0);
gtk_tooltips_set_tip(tooltips, chkDomain, "Attack domain and local accounts", NULL);
gtk_tooltips_set_tip(tooltips, chkDomain, "Attack domain and local accounts (only valid for smb module)", NULL);
chkNTLM = gtk_check_button_new_with_mnemonic("Interpret passes as NTLM hashes");
gtk_widget_set_name(chkNTLM, "chkNTLM");
gtk_widget_show(chkNTLM);
gtk_box_pack_start(GTK_BOX(hbox2), chkNTLM, FALSE, FALSE, 0);
gtk_tooltips_set_tip(tooltips, chkNTLM, "Interpret passes as NTML hashes", NULL);
gtk_tooltips_set_tip(tooltips, chkNTLM, "Interpret passes as NTML hashes (valid for both smb and smb2 modules)", NULL);
label18 = gtk_label_new("SMB");
gtk_widget_set_name(label18, "label18");
gtk_widget_show(label18);
gtk_frame_set_label_widget(GTK_FRAME(frame6), label18);
fraSMB2 = gtk_frame_new(NULL);
gtk_widget_set_name(fraSMB2, "fraSMB2");
gtk_widget_show(fraSMB2);
gtk_box_pack_start(GTK_BOX(vbox4), fraSMB2, TRUE, TRUE, 0);
entSMB2Workgroup = gtk_entry_new();
gtk_widget_set_name(entSMB2Workgroup, "entSMB2Workgroup");
gtk_widget_show(entSMB2Workgroup);
gtk_container_add(GTK_CONTAINER(fraSMB2), entSMB2Workgroup);
gtk_tooltips_set_tip(tooltips, entSMB2Workgroup, "Workgroup to use for SMB authentication (only valid for smb2 module)", NULL);
gtk_entry_set_text(GTK_ENTRY(entSMB2Workgroup), "WORKGROUP");
lblSMB2 = gtk_label_new("SMB2 Workgroup");
gtk_widget_set_name(lblSMB2, "lblSMB2");
gtk_widget_show(lblSMB2);
gtk_frame_set_label_widget(GTK_FRAME(fraSMB2), lblSMB2);
frame7 = gtk_frame_new(NULL);
gtk_widget_set_name(frame7, "frame7");
gtk_widget_show(frame7);
@@ -910,7 +919,7 @@ GtkWidget *create_wndMain(void) {
gtk_widget_set_name(entTelnet, "entTelnet");
gtk_widget_show(entTelnet);
gtk_container_add(GTK_CONTAINER(alignment1), entTelnet);
gtk_tooltips_set_tip(tooltips, entTelnet, "Insert the return string for a succesfull login", NULL);
gtk_tooltips_set_tip(tooltips, entTelnet, "Insert the return string for a successful login", NULL);
label36 = gtk_label_new("Telnet - Successful Login String");
gtk_widget_set_name(label36, "label36");
@@ -1011,18 +1020,18 @@ GtkWidget *create_wndMain(void) {
gtk_widget_show(statusbar);
gtk_box_pack_start(GTK_BOX(vbox1), statusbar, FALSE, FALSE, 0);
g_signal_connect((gpointer) wndMain, "destroy", G_CALLBACK(on_wndMain_destroy), NULL);
g_signal_connect((gpointer) quit1, "button-press-event", G_CALLBACK(on_quit1_activate), NULL);
g_signal_connect((gpointer) entTargetFile, "button_press_event", G_CALLBACK(on_entTargetFile_button_press_event), NULL);
g_signal_connect((gpointer) entUsernameFile, "button_press_event", G_CALLBACK(on_entUsernameFile_button_press_event), NULL);
g_signal_connect((gpointer) chkDisUser, "toggled", G_CALLBACK (on_chkDisUser_toggled), NULL);
g_signal_connect((gpointer) entPassFile, "button_press_event", G_CALLBACK(on_entPassFile_button_press_event), NULL);
g_signal_connect((gpointer) chkColon, "toggled", G_CALLBACK(on_chkColon_toggled), NULL);
g_signal_connect((gpointer) entColonFile, "button_press_event", G_CALLBACK(on_entColonFile_button_press_event), NULL);
g_signal_connect((gpointer) btnStart, "clicked", G_CALLBACK(on_btnStart_clicked), NULL);
g_signal_connect((gpointer) btnStop, "clicked", G_CALLBACK(on_btnStop_clicked), NULL);
g_signal_connect((gpointer) btnSave, "clicked", G_CALLBACK(on_btnSave_clicked), NULL);
g_signal_connect((gpointer) btnClear, "clicked", G_CALLBACK(on_btnClear_clicked), NULL);
g_signal_connect((gpointer)wndMain, "destroy", G_CALLBACK(on_wndMain_destroy), NULL);
g_signal_connect((gpointer)quit1, "button-press-event", G_CALLBACK(on_quit1_activate), NULL);
g_signal_connect((gpointer)entTargetFile, "button_press_event", G_CALLBACK(on_entTargetFile_button_press_event), NULL);
g_signal_connect((gpointer)entUsernameFile, "button_press_event", G_CALLBACK(on_entUsernameFile_button_press_event), NULL);
g_signal_connect((gpointer)chkDisUser, "toggled", G_CALLBACK(on_chkDisUser_toggled), NULL);
g_signal_connect((gpointer)entPassFile, "button_press_event", G_CALLBACK(on_entPassFile_button_press_event), NULL);
g_signal_connect((gpointer)chkColon, "toggled", G_CALLBACK(on_chkColon_toggled), NULL);
g_signal_connect((gpointer)entColonFile, "button_press_event", G_CALLBACK(on_entColonFile_button_press_event), NULL);
g_signal_connect((gpointer)btnStart, "clicked", G_CALLBACK(on_btnStart_clicked), NULL);
g_signal_connect((gpointer)btnStop, "clicked", G_CALLBACK(on_btnStop_clicked), NULL);
g_signal_connect((gpointer)btnSave, "clicked", G_CALLBACK(on_btnSave_clicked), NULL);
g_signal_connect((gpointer)btnClear, "clicked", G_CALLBACK(on_btnClear_clicked), NULL);
/* Store pointers to all widgets, for use by lookup_widget(). */
GLADE_HOOKUP_OBJECT_NO_REF(wndMain, wndMain, "wndMain");
@@ -1063,7 +1072,7 @@ GtkWidget *create_wndMain(void) {
GLADE_HOOKUP_OBJECT(wndMain, radioUsername1, "radioUsername1");
GLADE_HOOKUP_OBJECT(wndMain, chkUsernameLoop, "chkUsernameLoop");
GLADE_HOOKUP_OBJECT(wndMain, radioUsername2, "radioUsername2");
GLADE_HOOKUP_OBJECT (wndMain, chkDisUser, "chkDisUser");
GLADE_HOOKUP_OBJECT(wndMain, chkDisUser, "chkDisUser");
GLADE_HOOKUP_OBJECT(wndMain, label8, "label8");
GLADE_HOOKUP_OBJECT(wndMain, frmPass, "frmPass");
GLADE_HOOKUP_OBJECT(wndMain, table3, "table3");
@@ -1158,6 +1167,7 @@ GtkWidget *create_wndMain(void) {
GLADE_HOOKUP_OBJECT(wndMain, label4, "label4");
GLADE_HOOKUP_OBJECT(wndMain, statusbar, "statusbar");
GLADE_HOOKUP_OBJECT_NO_REF(wndMain, tooltips, "tooltips");
GLADE_HOOKUP_OBJECT(wndMain, entSMB2Workgroup, "entSMB2Workgroup");
gtk_window_add_accel_group(GTK_WINDOW(wndMain), accel_group);
Executable → Regular
View File
Executable → Regular
+8 -8
View File
@@ -8,19 +8,21 @@
#include <config.h>
#endif
#include <gtk/gtk.h>
#include <string.h>
#include "callbacks.h"
#include "interface.h"
#include "support.h"
#include "callbacks.h"
#include <gtk/gtk.h>
#include <string.h>
char *hydra_path1 = "./hydra";
char *hydra_path2 = "/usr/local/bin/hydra";
char *hydra_path3 = "/usr/bin/hydra";
GtkWidget *wndMain;
char *HYDRA_BIN;
guint message_id;
int main(int argc, char *argv[]) {
extern GtkWidget *wndMain;
int i;
extern guint message_id;
GtkWidget *output;
@@ -60,8 +62,7 @@ int main(int argc, char *argv[]) {
wndMain = create_wndMain();
gtk_widget_show(wndMain);
/* if we cant use the new cool file chooser, the save button gets disabled */
/* if we can't use the new cool file chooser, the save button gets disabled */
#ifndef GTK_TYPE_FILE_CHOOSER
GtkWidget *btnSave;
@@ -69,13 +70,12 @@ int main(int argc, char *argv[]) {
gtk_widget_set_sensitive(btnSave, FALSE);
#endif
/* update the statusbar every now and then */
g_timeout_add(600, update_statusbar, NULL);
/* we want bold text in the output window */
output = lookup_widget(GTK_WIDGET(wndMain), "txtOutput");
outputbuf = gtk_text_view_get_buffer((GtkTextView *) output);
outputbuf = gtk_text_view_get_buffer((GtkTextView *)output);
gtk_text_buffer_create_tag(outputbuf, "bold", "weight", PANGO_WEIGHT_BOLD, NULL);
/* he ho, lets go! */
Executable → Regular
+13 -16
View File
@@ -7,17 +7,17 @@
#include <config.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <gtk/gtk.h>
#include "support.h"
GtkWidget *lookup_widget(GtkWidget * widget, const gchar * widget_name) {
GtkWidget *lookup_widget(GtkWidget *widget, const gchar *widget_name) {
GtkWidget *parent, *found_widget;
for (;;) {
@@ -26,13 +26,13 @@ GtkWidget *lookup_widget(GtkWidget * widget, const gchar * widget_name) {
else
parent = widget->parent;
if (!parent)
parent = (GtkWidget *) g_object_get_data(G_OBJECT(widget), "GladeParentKey");
parent = (GtkWidget *)g_object_get_data(G_OBJECT(widget), "GladeParentKey");
if (parent == NULL)
break;
widget = parent;
}
found_widget = (GtkWidget *) g_object_get_data(G_OBJECT(widget), widget_name);
found_widget = (GtkWidget *)g_object_get_data(G_OBJECT(widget), widget_name);
if (!found_widget)
g_warning("Widget not found: %s", widget_name);
return found_widget;
@@ -41,19 +41,16 @@ GtkWidget *lookup_widget(GtkWidget * widget, const gchar * widget_name) {
static GList *pixmaps_directories = NULL;
/* Use this function to set the directory containing installed pixmaps. */
void add_pixmap_directory(const gchar * directory) {
pixmaps_directories = g_list_prepend(pixmaps_directories, g_strdup(directory));
}
void add_pixmap_directory(const gchar *directory) { pixmaps_directories = g_list_prepend(pixmaps_directories, g_strdup(directory)); }
/* This is an internally used function to find pixmap files. */
static gchar *find_pixmap_file(const gchar * filename) {
static gchar *find_pixmap_file(const gchar *filename) {
GList *elem;
/* We step through each of the pixmaps directory to find it. */
elem = pixmaps_directories;
while (elem) {
gchar *pathname = g_strdup_printf("%s%s%s", (gchar *) elem->data,
G_DIR_SEPARATOR_S, filename);
gchar *pathname = g_strdup_printf("%s%s%s", (gchar *)elem->data, G_DIR_SEPARATOR_S, filename);
if (g_file_test(pathname, G_FILE_TEST_EXISTS))
return pathname;
@@ -64,7 +61,7 @@ static gchar *find_pixmap_file(const gchar * filename) {
}
/* This is an internally used function to create pixmaps. */
GtkWidget *create_pixmap(GtkWidget * widget, const gchar * filename) {
GtkWidget *create_pixmap(GtkWidget *widget, const gchar *filename) {
gchar *pathname = NULL;
GtkWidget *pixmap;
@@ -84,7 +81,7 @@ GtkWidget *create_pixmap(GtkWidget * widget, const gchar * filename) {
}
/* This is an internally used function to create pixmaps. */
GdkPixbuf *create_pixbuf(const gchar * filename) {
GdkPixbuf *create_pixbuf(const gchar *filename) {
gchar *pathname = NULL;
GdkPixbuf *pixbuf;
GError *error = NULL;
@@ -109,7 +106,7 @@ GdkPixbuf *create_pixbuf(const gchar * filename) {
}
/* This is used to set ATK action descriptions. */
void glade_set_atk_action_description(AtkAction * action, const gchar * action_name, const gchar * description) {
void glade_set_atk_action_description(AtkAction *action, const gchar *action_name, const gchar *description) {
gint n_actions, i;
n_actions = atk_action_get_n_actions(action);
Executable → Regular
+8 -11
View File
@@ -19,27 +19,24 @@
* or alternatively any widget in the component, and the name of the widget
* you want returned.
*/
GtkWidget *lookup_widget(GtkWidget * widget, const gchar * widget_name);
GtkWidget *lookup_widget(GtkWidget *widget, const gchar *widget_name);
/* Use this function to set the directory containing installed pixmaps. */
void add_pixmap_directory(const gchar * directory);
void add_pixmap_directory(const gchar *directory);
/*
* Private Functions.
*/
/* This is used to create the pixmaps used in the interface. */
GtkWidget *create_pixmap(GtkWidget * widget, const gchar * filename);
GtkWidget *create_pixmap(GtkWidget *widget, const gchar *filename);
/* This is used to create the pixbufs used in the interface. */
GdkPixbuf *create_pixbuf(const gchar * filename);
GdkPixbuf *create_pixbuf(const gchar *filename);
/* This is used to set ATK action descriptions. */
void glade_set_atk_action_description(AtkAction * action, const gchar * action_name, const gchar * description);
void glade_set_atk_action_description(AtkAction *action, const gchar *action_name, const gchar *description);
GtkWidget *wndMain;
char *HYDRA_BIN;
guint message_id;
extern GtkWidget *wndMain;
extern char *HYDRA_BIN;
extern guint message_id;
Executable → Regular
View File
Executable → Regular
+21 -1
View File
@@ -549,6 +549,26 @@
<property name="label" translatable="yes">xmpp</property>
</widget>
</child>
<child>
<widget class="GtkListItem" id="listitem2120">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">adam6500</property>
</widget>
</child>
<child>
<widget class="GtkListItem" id="listitem2121">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">rpcap</property>
</widget>
</child>
<widget class="GtkListItem" id="listitem2122">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">rtsp</property>
</widget>
</child>
</widget>
</child>
@@ -2320,7 +2340,7 @@ addresses and/or DNS names.</property>
<child>
<widget class="GtkEntry" id="entTelnet">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Insert the return string for a succesfull login</property>
<property name="tooltip" translatable="yes">Insert the return string for a successful login</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
Executable → Regular
View File
+644 -383
View File
File diff suppressed because it is too large Load Diff
+90 -69
View File
@@ -3,15 +3,15 @@
extern char *HYDRA_EXIT;
char *buf;
static int http_proxy_auth_mechanism = AUTH_ERROR;
static int32_t http_proxy_auth_mechanism = AUTH_ERROR;
int start_http_proxy_urlenum(int s, char *ip, int port, unsigned char options, char *miscptr, FILE * fp, char *hostname) {
int32_t start_http_proxy_urlenum(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp, char *hostname) {
char *empty = "";
char *login, *pass, buffer[500], buffer2[500], mlogin[260], mpass[260], mhost[260];
char url[260], host[30];
char *header = ""; /* XXX TODO */
char *header = ""; /* XXX TODO */
char *ptr;
int auth = 0;
int32_t auth = 0;
login = hydra_get_next_login();
if (login == NULL || strlen(login) == 0 || strstr(login, "://") == NULL) {
@@ -19,7 +19,7 @@ int start_http_proxy_urlenum(int s, char *ip, int port, unsigned char options, c
return 1;
}
pass = hydra_get_next_password();
pass = empty; // ignored
pass = empty; // ignored
strncpy(url, login, sizeof(url) - 1);
url[sizeof(url) - 1] = 0;
@@ -28,17 +28,17 @@ int start_http_proxy_urlenum(int s, char *ip, int port, unsigned char options, c
ptr++;
strncpy(mhost, ptr, sizeof(mhost) - 1);
mhost[sizeof(mhost) - 1] = 0;
if ((ptr = index(mhost, '/')) != NULL)
if ((ptr = strchr(mhost, '/')) != NULL)
*ptr = 0;
if ((ptr = index(mhost, ']')) != NULL)
if ((ptr = strchr(mhost, ']')) != NULL)
*ptr = 0;
else if ((ptr = index(mhost, ':')) != NULL)
else if ((ptr = strchr(mhost, ':')) != NULL)
*ptr = 0;
if (miscptr != NULL && index(miscptr, ':') != NULL) {
if (miscptr != NULL && strchr(miscptr, ':') != NULL) {
strncpy(mlogin, miscptr, sizeof(mlogin) - 1);
mlogin[sizeof(mlogin) - 1] = 0;
ptr = index(mlogin, ':');
ptr = strchr(mlogin, ':');
*ptr++ = 0;
strncpy(mpass, ptr, sizeof(mpass) - 1);
mpass[sizeof(mpass) - 1] = 0;
@@ -46,12 +46,12 @@ int start_http_proxy_urlenum(int s, char *ip, int port, unsigned char options, c
}
if (http_proxy_auth_mechanism == AUTH_ERROR) {
//send dummy request
// send dummy request
sprintf(buffer, "GET %s HTTP/1.0\r\n%sUser-Agent: Mozilla/4.0 (Hydra)\r\n%s\r\n", url, mhost, header);
if (hydra_send(s, buffer, strlen(buffer), 0) < 0)
return 1;
//receive first 40x
// receive first 40x
buf = hydra_receive_line(s);
while (buf != NULL && strstr(buf, "HTTP/") == NULL) {
free(buf);
@@ -61,7 +61,7 @@ int start_http_proxy_urlenum(int s, char *ip, int port, unsigned char options, c
if (debug)
hydra_report(stderr, "S:%s\n", buf);
//after the first query we should have been disconnected from web server
// after the first query we should have been disconnected from web server
s = hydra_disconnect(s);
if ((options & OPTION_SSL) == 0) {
s = hydra_connect_tcp(ip, port);
@@ -74,8 +74,11 @@ int start_http_proxy_urlenum(int s, char *ip, int port, unsigned char options, c
if (hydra_strcasestr(buf, "Proxy-Authenticate: Basic") != NULL) {
http_proxy_auth_mechanism = AUTH_BASIC;
sprintf(buffer2, "%.50s:%.50s", login, pass);
hydra_tobase64((unsigned char *) buffer2, strlen(buffer2), sizeof(buffer2));
sprintf(buffer, "GET %s HTTP/1.0\r\n%sProxy-Authorization: Basic %s\r\nUser-Agent: Mozilla/4.0 (Hydra)\r\n%s\r\n", url, host, buffer2, header);
hydra_tobase64((unsigned char *)buffer2, strlen(buffer2), sizeof(buffer2));
sprintf(buffer,
"GET %s HTTP/1.0\r\n%sProxy-Authorization: Basic "
"%s\r\nUser-Agent: Mozilla/4.0 (Hydra)\r\n%s\r\n",
url, host, buffer2, header);
if (debug)
hydra_report(stderr, "C:%s\n", buffer);
if (hydra_send(s, buffer, strlen(buffer), 0) < 0)
@@ -87,8 +90,8 @@ int start_http_proxy_urlenum(int s, char *ip, int port, unsigned char options, c
buf = hydra_receive_line(s);
}
//if server cut the connection, just exit cleanly or
//this will be an infinite loop
// if server cut the connection, just exit cleanly or
// this will be an infinite loop
if (buf == NULL) {
if (verbose)
hydra_report(stderr, "[ERROR] Server did not answer\n");
@@ -104,19 +107,23 @@ int start_http_proxy_urlenum(int s, char *ip, int port, unsigned char options, c
char *pos = NULL;
http_proxy_auth_mechanism = AUTH_NTLM;
//send auth and receive challenge
//send auth request: let the server send it's own hostname and domainname
buildAuthRequest((tSmbNtlmAuthRequest *) buf2, 0, NULL, NULL);
to64frombits(buf1, buf2, SmbLength((tSmbNtlmAuthRequest *) buf2));
// send auth and receive challenge
// send auth request: let the server send it's own hostname and
// domainname
buildAuthRequest((tSmbNtlmAuthRequest *)buf2, 0, NULL, NULL);
to64frombits(buf1, buf2, SmbLength((tSmbNtlmAuthRequest *)buf2));
/* to be portable, no snprintf, buffer is big enough so it cant overflow */
//send the first..
sprintf(buffer, "GET %s HTTP/1.0\r\n%sProxy-Authorization: NTLM %s\r\nUser-Agent: Mozilla/4.0 (Hydra)\r\nProxy-Connection: keep-alive\r\n%s\r\n", url, host, buf1,
header);
/* to be portable, no snprintf, buffer is big enough so it can't
* overflow */
// send the first..
sprintf(buffer,
"GET %s HTTP/1.0\r\n%sProxy-Authorization: NTLM %s\r\nUser-Agent: "
"Mozilla/4.0 (Hydra)\r\nProxy-Connection: keep-alive\r\n%s\r\n",
url, host, buf1, header);
if (hydra_send(s, buffer, strlen(buffer), 0) < 0)
return 1;
//receive challenge
// receive challenge
free(buf);
buf = hydra_receive_line(s);
while (buf != NULL && (pos = hydra_strcasestr(buf, "Proxy-Authenticate: NTLM ")) == NULL) {
@@ -134,17 +141,19 @@ int start_http_proxy_urlenum(int s, char *ip, int port, unsigned char options, c
pos[str - pos] = 0;
}
}
//recover challenge
// recover challenge
if (buf != NULL) {
if (strlen(buf) >= 4)
from64tobits((char *) buf1, pos);
from64tobits((char *)buf1, pos);
free(buf);
}
//Send response
buildAuthResponse((tSmbNtlmAuthChallenge *) buf1, (tSmbNtlmAuthResponse *) buf2, 0, login, pass, NULL, NULL);
to64frombits(buf1, buf2, SmbLength((tSmbNtlmAuthResponse *) buf2));
sprintf(buffer, "GET %s HTTP/1.0\r\n%sProxy-Authorization: NTLM %s\r\nUser-Agent: Mozilla/4.0 (Hydra)\r\nProxy-Connection: keep-alive\r\n%s\r\n", url, host, buf1,
header);
// Send response
buildAuthResponse((tSmbNtlmAuthChallenge *)buf1, (tSmbNtlmAuthResponse *)buf2, 0, login, pass, NULL, NULL);
to64frombits(buf1, buf2, SmbLength((tSmbNtlmAuthResponse *)buf2));
sprintf(buffer,
"GET %s HTTP/1.0\r\n%sProxy-Authorization: NTLM %s\r\nUser-Agent: "
"Mozilla/4.0 (Hydra)\r\nProxy-Connection: keep-alive\r\n%s\r\n",
url, host, buf1, header);
if (debug)
hydra_report(stderr, "C:%s\n", buffer);
if (hydra_send(s, buffer, strlen(buffer), 0) < 0)
@@ -161,7 +170,7 @@ int start_http_proxy_urlenum(int s, char *ip, int port, unsigned char options, c
} else {
#ifdef LIBOPENSSL
if (hydra_strcasestr(buf, "Proxy-Authenticate: Digest") != NULL) {
char *pbuffer;
char *pbuffer, *result;
http_proxy_auth_mechanism = AUTH_DIGESTMD5;
pbuffer = hydra_strcasestr(buf, "Proxy-Authenticate: Digest ");
@@ -169,8 +178,8 @@ int start_http_proxy_urlenum(int s, char *ip, int port, unsigned char options, c
buffer[sizeof(buffer) - 1] = '\0';
pbuffer = buffer2;
sasl_digest_md5(pbuffer, login, pass, buffer, miscptr, "proxy", host, 0, header);
if (pbuffer == NULL)
result = sasl_digest_md5(pbuffer, login, pass, buffer, miscptr, "proxy", host, 0, header);
if (result == NULL)
return 3;
if (debug)
@@ -206,15 +215,15 @@ int start_http_proxy_urlenum(int s, char *ip, int port, unsigned char options, c
}
}
// result analysis
ptr = ((char *) index(buf, ' ')) + 1;
ptr = ((char *)strchr(buf, ' ')) + 1;
if (*ptr == '2' || (*ptr == '3' && (*(ptr + 2) == '1' || *(ptr + 2) == '2')) || strncmp(ptr, "404", 4) == 0 || strncmp(ptr, "403", 4) == 0) {
hydra_report_found_host(port, ip, "http-proxy", fp);
if (fp != stdout)
fprintf(fp, "[%d][http-proxy-urlenum] host: %s url: %s\n", port, hydra_address2string(ip), url);
printf("[%d][http-proxy-urlenum] host: %s url: %s\n", port, hydra_address2string(ip), url);
fprintf(fp, "[%d][http-proxy-urlenum] host: %s url: %s\n", port, hydra_address2string_beautiful(ip), url);
printf("[%d][http-proxy-urlenum] host: %s url: %s\n", port, hydra_address2string_beautiful(ip), url);
hydra_completed_pair_found();
} else {
if (strncmp(ptr, "407", 3) == 0 /*|| strncmp(ptr, "401", 3) == 0 */ ) {
if (strncmp(ptr, "407", 3) == 0 /*|| strncmp(ptr, "401", 3) == 0 */) {
hydra_report(stderr, "[ERROR] Proxy reports bad credentials!\n");
return 3;
}
@@ -228,9 +237,9 @@ int start_http_proxy_urlenum(int s, char *ip, int port, unsigned char options, c
return 1;
}
void service_http_proxy_urlenum(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int run = 1, next_run = 1, sock = -1;
int myport = PORT_HTTP_PROXY, mysslport = PORT_HTTP_PROXY_SSL;
void service_http_proxy_urlenum(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
int32_t run = 1, next_run = 1, sock = -1;
int32_t myport = PORT_HTTP_PROXY, mysslport = PORT_HTTP_PROXY_SSL;
hydra_register_socket(sp);
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
@@ -239,33 +248,34 @@ void service_http_proxy_urlenum(char *ip, int sp, unsigned char options, char *m
while (1) {
next_run = 0;
switch (run) {
case 1: /* connect and service init function */
{
if (sock >= 0)
sock = hydra_disconnect(sock);
// sleepn(275);
if ((options & OPTION_SSL) == 0) {
if (port != 0)
myport = port;
sock = hydra_connect_tcp(ip, myport);
port = myport;
} else {
if (port != 0)
mysslport = port;
sock = hydra_connect_ssl(ip, mysslport, hostname);
port = mysslport;
}
if (sock < 0) {
if (quiet != 1) fprintf(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int) getpid());
hydra_child_exit(1);
}
next_run = 2;
break;
case 1: /* connect and service init function */
{
if (sock >= 0)
sock = hydra_disconnect(sock);
// usleepn(275);
if ((options & OPTION_SSL) == 0) {
if (port != 0)
myport = port;
sock = hydra_connect_tcp(ip, myport);
port = myport;
} else {
if (port != 0)
mysslport = port;
sock = hydra_connect_ssl(ip, mysslport, hostname);
port = mysslport;
}
case 2: /* run the cracking function */
if (sock < 0) {
if (quiet != 1)
fprintf(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
hydra_child_exit(1);
}
next_run = 2;
break;
}
case 2: /* run the cracking function */
next_run = start_http_proxy_urlenum(sock, ip, port, options, miscptr, fp, hostname);
break;
case 3: /* clean exit */
case 3: /* clean exit */
if (sock >= 0)
sock = hydra_disconnect(sock);
hydra_child_exit(0);
@@ -278,16 +288,27 @@ void service_http_proxy_urlenum(char *ip, int sp, unsigned char options, char *m
}
}
int service_http_proxy_urlenum_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int32_t service_http_proxy_urlenum_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
//
// fill if needed.
//
//
// return codes:
// 0 all OK
// -1 error, hydra will exit, so print a good error message here
return 0;
}
void usage_http_proxy_urlenum(const char *service) {
printf("Module http-proxy-urlenum only uses the -L option, not -x or -p/-P "
"option.\n"
"The -L loginfile must contain the URL list to try through the proxy.\n"
"The proxy credentials cann be put as the optional parameter, e.g.\n"
" hydra -L urllist.txt -s 3128 target.com http-proxy-urlenum "
"user:pass\n"
" hydra -L urllist.txt "
"http-proxy-urlenum://target.com:3128/user:pass\n\n");
}
+113 -91
View File
@@ -2,15 +2,15 @@
#include "sasl.h"
extern char *HYDRA_EXIT;
static int http_proxy_auth_mechanism = AUTH_ERROR;
static int32_t http_proxy_auth_mechanism = AUTH_ERROR;
char *http_proxy_buf = NULL;
int start_http_proxy(int s, char *ip, int port, unsigned char options, char *miscptr, FILE * fp, char *hostname) {
int32_t start_http_proxy(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp, char *hostname) {
char *empty = "";
char *login, *pass, buffer[500], buffer2[500];
char url[210], host[30];
char *header = ""; /* XXX TODO */
char *ptr, *fooptr;
char *login, *pass, buffer[5000], buffer2[4500];
char url[510], host[60];
char *header = ""; /* XXX TODO */
char *ptr, *fooptr, *auth_hdr;
if (strlen(login = hydra_get_next_login()) == 0)
login = empty;
@@ -21,23 +21,23 @@ int start_http_proxy(int s, char *ip, int port, unsigned char options, char *mis
strcpy(url, "http://www.microsoft.com/");
strcpy(host, "Host: www.microsoft.com\r\n");
} else {
sprintf(url, "%.200s", miscptr);
ptr = strstr(miscptr, "://"); // :// check is in hydra.c
sprintf(host, "Host: %.200s", ptr + 3);
if ((ptr = index(host, '/')) != NULL)
sprintf(url, "%.500s", miscptr);
ptr = strstr(miscptr, "://"); // :// check is in hydra.c
sprintf(host, "Host: %.50s", ptr + 3);
if ((ptr = strchr(host, '/')) != NULL)
*ptr = 0;
if ((ptr = index(host + 6, ':')) != NULL && host[0] != '[')
if ((ptr = strchr(host + 6, ':')) != NULL && host[0] != '[')
*ptr = 0;
strcat(host, "\r\n");
}
if (http_proxy_auth_mechanism != AUTH_BASIC && (http_proxy_auth_mechanism == AUTH_ERROR || http_proxy_buf == NULL)) {
//send dummy request
// send dummy request
sprintf(buffer, "GET %s HTTP/1.0\r\n%sUser-Agent: Mozilla/4.0 (Hydra)\r\n%s\r\n", url, host, header);
if (hydra_send(s, buffer, strlen(buffer), 0) < 0)
return 3;
//receive first 40x
// receive first 40x
http_proxy_buf = hydra_receive_line(s);
while (http_proxy_buf != NULL && strstr(http_proxy_buf, "HTTP/") == NULL) {
free(http_proxy_buf);
@@ -50,26 +50,26 @@ int start_http_proxy(int s, char *ip, int port, unsigned char options, char *mis
return 3;
}
if (debug)
hydra_report(stderr, "S:%s\n", http_proxy_buf);
if (debug) {
hydra_report(stderr, "S:%-.*s\n", (int)(strchr(http_proxy_buf, '\r') - http_proxy_buf), http_proxy_buf);
}
free(http_proxy_buf);
http_proxy_buf = hydra_receive_line(s);
while (http_proxy_buf != NULL && hydra_strcasestr(http_proxy_buf, "Proxy-Authenticate:") == NULL) {
while (http_proxy_buf != NULL && (auth_hdr = hydra_strcasestr(http_proxy_buf, "Proxy-Authenticate:")) == NULL) {
free(http_proxy_buf);
http_proxy_buf = hydra_receive_line(s);
}
if (http_proxy_buf == NULL) {
if (auth_hdr == NULL) {
if (verbose)
hydra_report(stderr, "[ERROR] Proxy seems not to require authentication\n");
return 3;
}
if (debug)
hydra_report(stderr, "S:%s\n", http_proxy_buf);
if (debug) {
hydra_report(stderr, "S:%-.*s\n", (int)(strchr(auth_hdr, '\r') - auth_hdr), auth_hdr);
}
//after the first query we should have been disconnected from web server
// after the first query we should have been disconnected from web server
s = hydra_disconnect(s);
if ((options & OPTION_SSL) == 0) {
s = hydra_connect_tcp(ip, port);
@@ -78,11 +78,15 @@ int start_http_proxy(int s, char *ip, int port, unsigned char options, char *mis
}
}
if (http_proxy_auth_mechanism == AUTH_BASIC || hydra_strcasestr(http_proxy_buf, "Proxy-Authenticate: Basic") != NULL) {
if (http_proxy_auth_mechanism == AUTH_BASIC || hydra_strcasestr(auth_hdr, "Proxy-Authenticate: Basic") != NULL) {
http_proxy_auth_mechanism = AUTH_BASIC;
auth_hdr = NULL;
sprintf(buffer2, "%.50s:%.50s", login, pass);
hydra_tobase64((unsigned char *) buffer2, strlen(buffer2), sizeof(buffer2));
sprintf(buffer, "GET %s HTTP/1.0\r\n%sProxy-Authorization: Basic %s\r\nUser-Agent: Mozilla/4.0 (Hydra)\r\n%s\r\n", url, host, buffer2, header);
hydra_tobase64((unsigned char *)buffer2, strlen(buffer2), sizeof(buffer2));
sprintf(buffer,
"GET %s HTTP/1.0\r\n%sProxy-Authorization: Basic %s\r\nUser-Agent: "
"Mozilla/4.0 (Hydra)\r\n%s\r\n",
url, host, buffer2, header);
if (debug)
hydra_report(stderr, "C:%s\n", buffer);
if (hydra_send(s, buffer, strlen(buffer), 0) < 0)
@@ -94,36 +98,41 @@ int start_http_proxy(int s, char *ip, int port, unsigned char options, char *mis
http_proxy_buf = hydra_receive_line(s);
}
//if server cut the connection, just exit cleanly or
//this will be an infinite loop
// if server cut the connection, just exit cleanly or
// this will be an infinite loop
if (http_proxy_buf == NULL) {
if (verbose)
hydra_report(stderr, "[ERROR] Server did not answer\n");
return 3;
}
if (debug)
hydra_report(stderr, "S:%s\n", http_proxy_buf);
if (debug) {
hydra_report(stderr, "S:%-.*s\n", (int)(strchr(http_proxy_buf, '\r') - http_proxy_buf), http_proxy_buf);
}
} else {
if (http_proxy_auth_mechanism == AUTH_NTLM || hydra_strcasestr(http_proxy_buf, "Proxy-Authenticate: NTLM") != NULL) {
if (http_proxy_auth_mechanism == AUTH_NTLM || hydra_strcasestr(auth_hdr, "Proxy-Authenticate: NTLM") != NULL) {
unsigned char buf1[4096];
unsigned char buf2[4096];
char *pos = NULL;
http_proxy_auth_mechanism = AUTH_NTLM;
//send auth and receive challenge
//send auth request: let the server send it's own hostname and domainname
buildAuthRequest((tSmbNtlmAuthRequest *) buf2, 0, NULL, NULL);
to64frombits(buf1, buf2, SmbLength((tSmbNtlmAuthRequest *) buf2));
auth_hdr = NULL;
// send auth and receive challenge
// send auth request: let the server send it's own hostname and domainname
buildAuthRequest((tSmbNtlmAuthRequest *)buf2, 0, NULL, NULL);
to64frombits(buf1, buf2, SmbLength((tSmbNtlmAuthRequest *)buf2));
/* to be portable, no snprintf, buffer is big enough so it cant overflow */
//send the first..
sprintf(buffer, "GET %s HTTP/1.0\r\n%sProxy-Authorization: NTLM %s\r\nUser-Agent: Mozilla/4.0 (Hydra)\r\nProxy-Connection: keep-alive\r\n%s\r\n", url, host, buf1, header);
/* to be portable, no snprintf, buffer is big enough so it can't overflow
*/
// send the first..
sprintf(buffer,
"GET %s HTTP/1.0\r\n%sProxy-Authorization: NTLM %s\r\nUser-Agent: "
"Mozilla/4.0 (Hydra)\r\nProxy-Connection: keep-alive\r\n%s\r\n",
url, host, buf1, header);
if (hydra_send(s, buffer, strlen(buffer), 0) < 0)
return 3;
//receive challenge
// receive challenge
free(http_proxy_buf);
http_proxy_buf = hydra_receive_line(s);
while (http_proxy_buf != NULL && (pos = hydra_strcasestr(http_proxy_buf, "Proxy-Authenticate: NTLM ")) == NULL) {
@@ -141,24 +150,27 @@ int start_http_proxy(int s, char *ip, int port, unsigned char options, char *mis
pos[str - pos] = 0;
}
}
//recover challenge
// recover challenge
if (http_proxy_buf != NULL && strlen(http_proxy_buf) >= 4) {
from64tobits((char *) buf1, pos);
from64tobits((char *)buf1, pos);
free(http_proxy_buf);
http_proxy_buf = NULL;
return 3;
}
//Send response
buildAuthResponse((tSmbNtlmAuthChallenge *) buf1, (tSmbNtlmAuthResponse *) buf2, 0, login, pass, NULL, NULL);
to64frombits(buf1, buf2, SmbLength((tSmbNtlmAuthResponse *) buf2));
sprintf(buffer, "GET %s HTTP/1.0\r\n%sProxy-Authorization: NTLM %s\r\nUser-Agent: Mozilla/4.0 (Hydra)\r\nProxy-Connection: keep-alive\r\n%s\r\n", url, host, buf1, header);
// Send response
buildAuthResponse((tSmbNtlmAuthChallenge *)buf1, (tSmbNtlmAuthResponse *)buf2, 0, login, pass, NULL, NULL);
to64frombits(buf1, buf2, SmbLength((tSmbNtlmAuthResponse *)buf2));
sprintf(buffer,
"GET %s HTTP/1.0\r\n%sProxy-Authorization: NTLM %s\r\nUser-Agent: "
"Mozilla/4.0 (Hydra)\r\nProxy-Connection: keep-alive\r\n%s\r\n",
url, host, buf1, header);
if (debug)
hydra_report(stderr, "C:%s\n", buffer);
if (hydra_send(s, buffer, strlen(buffer), 0) < 0)
return 3;
if (http_proxy_buf != NULL)
free(http_proxy_buf);
free(http_proxy_buf);
http_proxy_buf = hydra_receive_line(s);
while (http_proxy_buf != NULL && strstr(http_proxy_buf, "HTTP/1.") == NULL) {
free(http_proxy_buf);
@@ -169,19 +181,19 @@ int start_http_proxy(int s, char *ip, int port, unsigned char options, char *mis
return 3;
} else {
#ifdef LIBOPENSSL
if (hydra_strcasestr(http_proxy_buf, "Proxy-Authenticate: Digest") != NULL) {
char *pbuffer;
if (hydra_strcasestr(auth_hdr, "Proxy-Authenticate: Digest") != NULL) {
char *pbuffer, *result;
http_proxy_auth_mechanism = AUTH_DIGESTMD5;
auth_hdr = NULL;
pbuffer = hydra_strcasestr(http_proxy_buf, "Proxy-Authenticate: Digest ");
strncpy(buffer, pbuffer + strlen("Proxy-Authenticate: Digest "), sizeof(buffer));
buffer[sizeof(buffer) - 1] = '\0';
pbuffer = NULL;
fooptr = buffer2;
sasl_digest_md5(fooptr, login, pass, buffer, miscptr, "proxy", host, 0, header);
if (fooptr == NULL)
result = sasl_digest_md5(fooptr, login, pass, buffer, miscptr, "proxy", host, 0, header);
if (result == NULL)
return 3;
if (debug)
@@ -196,8 +208,9 @@ int start_http_proxy(int s, char *ip, int port, unsigned char options, char *mis
http_proxy_buf = hydra_receive_line(s);
}
if (debug && http_proxy_buf != NULL)
hydra_report(stderr, "S:%s\n", http_proxy_buf);
if (debug && http_proxy_buf != NULL) {
hydra_report(stderr, "S:%-.*s\n", (int)(strchr(http_proxy_buf, '\r') - http_proxy_buf), http_proxy_buf);
}
if (http_proxy_buf == NULL)
return 3;
@@ -205,9 +218,10 @@ int start_http_proxy(int s, char *ip, int port, unsigned char options, char *mis
} else
#endif
{
if (http_proxy_buf != NULL) {
// buf[strlen(http_proxy_buf) - 1] = '\0';
hydra_report(stderr, "Unsupported Auth type:\n%s\n", http_proxy_buf);
if (auth_hdr != NULL) {
// buf[strlen(http_proxy_buf) - 1] = '\0';
hydra_report(stderr, "Unsupported Auth type:\n%-.*s\n", (int)(strchr(http_proxy_buf, '\r') - auth_hdr), auth_hdr);
auth_hdr = NULL;
free(http_proxy_buf);
http_proxy_buf = NULL;
} else {
@@ -218,15 +232,15 @@ int start_http_proxy(int s, char *ip, int port, unsigned char options, char *mis
}
}
ptr = ((char *) index(http_proxy_buf, ' ')) + 1;
if (*ptr == '2' || (*ptr == '3' && *(ptr + 2) == '1') || (*ptr == '3' && *(ptr + 2) == '2')) {
ptr = ((char *)strchr(http_proxy_buf, ' ')) + 1;
if (*ptr == '2' || (*ptr == '3' && *(ptr + 2) == '1') || (*ptr == '3' && *(ptr + 2) == '2') || (*ptr == '4' && *(ptr + 2) == '4')) {
hydra_report_found_host(port, ip, "http-proxy", fp);
hydra_completed_pair_found();
free(http_proxy_buf);
http_proxy_buf = NULL;
} else {
if (*ptr != '4')
hydra_report(stderr, "[INFO] Unusual return code: %c for %s:%s\n", (char) *(index(http_proxy_buf, ' ') + 1), login, pass);
hydra_report(stderr, "[INFO] Unusual return code: %c for %s:%s\n", (char)*(strchr(http_proxy_buf, ' ') + 1), login, pass);
else if (verbose && *(ptr + 2) == '3')
hydra_report(stderr, "[INFO] Potential success, could be false positive: %s:%s\n", login, pass);
hydra_completed_pair();
@@ -246,9 +260,9 @@ int start_http_proxy(int s, char *ip, int port, unsigned char options, char *mis
return 1;
}
void service_http_proxy(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int run = 1, next_run = 1, sock = -1;
int myport = PORT_HTTP_PROXY, mysslport = PORT_HTTP_PROXY_SSL;
void service_http_proxy(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
int32_t run = 1, next_run = 1, sock = -1;
int32_t myport = PORT_HTTP_PROXY, mysslport = PORT_HTTP_PROXY_SSL;
hydra_register_socket(sp);
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
@@ -257,36 +271,37 @@ void service_http_proxy(char *ip, int sp, unsigned char options, char *miscptr,
while (1) {
next_run = 0;
switch (run) {
case 1: /* connect and service init function */
{
if (http_proxy_buf != NULL)
free(http_proxy_buf);
if (sock >= 0)
sock = hydra_disconnect(sock);
// sleepn(275);
if ((options & OPTION_SSL) == 0) {
if (port != 0)
myport = port;
sock = hydra_connect_tcp(ip, myport);
port = myport;
} else {
if (port != 0)
mysslport = port;
sock = hydra_connect_ssl(ip, mysslport, hostname);
port = mysslport;
}
if (sock < 0) {
if (quiet != 1) fprintf(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int) getpid());
hydra_child_exit(1);
}
next_run = 2;
break;
case 1: /* connect and service init function */
{
if (http_proxy_buf != NULL)
free(http_proxy_buf);
if (sock >= 0)
sock = hydra_disconnect(sock);
// usleepn(275);
if ((options & OPTION_SSL) == 0) {
if (port != 0)
myport = port;
sock = hydra_connect_tcp(ip, myport);
port = myport;
} else {
if (port != 0)
mysslport = port;
sock = hydra_connect_ssl(ip, mysslport, hostname);
port = mysslport;
}
case 2: /* run the cracking function */
if (sock < 0) {
if (quiet != 1)
fprintf(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
hydra_child_exit(1);
}
next_run = 2;
break;
}
case 2: /* run the cracking function */
next_run = start_http_proxy(sock, ip, port, options, miscptr, fp, hostname);
break;
case 3: /* clean exit */
case 3: /* clean exit */
if (sock >= 0)
sock = hydra_disconnect(sock);
hydra_child_exit(0);
@@ -299,16 +314,23 @@ void service_http_proxy(char *ip, int sp, unsigned char options, char *miscptr,
}
}
int service_http_proxy_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int32_t service_http_proxy_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
//
// fill if needed.
//
//
// return codes:
// 0 all OK
// -1 error, hydra will exit, so print a good error message here
return 0;
}
void usage_http_proxy(const char *service) {
printf("Module http-proxy is optionally taking the page to authenticate at.\n"
"Default is http://www.microsoft.com/)\n"
"Basic, DIGEST-MD5 and NTLM are supported and negotiated "
"automatically.\n\n");
}
+316 -186
View File
@@ -1,19 +1,24 @@
#include "hydra-mod.h"
#include "hydra-http.h"
#include "sasl.h"
extern char *HYDRA_EXIT;
char *webtarget = NULL;
char *slash = "/";
char *http_buf = NULL;
int webport, freemischttp = 0;
int http_auth_mechanism = AUTH_BASIC;
int start_http(int s, char *ip, int port, unsigned char options, char *miscptr, FILE * fp, char *type) {
#define END_CONDITION_MAX_LEN 100
static char end_condition[END_CONDITION_MAX_LEN];
int end_condition_type = -1;
int32_t webport;
int32_t http_auth_mechanism = AUTH_UNASSIGNED;
int32_t start_http(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp, char *type, ptr_header_node ptr_head) {
char *empty = "";
char *login, *pass, buffer[500], buffer2[500];
char header[64] = "Content-Length: 0\r\n";
char *login, *pass, *buffer, buffer2[500];
char *header;
char *ptr, *fooptr;
int complete_line = 0;
int32_t complete_line = 0, buffer_size;
char tmpreplybuf[1024] = "", *tmpreplybufptr;
if (strlen(login = hydra_get_next_login()) == 0)
@@ -21,135 +26,179 @@ int start_http(int s, char *ip, int port, unsigned char options, char *miscptr,
if (strlen(pass = hydra_get_next_password()) == 0)
pass = empty;
if (strcmp(type, "POST") != 0)
header[0] = 0;
if (strcmp(type, "POST") == 0)
add_header(&ptr_head, "Content-Length", "0", HEADER_TYPE_DEFAULT);
header = stringify_headers(&ptr_head);
buffer_size = strlen(header) + 500;
if (!(buffer = malloc(buffer_size))) {
free(header);
return 3;
}
// we must reset this if buf is NULL and we do MD5 digest
if (http_buf == NULL && http_auth_mechanism == AUTH_DIGESTMD5)
http_auth_mechanism = AUTH_BASIC;
if (use_proxy > 0 && proxy_count > 0)
selected_proxy = random() % proxy_count;
switch (http_auth_mechanism) {
case AUTH_BASIC:
sprintf(buffer2, "%.50s:%.50s", login, pass);
hydra_tobase64((unsigned char *) buffer2, strlen(buffer2), sizeof(buffer2));
hydra_tobase64((unsigned char *)buffer2, strlen(buffer2), sizeof(buffer2));
/* again: no snprintf to be portable. dont worry, buffer cant overflow */
if (use_proxy == 1 && proxy_authentication != NULL)
sprintf(buffer, "%s http://%s:%d%.250s HTTP/1.1\r\nHost: %s\r\nConnection: close\r\nAuthorization: Basic %s\r\nProxy-Authorization: Basic %s\r\nUser-Agent: Mozilla/4.0 (Hydra)\r\n%s\r\n",
type, webtarget, webport, miscptr, webtarget, buffer2, proxy_authentication, header);
/* again: no snprintf to be portable. don't worry, buffer can't overflow */
if (use_proxy == 1 && proxy_authentication[selected_proxy] != NULL)
sprintf(buffer,
"%s http://%s:%d%.250s HTTP/1.1\r\nHost: %s\r\nConnection: "
"close\r\nAuthorization: Basic %s\r\nProxy-Authorization: Basic "
"%s\r\nUser-Agent: Mozilla/4.0 (Hydra)\r\n%s\r\n",
type, webtarget, webport, miscptr, webtarget, buffer2, proxy_authentication[selected_proxy], header);
else {
if (use_proxy == 1)
sprintf(buffer, "%s http://%s:%d%.250s HTTP/1.1\r\nHost: %s\r\nConnection: close\r\nAuthorization: Basic %s\r\nUser-Agent: Mozilla/4.0 (Hydra)\r\n%s\r\n",
sprintf(buffer,
"%s http://%s:%d%.250s HTTP/1.1\r\nHost: %s\r\nConnection: "
"close\r\nAuthorization: Basic %s\r\nUser-Agent: Mozilla/4.0 "
"(Hydra)\r\n%s\r\n",
type, webtarget, webport, miscptr, webtarget, buffer2, header);
else
sprintf(buffer, "%s %.250s HTTP/1.1\r\nHost: %s\r\nConnection: close\r\nAuthorization: Basic %s\r\nUser-Agent: Mozilla/4.0 (Hydra)\r\n%s\r\n", type, miscptr, webtarget, buffer2, header);
sprintf(buffer,
"%s %.250s HTTP/1.1\r\nHost: %s\r\nConnection: "
"close\r\nAuthorization: Basic %s\r\nUser-Agent: Mozilla/4.0 "
"(Hydra)\r\n%s\r\n",
type, miscptr, webtarget, buffer2, header);
}
if (debug)
hydra_report(stderr, "C:%s\n", buffer);
break;
#ifdef LIBOPENSSL
case AUTH_DIGESTMD5:{
char *pbuffer;
case AUTH_DIGESTMD5: {
char *pbuffer, *result;
pbuffer = hydra_strcasestr(http_buf, "WWW-Authenticate: Digest ");
strncpy(buffer, pbuffer + strlen("WWW-Authenticate: Digest "), sizeof(buffer));
buffer[sizeof(buffer) - 1] = '\0';
pbuffer = hydra_strcasestr(http_buf, "WWW-Authenticate: Digest ");
strncpy(buffer, pbuffer + strlen("WWW-Authenticate: Digest "), buffer_size - 1);
buffer[buffer_size - 1] = '\0';
fooptr = buffer2;
sasl_digest_md5(fooptr, login, pass, buffer, miscptr, type, webtarget, webport, header);
if (fooptr == NULL) {
return 3;
}
if (debug)
hydra_report(stderr, "C:%s\n", buffer2);
strcpy(buffer, buffer2);
fooptr = buffer2;
result = sasl_digest_md5(fooptr, login, pass, buffer, miscptr, type, webtarget, webport, header);
if (result == NULL) {
free(buffer);
free(header);
return 3;
}
break;
if (debug)
hydra_report(stderr, "C:%s\n", buffer2);
strcpy(buffer, buffer2);
} break;
#endif
case AUTH_NTLM:{
unsigned char buf1[4096];
unsigned char buf2[4096];
char *pos = NULL;
case AUTH_NTLM: {
unsigned char buf1[4096];
unsigned char buf2[4096];
char *pos = NULL;
//send auth and receive challenge
//send auth request: let the server send it's own hostname and domainname
buildAuthRequest((tSmbNtlmAuthRequest *) buf2, 0, NULL, NULL);
to64frombits(buf1, buf2, SmbLength((tSmbNtlmAuthRequest *) buf2));
// send auth and receive challenge
// send auth request: let the server send it's own hostname and domainname
buildAuthRequest((tSmbNtlmAuthRequest *)buf2, 0, NULL, NULL);
to64frombits(buf1, buf2, SmbLength((tSmbNtlmAuthRequest *)buf2));
/* to be portable, no snprintf, buffer is big enough so it cant overflow */
//send the first..
if (use_proxy == 1 && proxy_authentication != NULL)
/* to be portable, no snprintf, buffer is big enough so it can't overflow */
// send the first..
if (use_proxy == 1 && proxy_authentication[selected_proxy] != NULL)
sprintf(buffer,
"%s http://%s:%d%s HTTP/1.1\r\nHost: %s\r\nAuthorization: NTLM "
"%s\r\nProxy-Authorization: Basic %s\r\nUser-Agent: Mozilla/4.0 "
"(Hydra)\r\n%s\r\n",
type, webtarget, webport, miscptr, webtarget, buf1, proxy_authentication[selected_proxy], header);
else {
if (use_proxy == 1)
sprintf(buffer,
"%s http://%s:%d%s HTTP/1.1\r\nHost: %s\r\nConnection: close\r\nAuthorization: NTLM %s\r\nProxy-Authorization: Basic %s\r\nUser-Agent: Mozilla/4.0 (Hydra)\r\nConnection: keep-alive\r\n%s\r\n",
type, webtarget, webport, miscptr, webtarget, buf1, proxy_authentication, header);
else {
if (use_proxy == 1)
sprintf(buffer, "%s http://%s:%d%s HTTP/1.1\r\nHost: %s\r\nConnection: close\r\nAuthorization: NTLM %s\r\nUser-Agent: Mozilla/4.0 (Hydra)\r\nConnection: keep-alive\r\n%s\r\n",
type, webtarget, webport, miscptr, webtarget, buf1, header);
else
sprintf(buffer, "%s %s HTTP/1.1\r\nHost: %s\r\nConnection: close\r\nAuthorization: NTLM %s\r\nUser-Agent: Mozilla/4.0 (Hydra)\r\nConnection: keep-alive\r\n%s\r\n", type, miscptr, webtarget,
buf1, header);
}
if (hydra_send(s, buffer, strlen(buffer), 0) < 0)
return 1;
//receive challenge
if (http_buf != NULL)
free(http_buf);
http_buf = hydra_receive_line(s);
while (http_buf != NULL && (pos = hydra_strcasestr(http_buf, "WWW-Authenticate: NTLM ")) == NULL) {
free(http_buf);
http_buf = hydra_receive_line(s);
}
if (http_buf == NULL)
return 1;
if (pos != NULL) {
char *str;
pos += 23;
if ((str = strchr(pos, '\r')) != NULL) {
pos[str - pos] = 0;
}
if ((str = strchr(pos, '\n')) != NULL) {
pos[str - pos] = 0;
}
}
//recover challenge
from64tobits((char *) buf1, pos);
free(http_buf);
http_buf = NULL;
//Send response
buildAuthResponse((tSmbNtlmAuthChallenge *) buf1, (tSmbNtlmAuthResponse *) buf2, 0, login, pass, NULL, NULL);
to64frombits(buf1, buf2, SmbLength((tSmbNtlmAuthResponse *) buf2));
//create the auth response
if (use_proxy == 1 && proxy_authentication != NULL)
"%s http://%s:%d%s HTTP/1.1\r\nHost: %s\r\nAuthorization: NTLM "
"%s\r\nUser-Agent: Mozilla/4.0 (Hydra)\r\n%s\r\n",
type, webtarget, webport, miscptr, webtarget, buf1, header);
else
sprintf(buffer,
"%s http://%s:%d%s HTTP/1.1\r\nHost: %s\r\nConnection: close\r\nAuthorization: NTLM %s\r\nProxy-Authorization: Basic %s\r\nUser-Agent: Mozilla/4.0 (Hydra)\r\nConnection: keep-alive\r\n%s\r\n",
type, webtarget, webport, miscptr, webtarget, buf1, proxy_authentication, header);
else {
if (use_proxy == 1)
sprintf(buffer, "%s http://%s:%d%s HTTP/1.1\r\nHost: %s\r\nConnection: close\r\nAuthorization: NTLM %s\r\nUser-Agent: Mozilla/4.0 (Hydra)\r\nConnection: keep-alive\r\n%s\r\n",
type, webtarget, webport, miscptr, webtarget, buf1, header);
else
sprintf(buffer, "%s %s HTTP/1.1\r\nHost: %s\r\nConnection: close\r\nAuthorization: NTLM %s\r\nUser-Agent: Mozilla/4.0 (Hydra)\r\nConnection: keep-alive\r\n%s\r\n", type, miscptr, webtarget,
buf1, header);
}
if (debug)
hydra_report(stderr, "C:%s\n", buffer);
"%s %s HTTP/1.1\r\nHost: %s\r\nAuthorization: NTLM "
"%s\r\nUser-Agent: Mozilla/4.0 (Hydra)\r\n%s\r\n",
type, miscptr, webtarget, buf1, header);
}
break;
if (hydra_send(s, buffer, strlen(buffer), 0) < 0) {
free(buffer);
free(header);
return 1;
}
// receive challenge
if (http_buf != NULL)
free(http_buf);
http_buf = hydra_receive_line(s);
if (http_buf == NULL) {
if (verbose)
hydra_report(stderr, "[ERROR] Server did not answer\n");
free(buffer);
free(header);
return 3;
}
pos = hydra_strcasestr(http_buf, "WWW-Authenticate: NTLM ");
if (pos != NULL) {
char *str;
pos += 23;
if ((str = strchr(pos, '\r')) != NULL) {
pos[str - pos] = 0;
}
if ((str = strchr(pos, '\n')) != NULL) {
pos[str - pos] = 0;
}
} else {
hydra_report(stderr, "[ERROR] It is not NTLM authentication type\n");
return 3;
}
// recover challenge
from64tobits((char *)buf1, pos);
free(http_buf);
http_buf = NULL;
// Send response
buildAuthResponse((tSmbNtlmAuthChallenge *)buf1, (tSmbNtlmAuthResponse *)buf2, 0, login, pass, NULL, NULL);
to64frombits(buf1, buf2, SmbLength((tSmbNtlmAuthResponse *)buf2));
// create the auth response
if (use_proxy == 1 && proxy_authentication[selected_proxy] != NULL)
sprintf(buffer,
"%s http://%s:%d%s HTTP/1.1\r\nHost: %s\r\nAuthorization: NTLM "
"%s\r\nProxy-Authorization: Basic %s\r\nUser-Agent: Mozilla/4.0 "
"(Hydra)\r\n%s\r\n",
type, webtarget, webport, miscptr, webtarget, buf1, proxy_authentication[selected_proxy], header);
else {
if (use_proxy == 1)
sprintf(buffer,
"%s http://%s:%d%s HTTP/1.1\r\nHost: %s\r\nAuthorization: NTLM "
"%s\r\nUser-Agent: Mozilla/4.0 (Hydra)\r\n%s\r\n",
type, webtarget, webport, miscptr, webtarget, buf1, header);
else
sprintf(buffer,
"%s %s HTTP/1.1\r\nHost: %s\r\nAuthorization: NTLM "
"%s\r\nUser-Agent: Mozilla/4.0 (Hydra)\r\n%s\r\n",
type, miscptr, webtarget, buf1, header);
}
if (debug)
hydra_report(stderr, "C:%s\n", buffer);
} break;
}
if (hydra_send(s, buffer, strlen(buffer), 0) < 0) {
free(buffer);
free(header);
return 1;
}
@@ -159,8 +208,9 @@ int start_http(int s, char *ip, int port, unsigned char options, char *miscptr,
complete_line = 0;
tmpreplybuf[0] = 0;
while (http_buf != NULL && (strstr(http_buf, "HTTP/1.") == NULL || (index(http_buf, '\n') == NULL && complete_line == 0))) {
if (debug) printf("il: %d, tmpreplybuf: %s, http_buf: %s\n", complete_line, tmpreplybuf, http_buf);
while (http_buf != NULL && (strstr(http_buf, "HTTP/1.") == NULL || (strchr(http_buf, '\n') == NULL && complete_line == 0))) {
if (debug)
printf("il: %d, tmpreplybuf: %s, http_buf: %s\n", complete_line, tmpreplybuf, http_buf);
if (tmpreplybuf[0] == 0 && strstr(http_buf, "HTTP/1.") != NULL) {
strncpy(tmpreplybuf, http_buf, sizeof(tmpreplybuf) - 1);
tmpreplybuf[sizeof(tmpreplybuf) - 1] = 0;
@@ -173,7 +223,8 @@ int start_http(int s, char *ip, int port, unsigned char options, char *miscptr,
strcat(tmpreplybufptr, http_buf);
free(http_buf);
http_buf = tmpreplybufptr;
if (debug) printf("http_buf now: %s\n", http_buf);
if (debug)
printf("http_buf now: %s\n", http_buf);
}
} else {
free(http_buf);
@@ -181,35 +232,49 @@ int start_http(int s, char *ip, int port, unsigned char options, char *miscptr,
}
}
//if server cut the connection, just exit cleanly or
//this will be an infinite loop
// if server cut the connection, just exit cleanly or
// this will be an infinite loop
if (http_buf == NULL) {
if (verbose)
hydra_report(stderr, "[ERROR] Server did not answer\n");
free(buffer);
free(header);
return 3;
}
if (debug)
hydra_report(stderr, "S:%s\n", http_buf);
ptr = ((char *) index(http_buf, ' '));
ptr = ((char *)strchr(http_buf, ' '));
if (ptr != NULL)
ptr++;
if (ptr != NULL && (*ptr == '2' || *ptr == '3' || strncmp(ptr, "403", 3) == 0 || strncmp(ptr, "404", 3) == 0)) {
hydra_report_found_host(port, ip, "www", fp);
hydra_completed_pair_found();
#ifdef HAVE_PCRE
if (end_condition_type >= 0 && hydra_string_match(http_buf, end_condition) != end_condition_type) {
#else
if (end_condition_type >= 0 && (strstr(http_buf, end_condition) == NULL ? 0 : 1) != end_condition_type) {
#endif
if (debug)
hydra_report(stderr, "End condition not match continue.\n");
hydra_completed_pair();
} else {
if (debug)
hydra_report(stderr, "END condition %s match.\n", end_condition);
hydra_report_found_host(port, ip, "www", fp);
hydra_completed_pair_found();
}
if (http_buf != NULL) {
free(http_buf);
http_buf = NULL;
}
} else {
if (ptr != NULL && *ptr != '4')
fprintf(stderr, "[WARNING] Unusual return code: %.3s for %s:%s\n", (char *) ptr, login, pass);
fprintf(stderr, "[WARNING] Unusual return code: %.3s for %s:%s\n", (char *)ptr, login, pass);
//the first authentication type failed, check the type from server header
// the first authentication type failed, check the type from server header
if ((hydra_strcasestr(http_buf, "WWW-Authenticate: Basic") == NULL) && (http_auth_mechanism == AUTH_BASIC)) {
//seems the auth supported is not Basic shceme so testing further
int find_auth = 0;
// seems the auth supported is not Basic scheme so testing further
int32_t find_auth = 0;
if (hydra_strcasestr(http_buf, "WWW-Authenticate: NTLM") != NULL) {
http_auth_mechanism = AUTH_NTLM;
@@ -223,51 +288,41 @@ int start_http(int s, char *ip, int port, unsigned char options, char *miscptr,
#endif
if (find_auth) {
// free(http_buf);
// http_buf = NULL;
// free(http_buf);
// http_buf = NULL;
free(buffer);
free(header);
return 1;
}
}
hydra_completed_pair();
}
// free(http_buf);
// http_buf = NULL;
// free(http_buf);
// http_buf = NULL;
free(buffer);
free(header);
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return 3;
return 1;
}
void service_http(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname, char *type) {
int run = 1, next_run = 1, sock = -1;
int myport = PORT_HTTP, mysslport = PORT_HTTP_SSL;
void service_http(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname, char *type) {
int32_t run = 1, next_run = 1, sock = -1;
int32_t myport = PORT_HTTP, mysslport = PORT_HTTP_SSL;
char *ptr, *ptr2;
ptr_header_node ptr_head = NULL;
#ifdef AF_INET6
unsigned char addr6[sizeof(struct in6_addr)];
#endif
hydra_register_socket(sp);
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return;
if ((webtarget = strstr(miscptr, "://")) != NULL) {
webtarget += strlen("://");
if ((ptr2 = index(webtarget, ':')) != NULL) { /* step over port if present */
*ptr2 = 0;
ptr2++;
ptr = ptr2;
if (*ptr == '/' || (ptr = index(ptr2, '/')) != NULL)
miscptr = ptr;
else
miscptr = slash; /* to make things easier to user */
} else if ((ptr2 = index(webtarget, '/')) != NULL) {
miscptr = malloc(strlen(ptr2) + 1);
freemischttp = 1;
strcpy(miscptr, ptr2);
*ptr2 = 0;
} else
webtarget = hostname;
} else
if (strlen(miscptr) == 0)
miscptr = strdup("/");
if (webtarget == NULL)
webtarget = hostname;
if (strlen(miscptr) == 0)
miscptr = strdup("/");
if (port != 0)
webport = port;
else if ((options & OPTION_SSL) == 0)
@@ -275,46 +330,77 @@ void service_http(char *ip, int sp, unsigned char options, char *miscptr, FILE *
else
webport = mysslport;
/* normalise the webtarget for ipv6/port number */
webtarget = malloc(strlen(hostname) + 1 /* null */ + 6 /* :65535 */
#ifdef AF_INET6
+ 2 /* [] */
#endif
);
#ifdef AF_INET6
/* let libc decide if target is an ipv6 address */
if (inet_pton(AF_INET6, hostname, addr6)) {
ptr = webtarget + sprintf(webtarget, "[%s]", hostname);
} else {
#endif
ptr = webtarget + sprintf(webtarget, "%s", hostname);
#ifdef AF_INET6
}
#endif
if (options & OPTION_SSL && webport != PORT_HTTP_SSL || !(options & OPTION_SSL) && webport != PORT_HTTP) {
sprintf(ptr, ":%d", webport);
}
ptr = NULL;
/* Advance to options string */
ptr = miscptr;
while (*ptr != 0 && (*ptr != ':' || *(ptr - 1) == '\\'))
ptr++;
if (*ptr != 0)
*ptr++ = 0;
optional1 = ptr;
if (!parse_options(optional1,
&ptr_head)) // this function is in hydra-http-form.c !!
run = 4;
if (http_auth_mechanism == AUTH_UNASSIGNED)
http_auth_mechanism = AUTH_BASIC;
while (1) {
next_run = 0;
switch (run) {
case 1: /* connect and service init function */
{
if (sock >= 0)
sock = hydra_disconnect(sock);
if ((options & OPTION_SSL) == 0) {
if (port != 0)
myport = port;
sock = hydra_connect_tcp(ip, myport);
port = myport;
} else {
if (port != 0)
mysslport = port;
sock = hydra_connect_ssl(ip, mysslport, hostname);
port = mysslport;
}
if (sock < 0) {
if (freemischttp)
free(miscptr);
if (quiet != 1) fprintf(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int) getpid());
hydra_child_exit(1);
}
next_run = 2;
break;
case 1: /* connect and service init function */
{
if (sock >= 0)
sock = hydra_disconnect(sock);
if ((options & OPTION_SSL) == 0) {
if (port != 0)
myport = port;
sock = hydra_connect_tcp(ip, myport);
port = myport;
} else {
if (port != 0)
mysslport = port;
sock = hydra_connect_ssl(ip, mysslport, hostname);
port = mysslport;
}
case 2: /* run the cracking function */
next_run = start_http(sock, ip, port, options, miscptr, fp, type);
if (sock < 0) {
if (quiet != 1)
fprintf(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
hydra_child_exit(1);
}
next_run = 2;
break;
}
case 2: /* run the cracking function */
next_run = start_http(sock, ip, port, options, miscptr, fp, type, ptr_head);
break;
case 3: /* clean exit */
case 3: /* clean exit */
if (sock >= 0)
sock = hydra_disconnect(sock);
if (freemischttp)
free(miscptr);
hydra_child_exit(0);
return;
default:
if (freemischttp)
free(miscptr);
fprintf(stderr, "[ERROR] Caught unknown return code, exiting!\n");
hydra_child_exit(0);
}
@@ -322,28 +408,72 @@ void service_http(char *ip, int sp, unsigned char options, char *miscptr, FILE *
}
}
void service_http_get(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
service_http(ip, sp, options, miscptr, fp, port, hostname, "GET");
}
void service_http_get(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) { service_http(ip, sp, options, miscptr, fp, port, hostname, "GET"); }
void service_http_post(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
service_http(ip, sp, options, miscptr, fp, port, hostname, "POST");
}
void service_http_post(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) { service_http(ip, sp, options, miscptr, fp, port, hostname, "POST"); }
void service_http_head(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
service_http(ip, sp, options, miscptr, fp, port, hostname, "HEAD");
}
void service_http_head(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) { service_http(ip, sp, options, miscptr, fp, port, hostname, "HEAD"); }
int service_http_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int32_t service_http_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
//
// fill if needed.
//
//
// return codes:
// 0 all OK
// -1 error, hydra will exit, so print a good error message here
/*POU CODE */
char *start = strstr(miscptr, "F=");
if (start == NULL)
start = strstr(miscptr, "S=");
if (start != NULL) {
if (start[0] == 'F')
end_condition_type = 0;
else
end_condition_type = 1;
int condition_len = strlen(start);
memset(end_condition, 0, END_CONDITION_MAX_LEN);
if (condition_len >= END_CONDITION_MAX_LEN) {
hydra_report(stderr, "Condition string cannot be bigger than %u.", END_CONDITION_MAX_LEN);
return -1;
}
// copy condition witout starting string (F= or S= 2char)
strncpy(end_condition, start + 2, condition_len - 2);
if (debug)
hydra_report(stderr, "End condition is %s, mod is %d\n", end_condition, end_condition_type);
if (*(start - 1) == ' ')
start--;
memset(start, '\0', condition_len);
if (debug)
hydra_report(stderr, "Modificated options:%s\n", miscptr);
} else {
if (debug)
hydra_report(stderr, "Condition not found\n");
}
return 0;
}
void usage_http(const char *service) {
printf("Module %s requires the page to authenticate.\n"
"The following parameters are optional:\n"
" (a|A)=auth-type specify authentication mechanism to use: BASIC, "
"NTLM or MD5\n"
" (h|H)=My-Hdr\\: foo to send a user defined HTTP header with each "
"request\n"
" (F|S)=check for text in the HTTP reply. S= means if this text is "
"found, a\n"
" valid account has been found, F= means if this string is "
"present the\n"
" combination is invalid. Note: this must be the last option "
"supplied.\n"
"For example: \"/secret\" or \"http://bla.com/foo/bar:H=Cookie\\: "
"sessid=aaaa\" or \"https://test.com:8080/members:A=NTLM\"\n\n",
service);
}
+21
View File
@@ -0,0 +1,21 @@
#ifndef _HYDRA_HTTP_H
#define _HYDRA_HTTP_H
#include "hydra-mod.h"
/* HTTP Header Types */
#define HEADER_TYPE_USERHEADER 'h'
#define HEADER_TYPE_USERHEADER_REPL 'H'
#define HEADER_TYPE_DEFAULT 'D'
#define HEADER_TYPE_DEFAULT_REPL 'd'
typedef struct header_node t_header_node, *ptr_header_node;
extern char *webtarget;
extern char *slash;
extern char *optional1;
extern int32_t parse_options(char *miscptr, ptr_header_node *ptr_head);
extern int32_t add_header(ptr_header_node *ptr_head, char *header, char *value, char type);
extern char *stringify_headers(ptr_header_node *ptr_head);
#endif
+31 -49
View File
@@ -1,40 +1,18 @@
#include "hydra-mod.h"
extern char *HYDRA_EXIT;
extern int child_head_no;
int seq = 1;
extern int32_t child_head_no;
int32_t seq = 1;
const unsigned char icq5_table[] = {
0x59, 0x60, 0x37, 0x6B, 0x65, 0x62, 0x46, 0x48, 0x53, 0x61, 0x4C,
0x59, 0x60, 0x57, 0x5B, 0x3D, 0x5E, 0x34, 0x6D, 0x36, 0x50, 0x3F,
0x6F, 0x67, 0x53, 0x61, 0x4C, 0x59, 0x40, 0x47, 0x63, 0x39, 0x50,
0x5F, 0x5F, 0x3F, 0x6F, 0x47, 0x43, 0x69, 0x48, 0x33, 0x31, 0x64,
0x35, 0x5A, 0x4A, 0x42, 0x56, 0x40, 0x67, 0x53, 0x41, 0x07, 0x6C,
0x49, 0x58, 0x3B, 0x4D, 0x46, 0x68, 0x43, 0x69, 0x48, 0x33, 0x31,
0x44, 0x65, 0x62, 0x46, 0x48, 0x53, 0x41, 0x07, 0x6C, 0x69, 0x48,
0x33, 0x51, 0x54, 0x5D, 0x4E, 0x6C, 0x49, 0x38, 0x4B, 0x55, 0x4A,
0x62, 0x46, 0x48, 0x33, 0x51, 0x34, 0x6D, 0x36, 0x50, 0x5F, 0x5F,
0x5F, 0x3F, 0x6F, 0x47, 0x63, 0x59, 0x40, 0x67, 0x33, 0x31, 0x64,
0x35, 0x5A, 0x6A, 0x52, 0x6E, 0x3C, 0x51, 0x34, 0x6D, 0x36, 0x50,
0x5F, 0x5F, 0x3F, 0x4F, 0x37, 0x4B, 0x35, 0x5A, 0x4A, 0x62, 0x66,
0x58, 0x3B, 0x4D, 0x66, 0x58, 0x5B, 0x5D, 0x4E, 0x6C, 0x49, 0x58,
0x3B, 0x4D, 0x66, 0x58, 0x3B, 0x4D, 0x46, 0x48, 0x53, 0x61, 0x4C,
0x59, 0x40, 0x67, 0x33, 0x31, 0x64, 0x55, 0x6A, 0x32, 0x3E, 0x44,
0x45, 0x52, 0x6E, 0x3C, 0x31, 0x64, 0x55, 0x6A, 0x52, 0x4E, 0x6C,
0x69, 0x48, 0x53, 0x61, 0x4C, 0x39, 0x30, 0x6F, 0x47, 0x63, 0x59,
0x60, 0x57, 0x5B, 0x3D, 0x3E, 0x64, 0x35, 0x3A, 0x3A, 0x5A, 0x6A,
0x52, 0x4E, 0x6C, 0x69, 0x48, 0x53, 0x61, 0x6C, 0x49, 0x58, 0x3B,
0x4D, 0x46, 0x68, 0x63, 0x39, 0x50, 0x5F, 0x5F, 0x3F, 0x6F, 0x67,
0x53, 0x41, 0x25, 0x41, 0x3C, 0x51, 0x54, 0x3D, 0x5E, 0x54, 0x5D,
0x4E, 0x4C, 0x39, 0x50, 0x5F, 0x5F, 0x5F, 0x3F, 0x6F, 0x47, 0x43,
0x69, 0x48, 0x33, 0x51, 0x54, 0x5D, 0x6E, 0x3C, 0x31, 0x64, 0x35,
0x5A, 0x00, 0x00
};
const unsigned char icq5_table[] = {0x59, 0x60, 0x37, 0x6B, 0x65, 0x62, 0x46, 0x48, 0x53, 0x61, 0x4C, 0x59, 0x60, 0x57, 0x5B, 0x3D, 0x5E, 0x34, 0x6D, 0x36, 0x50, 0x3F, 0x6F, 0x67, 0x53, 0x61, 0x4C, 0x59, 0x40, 0x47, 0x63, 0x39, 0x50, 0x5F, 0x5F, 0x3F, 0x6F, 0x47, 0x43, 0x69, 0x48, 0x33, 0x31, 0x64, 0x35, 0x5A, 0x4A, 0x42, 0x56, 0x40, 0x67, 0x53, 0x41, 0x07, 0x6C, 0x49, 0x58, 0x3B, 0x4D, 0x46, 0x68, 0x43, 0x69, 0x48,
0x33, 0x31, 0x44, 0x65, 0x62, 0x46, 0x48, 0x53, 0x41, 0x07, 0x6C, 0x69, 0x48, 0x33, 0x51, 0x54, 0x5D, 0x4E, 0x6C, 0x49, 0x38, 0x4B, 0x55, 0x4A, 0x62, 0x46, 0x48, 0x33, 0x51, 0x34, 0x6D, 0x36, 0x50, 0x5F, 0x5F, 0x5F, 0x3F, 0x6F, 0x47, 0x63, 0x59, 0x40, 0x67, 0x33, 0x31, 0x64, 0x35, 0x5A, 0x6A, 0x52, 0x6E, 0x3C, 0x51, 0x34, 0x6D, 0x36, 0x50, 0x5F, 0x5F, 0x3F, 0x4F, 0x37, 0x4B, 0x35,
0x5A, 0x4A, 0x62, 0x66, 0x58, 0x3B, 0x4D, 0x66, 0x58, 0x5B, 0x5D, 0x4E, 0x6C, 0x49, 0x58, 0x3B, 0x4D, 0x66, 0x58, 0x3B, 0x4D, 0x46, 0x48, 0x53, 0x61, 0x4C, 0x59, 0x40, 0x67, 0x33, 0x31, 0x64, 0x55, 0x6A, 0x32, 0x3E, 0x44, 0x45, 0x52, 0x6E, 0x3C, 0x31, 0x64, 0x55, 0x6A, 0x52, 0x4E, 0x6C, 0x69, 0x48, 0x53, 0x61, 0x4C, 0x39, 0x30, 0x6F, 0x47, 0x63, 0x59, 0x60, 0x57, 0x5B, 0x3D, 0x3E,
0x64, 0x35, 0x3A, 0x3A, 0x5A, 0x6A, 0x52, 0x4E, 0x6C, 0x69, 0x48, 0x53, 0x61, 0x6C, 0x49, 0x58, 0x3B, 0x4D, 0x46, 0x68, 0x63, 0x39, 0x50, 0x5F, 0x5F, 0x3F, 0x6F, 0x67, 0x53, 0x41, 0x25, 0x41, 0x3C, 0x51, 0x54, 0x3D, 0x5E, 0x54, 0x5D, 0x4E, 0x4C, 0x39, 0x50, 0x5F, 0x5F, 0x5F, 0x3F, 0x6F, 0x47, 0x43, 0x69, 0x48, 0x33, 0x51, 0x54, 0x5D, 0x6E, 0x3C, 0x31, 0x64, 0x35, 0x5A, 0x00, 0x00};
void fix_packet(char *buf, int len) {
void fix_packet(char *buf, int32_t len) {
unsigned long c1, c2;
unsigned long r1, r2;
int pos, key, k;
int32_t pos, key, k;
c1 = buf[8];
c1 <<= 8;
@@ -83,10 +61,10 @@ void icq_header(char *buf, unsigned short cmd, unsigned long uin) {
buf[9] = (uin >> 24) & 0xff;
}
int icq_login(int s, char *login, char *pass) {
int32_t icq_login(int32_t s, char *login, char *pass) {
unsigned long uin = strtoul(login, NULL, 10);
char buf[256];
int len;
int32_t len;
bzero(buf, sizeof(buf));
@@ -103,7 +81,7 @@ int icq_login(int s, char *login, char *pass) {
return (hydra_send(s, buf, 43 + len, 0));
}
int icq_login_1(int s, char *login) {
int32_t icq_login_1(int32_t s, char *login) {
unsigned long uin = strtoul(login, NULL, 10);
char buf[64];
@@ -111,7 +89,7 @@ int icq_login_1(int s, char *login) {
return (hydra_send(s, buf, 10, 0));
}
int icq_disconnect(int s, char *login) {
int32_t icq_disconnect(int32_t s, char *login) {
unsigned long uin = strtoul(login, NULL, 10);
char buf[64];
@@ -123,7 +101,7 @@ int icq_disconnect(int s, char *login) {
return (hydra_send(s, buf, 34, 0));
}
int icq_ack(int s, char *login) {
int32_t icq_ack(int32_t s, char *login) {
unsigned long uin = strtoul(login, NULL, 10);
char buf[64];
@@ -141,11 +119,11 @@ int icq_ack(int s, char *login) {
return (hydra_send(s, buf, 10, 0));
}
int start_icq(int sock, char *ip, int port, FILE * output, char *miscptr, FILE * fp) {
int32_t start_icq(int32_t sock, char *ip, int32_t port, FILE *output, char *miscptr, FILE *fp) {
unsigned char buf[1024];
char *login, *pass;
char *empty = "";
int i, r;
int32_t i, r;
if (strlen(login = hydra_get_next_login()) == 0)
return 2;
@@ -153,7 +131,7 @@ int start_icq(int sock, char *ip, int port, FILE * output, char *miscptr, FILE *
pass = empty;
for (i = 0; login[i]; i++)
if (!isdigit((int) login[i])) {
if (!isdigit((int32_t)login[i])) {
fprintf(stderr, "[ERROR] Invalid UIN %s\n, ignoring.", login);
hydra_completed_pair();
return 2;
@@ -162,13 +140,13 @@ int start_icq(int sock, char *ip, int port, FILE * output, char *miscptr, FILE *
icq_login(sock, login, pass);
while (1) {
if ((r = hydra_recv(sock, (char *) buf, sizeof(buf))) == 0) {
if ((r = hydra_recv(sock, (char *)buf, sizeof(buf))) == 0) {
return 1;
}
if (r < 0) {
if (verbose)
fprintf(stderr, "[ERROR] Process %d: Can not connect [unreachable]\n", (int) getpid());
fprintf(stderr, "[ERROR] Process %d: Can not connect [unreachable]\n", (int32_t)getpid());
return 3;
}
@@ -177,9 +155,9 @@ int start_icq(int sock, char *ip, int port, FILE * output, char *miscptr, FILE *
hydra_completed_pair_found();
icq_ack(sock, login);
icq_login_1(sock, login);
hydra_recv(sock, (char *) buf, sizeof(buf));
hydra_recv(sock, (char *)buf, sizeof(buf));
icq_ack(sock, login);
hydra_recv(sock, (char *) buf, sizeof(buf));
hydra_recv(sock, (char *)buf, sizeof(buf));
icq_ack(sock, login);
icq_disconnect(sock, login);
break;
@@ -188,7 +166,8 @@ int start_icq(int sock, char *ip, int port, FILE * output, char *miscptr, FILE *
break;
}
/* if((buf[2] != 10 || buf[3] != 0) && (buf[2] != 250 || buf[3] != 0)) */
/* if((buf[2] != 10 || buf[3] != 0) && (buf[2] != 250 || buf[3] != 0))
*/
}
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
@@ -196,9 +175,9 @@ int start_icq(int sock, char *ip, int port, FILE * output, char *miscptr, FILE *
return 1;
}
void service_icq(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int run = 1, next_run = 1, sock = -1;
int myport = PORT_ICQ;
void service_icq(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
int32_t run = 1, next_run = 1, sock = -1;
int32_t myport = PORT_ICQ;
if (port)
myport = port;
@@ -221,7 +200,8 @@ void service_icq(char *ip, int sp, unsigned char options, char *miscptr, FILE *
sock = hydra_disconnect(sock);
sock = hydra_connect_udp(ip, myport);
if (sock < 0) {
if (quiet != 1) fprintf(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int) getpid());
if (quiet != 1)
fprintf(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
hydra_child_exit(1);
}
next_run = 2;
@@ -233,21 +213,23 @@ void service_icq(char *ip, int sp, unsigned char options, char *miscptr, FILE *
if (sock >= 0)
sock = hydra_disconnect(sock);
hydra_child_exit(2);
break;
default:
fprintf(stderr, "[ERROR] Caught unknown return code, exiting!\n");
hydra_child_exit(2);
break;
}
run = next_run;
}
}
int service_icq_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int32_t service_icq_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
//
// fill if needed.
//
//
// return codes:
// 0 all OK
// -1 error, hydra will exit, so print a good error message here
+236 -224
View File
@@ -3,13 +3,13 @@
extern char *HYDRA_EXIT;
char *buf;
int counter;
int32_t counter;
int imap_auth_mechanism = AUTH_CLEAR;
int32_t imap_auth_mechanism = AUTH_CLEAR;
char *imap_read_server_capacity(int sock) {
char *imap_read_server_capacity(int32_t sock) {
char *ptr = NULL;
int resp = 0;
int32_t resp = 0;
char *buf = NULL;
do {
@@ -19,8 +19,9 @@ char *imap_read_server_capacity(int sock) {
if (buf != NULL) {
if (strstr(buf, "CAPABILITY") != NULL && buf[0] == '*') {
resp = 1;
sleepn(300);
/* we got the capability info then get the completed warning info from server */
usleepn(300);
/* we got the capability info then get the completed warning info from
* server */
while (hydra_data_ready(sock)) {
free(buf);
buf = hydra_receive_line(sock);
@@ -30,7 +31,7 @@ char *imap_read_server_capacity(int sock) {
buf[strlen(buf) - 1] = 0;
if (buf[strlen(buf) - 1] == '\r')
buf[strlen(buf) - 1] = 0;
if (isdigit((int) *ptr) && *(ptr + 1) == ' ') {
if (isdigit((int32_t)*ptr) && *(ptr + 1) == ' ') {
resp = 1;
}
}
@@ -39,8 +40,8 @@ char *imap_read_server_capacity(int sock) {
return buf;
}
int start_imap(int s, char *ip, int port, unsigned char options, char *miscptr, FILE * fp) {
char *empty = "";
int32_t start_imap(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
char *empty = "", *result = NULL;
char *login, *pass, buffer[500], buffer2[500], *fooptr;
if (strlen(login = hydra_get_next_login()) == 0)
@@ -69,7 +70,7 @@ int start_imap(int s, char *ip, int port, unsigned char options, char *miscptr,
}
free(buf);
strcpy(buffer2, login);
hydra_tobase64((unsigned char *) buffer2, strlen(buffer2), sizeof(buffer2));
hydra_tobase64((unsigned char *)buffer2, strlen(buffer2), sizeof(buffer2));
sprintf(buffer, "%.250s\r\n", buffer2);
if (hydra_send(s, buffer, strlen(buffer), 0) < 0) {
@@ -84,7 +85,7 @@ int start_imap(int s, char *ip, int port, unsigned char options, char *miscptr,
}
free(buf);
strcpy(buffer2, pass);
hydra_tobase64((unsigned char *) buffer2, strlen(buffer2), sizeof(buffer2));
hydra_tobase64((unsigned char *)buffer2, strlen(buffer2), sizeof(buffer2));
sprintf(buffer, "%.250s\r\n", buffer2);
break;
@@ -103,227 +104,227 @@ int start_imap(int s, char *ip, int port, unsigned char options, char *miscptr,
free(buf);
memset(buffer2, 0, sizeof(buffer2));
sasl_plain(buffer2, login, pass);
result = sasl_plain(buffer2, login, pass);
if (result == NULL)
return 3;
sprintf(buffer, "%.250s\r\n", buffer2);
break;
#ifdef LIBOPENSSL
case AUTH_CRAMMD5:
case AUTH_CRAMSHA1:
case AUTH_CRAMSHA256:{
int rc = 0;
char *preplogin;
case AUTH_CRAMSHA256: {
int32_t rc = 0;
char *preplogin;
rc = sasl_saslprep(login, SASL_ALLOW_UNASSIGNED, &preplogin);
if (rc) {
return 3;
}
rc = sasl_saslprep(login, SASL_ALLOW_UNASSIGNED, &preplogin);
if (rc) {
return 3;
}
switch (imap_auth_mechanism) {
case AUTH_CRAMMD5:
sprintf(buffer, "%d AUTHENTICATE CRAM-MD5\r\n", counter);
break;
case AUTH_CRAMSHA1:
sprintf(buffer, "%d AUTHENTICATE CRAM-SHA1\r\n", counter);
break;
case AUTH_CRAMSHA256:
sprintf(buffer, "%d AUTHENTICATE CRAM-SHA256\r\n", counter);
break;
}
if (hydra_send(s, buffer, strlen(buffer), 0) < 0) {
return 1;
}
// get the one-time BASE64 encoded challenge
if ((buf = hydra_receive_line(s)) == NULL)
return 1;
if (strstr(buf, " NO ") != NULL || strstr(buf, "failed") != NULL || strstr(buf, " BAD ") != NULL || strstr(buf, "BYE") != NULL) {
switch (imap_auth_mechanism) {
case AUTH_CRAMMD5:
sprintf(buffer, "%d AUTHENTICATE CRAM-MD5\r\n", counter);
hydra_report(stderr, "[ERROR] IMAP CRAM-MD5 AUTH : %s\n", buf);
break;
case AUTH_CRAMSHA1:
sprintf(buffer, "%d AUTHENTICATE CRAM-SHA1\r\n", counter);
hydra_report(stderr, "[ERROR] IMAP CRAM-SHA1 AUTH : %s\n", buf);
break;
case AUTH_CRAMSHA256:
sprintf(buffer, "%d AUTHENTICATE CRAM-SHA256\r\n", counter);
hydra_report(stderr, "[ERROR] IMAP CRAM-SHA256 AUTH : %s\n", buf);
break;
}
if (hydra_send(s, buffer, strlen(buffer), 0) < 0) {
return 1;
}
//get the one-time BASE64 encoded challenge
if ((buf = hydra_receive_line(s)) == NULL)
return 1;
if (strstr(buf, " NO ") != NULL || strstr(buf, "failed") != NULL || strstr(buf, " BAD ") != NULL || strstr(buf, "BYE") != NULL) {
switch (imap_auth_mechanism) {
case AUTH_CRAMMD5:
hydra_report(stderr, "[ERROR] IMAP CRAM-MD5 AUTH : %s\n", buf);
break;
case AUTH_CRAMSHA1:
hydra_report(stderr, "[ERROR] IMAP CRAM-SHA1 AUTH : %s\n", buf);
break;
case AUTH_CRAMSHA256:
hydra_report(stderr, "[ERROR] IMAP CRAM-SHA256 AUTH : %s\n", buf);
break;
}
free(buf);
return 3;
}
memset(buffer, 0, sizeof(buffer));
from64tobits((char *) buffer, buf + 2);
free(buf);
return 3;
}
memset(buffer, 0, sizeof(buffer));
from64tobits((char *)buffer, buf + 2);
free(buf);
memset(buffer2, 0, sizeof(buffer2));
switch (imap_auth_mechanism) {
case AUTH_CRAMMD5: {
result = sasl_cram_md5(buffer2, pass, buffer);
if (result == NULL)
return 3;
sprintf(buffer, "%s %.250s", preplogin, buffer2);
} break;
case AUTH_CRAMSHA1: {
result = sasl_cram_sha1(buffer2, pass, buffer);
if (result == NULL)
return 3;
sprintf(buffer, "%s %.250s", preplogin, buffer2);
} break;
case AUTH_CRAMSHA256: {
result = sasl_cram_sha256(buffer2, pass, buffer);
if (result == NULL)
return 3;
sprintf(buffer, "%s %.250s", preplogin, buffer2);
} break;
}
hydra_tobase64((unsigned char *)buffer, strlen(buffer), sizeof(buffer));
char tmp_buffer[sizeof(buffer)];
sprintf(tmp_buffer, "%.250s\r\n", buffer);
strcpy(buffer, tmp_buffer);
free(preplogin);
} break;
case AUTH_DIGESTMD5: {
sprintf(buffer, "%d AUTHENTICATE DIGEST-MD5\r\n", counter);
if (hydra_send(s, buffer, strlen(buffer), 0) < 0)
return 1;
// receive
if ((buf = hydra_receive_line(s)) == NULL)
return 1;
if (strstr(buf, " NO ") != NULL || strstr(buf, "failed") != NULL || strstr(buf, " BAD ") != NULL || strstr(buf, "BYE") != NULL) {
hydra_report(stderr, "[ERROR] IMAP DIGEST-MD5 AUTH : %s\n", buf);
free(buf);
return 3;
}
memset(buffer, 0, sizeof(buffer));
from64tobits((char *)buffer, buf);
free(buf);
if (debug)
hydra_report(stderr, "DEBUG S: %s\n", buffer);
fooptr = buffer2;
result = sasl_digest_md5(fooptr, login, pass, buffer, miscptr, "imap", NULL, 0, NULL);
if (result == NULL)
return 3;
if (debug)
hydra_report(stderr, "DEBUG C: %s\n", buffer2);
hydra_tobase64((unsigned char *)buffer2, strlen(buffer2), sizeof(buffer2));
sprintf(buffer, "%s\r\n", buffer2);
} break;
case AUTH_SCRAMSHA1: {
char clientfirstmessagebare[200];
char serverfirstmessage[200];
char *preplogin;
int32_t rc = sasl_saslprep(login, SASL_ALLOW_UNASSIGNED, &preplogin);
if (rc) {
return 3;
}
sprintf(buffer, "%d AUTHENTICATE SCRAM-SHA-1\r\n", counter);
if (hydra_send(s, buffer, strlen(buffer), 0) < 0) {
return 1;
}
if ((buf = hydra_receive_line(s)) == NULL)
return 1;
if (strstr(buf, " NO ") != NULL || strstr(buf, "failed") != NULL || strstr(buf, " BAD ") != NULL || strstr(buf, "BYE") != NULL) {
hydra_report(stderr, "[ERROR] IMAP SCRAM-SHA1 AUTH : %s\n", buf);
free(buf);
return 3;
}
free(buf);
snprintf(clientfirstmessagebare, sizeof(clientfirstmessagebare), "n=%s,r=hydra", preplogin);
free(preplogin);
memset(buffer2, 0, sizeof(buffer2));
sprintf(buffer2, "n,,%.200s", clientfirstmessagebare);
hydra_tobase64((unsigned char *)buffer2, strlen(buffer2), sizeof(buffer2));
snprintf(buffer, sizeof(buffer), "%s\r\n", buffer2);
if (hydra_send(s, buffer, strlen(buffer), 0) < 0) {
return 1;
}
buf = hydra_receive_line(s);
if (buf == NULL)
return 1;
if (strstr(buf, " NO ") != NULL || strstr(buf, "failed") != NULL || strstr(buf, " BAD ") != NULL || strstr(buf, "BYE") != NULL) {
if (verbose || debug)
hydra_report(stderr, "[ERROR] Not a valid server challenge\n");
free(buf);
return 1;
} else {
/* recover server challenge */
memset(buffer, 0, sizeof(buffer));
//+ cj1oeWRyYU9VNVZqcHQ5RjNqcmVXRVFWTCxzPWhGbTNnRGw0akdidzJVVHosaT00MDk2
from64tobits((char *)buffer, buf + 2);
free(buf);
strncpy(serverfirstmessage, buffer, sizeof(serverfirstmessage) - 1);
serverfirstmessage[sizeof(serverfirstmessage) - 1] = '\0';
memset(buffer2, 0, sizeof(buffer2));
switch (imap_auth_mechanism) {
case AUTH_CRAMMD5:{
sasl_cram_md5(buffer2, pass, buffer);
sprintf(buffer, "%s %.250s", preplogin, buffer2);
}
break;
case AUTH_CRAMSHA1:{
sasl_cram_sha1(buffer2, pass, buffer);
sprintf(buffer, "%s %.250s", preplogin, buffer2);
}
break;
case AUTH_CRAMSHA256:{
sasl_cram_sha256(buffer2, pass, buffer);
sprintf(buffer, "%s %.250s", preplogin, buffer2);
}
break;
}
hydra_tobase64((unsigned char *) buffer, strlen(buffer), sizeof(buffer));
char tmp_buffer[sizeof(buffer)];
sprintf(tmp_buffer, "%.250s\r\n", buffer);
strcpy(buffer, tmp_buffer);
free(preplogin);
}
break;
case AUTH_DIGESTMD5:{
sprintf(buffer, "%d AUTHENTICATE DIGEST-MD5\r\n", counter);
if (hydra_send(s, buffer, strlen(buffer), 0) < 0)
return 1;
//receive
if ((buf = hydra_receive_line(s)) == NULL)
return 1;
if (strstr(buf, " NO ") != NULL || strstr(buf, "failed") != NULL || strstr(buf, " BAD ") != NULL || strstr(buf, "BYE") != NULL) {
hydra_report(stderr, "[ERROR] IMAP DIGEST-MD5 AUTH : %s\n", buf);
free(buf);
return 3;
}
memset(buffer, 0, sizeof(buffer));
from64tobits((char *) buffer, buf);
free(buf);
if (debug)
hydra_report(stderr, "DEBUG S: %s\n", buffer);
fooptr = buffer2;
sasl_digest_md5(fooptr, login, pass, buffer, miscptr, "imap", NULL, 0, NULL);
if (fooptr == NULL)
return 3;
if (debug)
hydra_report(stderr, "DEBUG C: %s\n", buffer2);
hydra_tobase64((unsigned char *) buffer2, strlen(buffer2), sizeof(buffer2));
result = sasl_scram_sha1(fooptr, pass, clientfirstmessagebare, serverfirstmessage);
if (result == NULL) {
hydra_report(stderr, "[ERROR] Can't compute client response\n");
return 1;
}
hydra_tobase64((unsigned char *)buffer2, strlen(buffer2), sizeof(buffer2));
sprintf(buffer, "%s\r\n", buffer2);
}
break;
case AUTH_SCRAMSHA1:{
char clientfirstmessagebare[200];
char serverfirstmessage[200];
char *preplogin;
int rc = sasl_saslprep(login, SASL_ALLOW_UNASSIGNED, &preplogin);
if (rc) {
return 3;
}
sprintf(buffer, "%d AUTHENTICATE SCRAM-SHA-1\r\n", counter);
if (hydra_send(s, buffer, strlen(buffer), 0) < 0) {
return 1;
}
if ((buf = hydra_receive_line(s)) == NULL)
return 1;
if (strstr(buf, " NO ") != NULL || strstr(buf, "failed") != NULL || strstr(buf, " BAD ") != NULL || strstr(buf, "BYE") != NULL) {
hydra_report(stderr, "[ERROR] IMAP SCRAM-SHA1 AUTH : %s\n", buf);
free(buf);
return 3;
}
free(buf);
snprintf(clientfirstmessagebare, sizeof(clientfirstmessagebare), "n=%s,r=hydra", preplogin);
free(preplogin);
memset(buffer2, 0, sizeof(buffer2));
sprintf(buffer2, "n,,%.200s", clientfirstmessagebare);
hydra_tobase64((unsigned char *) buffer2, strlen(buffer2), sizeof(buffer2));
snprintf(buffer, sizeof(buffer), "%s\r\n", buffer2);
if (hydra_send(s, buffer, strlen(buffer), 0) < 0) {
return 1;
}
buf = hydra_receive_line(s);
if (buf == NULL)
return 1;
if (strstr(buf, " NO ") != NULL || strstr(buf, "failed") != NULL || strstr(buf, " BAD ") != NULL || strstr(buf, "BYE") != NULL) {
if (verbose || debug)
hydra_report(stderr, "[ERROR] Not a valid server challenge\n");
free(buf);
return 1;
} else {
/* recover server challenge */
memset(buffer, 0, sizeof(buffer));
//+ cj1oeWRyYU9VNVZqcHQ5RjNqcmVXRVFWTCxzPWhGbTNnRGw0akdidzJVVHosaT00MDk2
from64tobits((char *) buffer, buf + 2);
free(buf);
strncpy(serverfirstmessage, buffer, sizeof(serverfirstmessage) - 1);
serverfirstmessage[sizeof(serverfirstmessage) - 1] = '\0';
memset(buffer2, 0, sizeof(buffer2));
fooptr = buffer2;
sasl_scram_sha1(fooptr, pass, clientfirstmessagebare, serverfirstmessage);
if (fooptr == NULL) {
hydra_report(stderr, "[ERROR] Can't compute client response\n");
return 1;
}
hydra_tobase64((unsigned char *) buffer2, strlen(buffer2), sizeof(buffer2));
sprintf(buffer, "%s\r\n", buffer2);
}
}
break;
} break;
#endif
case AUTH_NTLM:{
unsigned char buf1[4096];
unsigned char buf2[4096];
case AUTH_NTLM: {
unsigned char buf1[4096];
unsigned char buf2[4096];
//Send auth request
sprintf(buffer, "%d AUTHENTICATE NTLM\r\n", counter);
// Send auth request
sprintf(buffer, "%d AUTHENTICATE NTLM\r\n", counter);
if (hydra_send(s, buffer, strlen(buffer), 0) < 0)
return 1;
//receive
if ((buf = hydra_receive_line(s)) == NULL)
return 1;
if (strstr(buf, " NO ") != NULL || strstr(buf, "failed") != NULL || strstr(buf, " BAD ") != NULL || strstr(buf, "BYE") != NULL) {
hydra_report(stderr, "[ERROR] IMAP NTLM AUTH : %s\n", buf);
free(buf);
return 3;
}
if (hydra_send(s, buffer, strlen(buffer), 0) < 0)
return 1;
// receive
if ((buf = hydra_receive_line(s)) == NULL)
return 1;
if (strstr(buf, " NO ") != NULL || strstr(buf, "failed") != NULL || strstr(buf, " BAD ") != NULL || strstr(buf, "BYE") != NULL) {
hydra_report(stderr, "[ERROR] IMAP NTLM AUTH : %s\n", buf);
free(buf);
//send auth and receive challenge
//send auth request: lst the server send it's own hostname and domainname
buildAuthRequest((tSmbNtlmAuthRequest *) buf2, 0, NULL, NULL);
to64frombits(buf1, buf2, SmbLength((tSmbNtlmAuthRequest *) buf2));
sprintf(buffer, "%s\r\n", buf1);
if (hydra_send(s, buffer, strlen(buffer), 0) < 0)
return 1;
if ((buf = hydra_receive_line(s)) == NULL)
return 1;
if (strlen(buf) < 6) {
free(buf);
return 1;
}
//recover challenge
from64tobits((char *) buf1, buf + 2);
free(buf);
//Send response
buildAuthResponse((tSmbNtlmAuthChallenge *) buf1, (tSmbNtlmAuthResponse *) buf2, 0, login, pass, NULL, NULL);
to64frombits(buf1, buf2, SmbLength((tSmbNtlmAuthResponse *) buf2));
sprintf(buffer, "%s\r\n", buf1);
return 3;
}
break;
free(buf);
// send auth and receive challenge
// send auth request: lst the server send it's own hostname and domainname
buildAuthRequest((tSmbNtlmAuthRequest *)buf2, 0, NULL, NULL);
to64frombits(buf1, buf2, SmbLength((tSmbNtlmAuthRequest *)buf2));
sprintf(buffer, "%s\r\n", buf1);
if (hydra_send(s, buffer, strlen(buffer), 0) < 0)
return 1;
if ((buf = hydra_receive_line(s)) == NULL)
return 1;
if (strlen(buf) < 6) {
free(buf);
return 1;
}
// recover challenge
from64tobits((char *)buf1, buf + 2);
free(buf);
// Send response
buildAuthResponse((tSmbNtlmAuthChallenge *)buf1, (tSmbNtlmAuthResponse *)buf2, 0, login, pass, NULL, NULL);
to64frombits(buf1, buf2, SmbLength((tSmbNtlmAuthResponse *)buf2));
sprintf(buffer, "%s\r\n", buf1);
} break;
default:
//clear authentication
// clear authentication
sprintf(buffer, "%d LOGIN \"%.100s\" \"%.100s\"\r\n", counter, login, pass);
}
@@ -353,9 +354,9 @@ int start_imap(int s, char *ip, int port, unsigned char options, char *miscptr,
return 1;
}
void service_imap(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int run = 1, next_run = 1, sock = -1;
int myport = PORT_IMAP, mysslport = PORT_IMAP_SSL, disable_tls = 1;
void service_imap(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
int32_t run = 1, next_run = 1, sock = -1;
int32_t myport = PORT_IMAP, mysslport = PORT_IMAP_SSL, disable_tls = 1;
char *buffer1 = "1 CAPABILITY\r\n";
hydra_register_socket(sp);
@@ -363,10 +364,10 @@ void service_imap(char *ip, int sp, unsigned char options, char *miscptr, FILE *
return;
while (1) {
switch (run) {
case 1: /* connect and service init function */
case 1: /* connect and service init function */
if (sock >= 0)
sock = hydra_disconnect(sock);
// sleepn(275);
// usleepn(275);
if ((options & OPTION_SSL) == 0) {
if (port != 0)
myport = port;
@@ -380,12 +381,12 @@ void service_imap(char *ip, int sp, unsigned char options, char *miscptr, FILE *
}
if (sock < 0) {
if (verbose || debug)
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int) getpid());
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
hydra_child_exit(1);
}
buf = hydra_receive_line(sock);
if ((buf == NULL) || (strstr(buf, "OK") == NULL && buf[0] != '*')) { /* check the first line */
if ((buf == NULL) || (strstr(buf, "OK") == NULL && buf[0] != '*')) { /* check the first line */
if (verbose || debug)
hydra_report(stderr, "[ERROR] Not an IMAP protocol or service shutdown:\n");
if (buf != NULL)
@@ -404,25 +405,27 @@ void service_imap(char *ip, int sp, unsigned char options, char *miscptr, FILE *
}
if ((miscptr != NULL) && (strlen(miscptr) > 0)) {
int i;
int32_t i;
for (i = 0; i < strlen(miscptr); i++)
miscptr[i] = (char) toupper((int) miscptr[i]);
miscptr[i] = (char)toupper((int32_t)miscptr[i]);
if (strstr(miscptr, "TLS") || strstr(miscptr, "SSL")) {
if (strstr(miscptr, "TLS") || strstr(miscptr, "SSL") || strstr(miscptr, "STARTTLS")) {
disable_tls = 0;
}
}
#ifdef LIBOPENSSL
if (!disable_tls) {
/* check for STARTTLS, if available we may have access to more basic auth methods */
/* check for STARTTLS, if available we may have access to more basic
* auth methods */
if (strstr(buf, "STARTTLS") != NULL) {
hydra_send(sock, "2 STARTTLS\r\n", strlen("2 STARTTLS\r\n"), 0);
counter++;
free(buf);
buf = hydra_receive_line(sock);
if (buf == NULL || (strstr(buf, " NO ") != NULL || strstr(buf, "failed") != NULL || strstr(buf, " BAD ") != NULL)) {
hydra_report(stderr, "[ERROR] TLS negotiation failed, no answer received from STARTTLS request\n");
hydra_report(stderr, "[ERROR] TLS negotiation failed, no answer "
"received from STARTTLS request\n");
} else {
free(buf);
if ((hydra_connect_to_ssl(sock, hostname) == -1)) {
@@ -444,15 +447,16 @@ void service_imap(char *ip, int sp, unsigned char options, char *miscptr, FILE *
hydra_child_exit(2);
}
} else
hydra_report(stderr, "[ERROR] option to use TLS/SSL failed as it is not supported by the server\n");
hydra_report(stderr, "[ERROR] option to use TLS/SSL failed as it is "
"not supported by the server\n");
}
#endif
if (verbose)
hydra_report(stderr, "[VERBOSE] CAPABILITY: %s", buf);
//authentication should be listed AUTH= like in the extract below
//STARTTLS LOGINDISABLED AUTH=GSSAPI AUTH=DIGEST-MD5 AUTH=CRAM-MD5
// authentication should be listed AUTH= like in the extract below
// STARTTLS LOGINDISABLED AUTH=GSSAPI AUTH=DIGEST-MD5 AUTH=CRAM-MD5
if ((strstr(buf, "=LOGIN") == NULL) && (strstr(buf, "=NTLM") != NULL)) {
imap_auth_mechanism = AUTH_NTLM;
}
@@ -487,7 +491,6 @@ void service_imap(char *ip, int sp, unsigned char options, char *miscptr, FILE *
free(buf);
if ((miscptr != NULL) && (strlen(miscptr) > 0)) {
if (strstr(miscptr, "CLEAR"))
imap_auth_mechanism = AUTH_CLEAR;
@@ -554,11 +557,11 @@ void service_imap(char *ip, int sp, unsigned char options, char *miscptr, FILE *
next_run = 2;
break;
case 2: /* run the cracking function */
case 2: /* run the cracking function */
next_run = start_imap(sock, ip, port, options, miscptr, fp);
counter++;
break;
case 3: /* clean exit */
case 3: /* clean exit */
if (sock >= 0)
sock = hydra_disconnect(sock);
hydra_child_exit(0);
@@ -571,16 +574,25 @@ void service_imap(char *ip, int sp, unsigned char options, char *miscptr, FILE *
}
}
int service_imap_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int32_t service_imap_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
//
// fill if needed.
//
//
// return codes:
// 0 all OK
// -1 error, hydra will exit, so print a good error message here
return 0;
}
void usage_imap(const char *service) {
printf("Module imap is optionally taking one authentication type of:\n"
" CLEAR or APOP (default), LOGIN, PLAIN, CRAM-MD5, CRAM-SHA1,\n"
" CRAM-SHA256, DIGEST-MD5, NTLM\n"
"Additionally TLS encryption via STARTTLS can be enforced with the "
"TLS option.\n\n"
"Example: imap://target/TLS:PLAIN\n");
}
+39 -24
View File
@@ -7,14 +7,13 @@ RFC 1459: Internet Relay Chat Protocol
*/
extern char *HYDRA_EXIT;
char *buf;
char buffer[300] = "";
int myport = PORT_IRC, mysslport = PORT_IRC_SSL;
int32_t myport = PORT_IRC, mysslport = PORT_IRC_SSL;
int start_oper_irc(int s, char *ip, int port, unsigned char options, char *miscptr, FILE * fp) {
int32_t start_oper_irc(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
char *empty = "";
char *login, *pass;
int ret;
int32_t ret;
if (strlen(login = hydra_get_next_login()) == 0)
login = empty;
@@ -42,7 +41,7 @@ int start_oper_irc(int s, char *ip, int port, unsigned char options, char *miscp
return 2;
}
int send_nick(int s, char *ip, char *pass) {
int32_t send_nick(int32_t s, char *ip, char *pass) {
if (strlen(pass) > 0) {
sprintf(buffer, "PASS %s\r\n", pass);
if (hydra_send(s, buffer, strlen(buffer), 0) < 0) {
@@ -53,17 +52,17 @@ int send_nick(int s, char *ip, char *pass) {
if (hydra_send(s, buffer, strlen(buffer), 0) < 0) {
return -1;
}
sprintf(buffer, "NICK hydra%d\r\nUSER hydra%d hydra %s :hydra\r\n", (int) getpid(), (int) getpid(), hydra_address2string(ip));
sprintf(buffer, "NICK hydra%d\r\nUSER hydra%d hydra %s :hydra\r\n", (int32_t)getpid(), (int32_t)getpid(), hydra_address2string(ip));
if (hydra_send(s, buffer, strlen(buffer), 0) < 0) {
return -1;
}
return 0;
}
int irc_server_connect(char *ip, int sock, int port, unsigned char options, char *hostname) {
int32_t irc_server_connect(char *ip, int32_t sock, int32_t port, unsigned char options, char *hostname) {
if (sock >= 0)
sock = hydra_disconnect(sock);
// sleepn(275);
// usleepn(275);
if ((options & OPTION_SSL) == 0) {
if (port != 0)
myport = port;
@@ -78,17 +77,17 @@ int irc_server_connect(char *ip, int sock, int port, unsigned char options, char
return sock;
}
int start_pass_irc(int s, char *ip, int port, unsigned char options, char *miscptr, FILE * fp, char *hostname) {
int32_t start_pass_irc(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp, char *hostname) {
char *empty = "";
char *pass;
int ret;
int32_t ret;
if (strlen(pass = hydra_get_next_password()) == 0)
pass = empty;
s = irc_server_connect(ip, s, port, options, hostname);
if (s < 0) {
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int) getpid());
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
return 3;
}
@@ -106,10 +105,16 @@ int start_pass_irc(int s, char *ip, int port, unsigned char options, char *miscp
#endif
hydra_report_pass_found(port, ip, "irc", fp);
hydra_completed_pair_found();
hydra_report(stderr, "[INFO] Server password '%s' is working, you can pass it as argument\nto irc module to then try login/password oper mode\n", pass);
hydra_report(stderr,
"[INFO] Server password '%s' is working, you can pass it as "
"argument\nto irc module to then try login/password oper mode\n",
pass);
} else {
if (verbose && (miscptr != NULL))
hydra_report(stderr, "[VERBOSE] Server is requesting a general password, '%s' you entered is not working\n", miscptr);
hydra_report(stderr,
"[VERBOSE] Server is requesting a general password, '%s' "
"you entered is not working\n",
miscptr);
hydra_completed_pair();
}
@@ -118,8 +123,8 @@ int start_pass_irc(int s, char *ip, int port, unsigned char options, char *miscp
return 4;
}
void service_irc(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int run = 1, next_run = 1, sock = -1, ret;
void service_irc(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
int32_t run = 1, next_run = 1, sock = -1, ret;
char *buf;
hydra_register_socket(sp);
@@ -129,11 +134,11 @@ void service_irc(char *ip, int sp, unsigned char options, char *miscptr, FILE *
while (1) {
next_run = 0;
switch (run) {
case 1: /* connect and service init function */
case 1: /* connect and service init function */
sock = irc_server_connect(ip, sock, port, options, hostname);
if (sock < 0) {
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int) getpid());
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
hydra_child_exit(1);
}
@@ -148,7 +153,7 @@ void service_irc(char *ip, int sp, unsigned char options, char *miscptr, FILE *
if ((ret = hydra_recv(sock, buffer, sizeof(buffer) - 1)) >= 0)
buffer[ret] = 0;
/* ERROR :Bad password */
/* ERROR :Bad password */
#ifdef HAVE_PCRE
if ((ret > 0) && (hydra_string_match(buffer, "ERROR\\s.*password"))) {
#else
@@ -181,19 +186,23 @@ void service_irc(char *ip, int sp, unsigned char options, char *miscptr, FILE *
hydra_child_exit(0);
}
/* ERROR :Bad password is returned from ngircd when it s waiting for a server password */
/* ERROR :Bad password is returned from ngircd when it s waiting for a
* server password */
if ((ret > 0) && (strstr(buffer, " 001 ") == NULL)) {
/* seems we not successfully connected */
hydra_report(stderr, "[ERROR] should not be able to identify server msg, please report it\n%s\n", buffer);
hydra_report(stderr,
"[ERROR] should not be able to identify server msg, "
"please report it\n%s\n",
buffer);
hydra_child_exit(0);
}
next_run = 2;
break;
case 2: /* run the cracking function */
case 2: /* run the cracking function */
next_run = start_oper_irc(sock, ip, port, options, miscptr, fp);
break;
case 3: /* clean exit */
case 3: /* clean exit */
if (sock >= 0)
sock = hydra_disconnect(sock);
hydra_child_exit(0);
@@ -209,16 +218,22 @@ void service_irc(char *ip, int sp, unsigned char options, char *miscptr, FILE *
}
}
int service_irc_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int32_t service_irc_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
//
// fill if needed.
//
//
// return codes:
// 0 all OK
// -1 error, hydra will exit, so print a good error message here
return 0;
}
void usage_irc(const char *service) {
printf("Module irc is optionally taking the general server password, if the "
"server is requiring one, and if none is passed the password from "
"-p/-P will be used\n\n");
}
+83 -60
View File
@@ -4,21 +4,21 @@
extern char *HYDRA_EXIT;
unsigned char *buf;
int counter;
int tls_required = 0;
int32_t counter;
int32_t tls_required = 0;
int start_ldap(int s, char *ip, int port, unsigned char options, char *miscptr, FILE * fp, char *hostname, char version, int auth_method) {
char *empty = "";
int32_t start_ldap(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp, char *hostname, char version, int32_t auth_method) {
char *empty = "", *result = NULL;
char *login = "", *pass, *fooptr = "";
unsigned char buffer[512];
int length = 0;
int ldap_auth_mechanism = auth_method;
int32_t length = 0;
int32_t ldap_auth_mechanism = auth_method;
/*
The LDAP "simple" method has three modes of operation:
* anonymous= no user no pass
* unauthenticated= user but no pass
* user/password authenticated= user and pass
* user/password authenticated= user and pass
*/
if ((miscptr != NULL) && (ldap_auth_mechanism == AUTH_CLEAR)) {
@@ -65,9 +65,9 @@ int start_ldap(int s, char *ip, int port, unsigned char options, char *miscptr,
if (ldap_auth_mechanism == AUTH_CLEAR) {
buffer[11] = strlen(login); /* DN */
memcpy(&buffer[12], login, strlen(login));
buffer[12 + strlen(login)] = (unsigned char) 128;
buffer[12 + strlen(login)] = (unsigned char)128;
buffer[13 + strlen(login)] = strlen(pass);
memcpy(&buffer[14 + strlen(login)], pass, strlen(pass)); /* PASS */
memcpy(&buffer[14 + strlen(login)], pass, strlen(pass)); /* PASS */
} else {
char *authm = "DIGEST-MD5";
@@ -79,7 +79,7 @@ int start_ldap(int s, char *ip, int port, unsigned char options, char *miscptr,
miscptr[sizeof(buffer) - 16 - strlen(authm)] = '\0';
}
buffer[11] = strlen(miscptr); /* DN */
buffer[11] = strlen(miscptr); /* DN */
memcpy(&buffer[12], miscptr, strlen(miscptr));
buffer[12 + strlen(miscptr)] = 163;
buffer[13 + strlen(miscptr)] = 2 + strlen(authm);
@@ -87,9 +87,9 @@ int start_ldap(int s, char *ip, int port, unsigned char options, char *miscptr,
buffer[15 + strlen(miscptr)] = strlen(authm);
memcpy(&buffer[16 + strlen(miscptr)], authm, strlen(authm));
}
if (hydra_send(s, (char *) buffer, length, 0) < 0)
if (hydra_send(s, (char *)buffer, length, 0) < 0)
return 1;
if ((buf = (unsigned char *) hydra_receive_line(s)) == NULL)
if ((buf = (unsigned char *)hydra_receive_line(s)) == NULL)
return 1;
if (buf[0] != 0 && buf[0] != 32 && buf[9] == 2) {
@@ -115,16 +115,16 @@ int start_ldap(int s, char *ip, int port, unsigned char options, char *miscptr,
}
#ifdef LIBOPENSSL
/* one more step auth for CRAM and DIGEST */
/* one more step auth for CRAM and DIGEST */
if (ldap_auth_mechanism == AUTH_CRAMMD5) {
/* get the challenge, need to extract it */
char *ptr;
char buf2[32];
ptr = strstr((char *) buf, "<");
ptr = strstr((char *)buf, "<");
fooptr = buf2;
sasl_cram_md5(fooptr, pass, ptr);
if (fooptr == NULL)
result = sasl_cram_md5(fooptr, pass, ptr);
if (result == NULL)
return 1;
counter++;
if (strstr(miscptr, "^USER^") != NULL) {
@@ -148,7 +148,7 @@ int start_ldap(int s, char *ip, int port, unsigned char options, char *miscptr,
buffer[9] = version;
buffer[10] = 4;
buffer[11] = strlen(miscptr); /* DN */
buffer[11] = strlen(miscptr); /* DN */
memcpy(&buffer[12], miscptr, strlen(miscptr));
buffer[12 + strlen(miscptr)] = 163;
buffer[13 + strlen(miscptr)] = 2 + strlen("CRAM-MD5") + 2 + strlen(login) + 1 + strlen(buf2);
@@ -161,18 +161,18 @@ int start_ldap(int s, char *ip, int port, unsigned char options, char *miscptr,
buffer[18 + strlen(miscptr) + strlen("CRAM-MD5") + strlen(login)] = ' ';
memcpy(&buffer[18 + strlen(miscptr) + strlen("CRAM-MD5") + strlen(login) + 1], buf2, strlen(buf2));
if (hydra_send(s, (char *) buffer, length, 0) < 0)
if (hydra_send(s, (char *)buffer, length, 0) < 0)
return 1;
free(buf);
if ((buf = (unsigned char *) hydra_receive_line(s)) == NULL)
if ((buf = (unsigned char *)hydra_receive_line(s)) == NULL)
return 1;
} else {
if (ldap_auth_mechanism == AUTH_DIGESTMD5) {
char *ptr;
char buffer2[500];
int ind = 0;
int32_t ind = 0;
ptr = strstr((char *) buf, "realm=");
ptr = strstr((char *)buf, "realm=");
counter++;
if (strstr(miscptr, "^USER^") != NULL) {
@@ -180,8 +180,8 @@ int start_ldap(int s, char *ip, int port, unsigned char options, char *miscptr,
}
fooptr = buffer2;
sasl_digest_md5(fooptr, login, pass, ptr, miscptr, "ldap", NULL, 0, NULL);
if (fooptr == NULL) {
result = sasl_digest_md5(fooptr, login, pass, ptr, miscptr, "ldap", NULL, 0, NULL);
if (result == NULL) {
free(buf);
return 3;
}
@@ -213,7 +213,7 @@ int start_ldap(int s, char *ip, int port, unsigned char options, char *miscptr,
ind++;
buffer[ind] = counter % 256;
ind++;
buffer[ind] = 96; /*0x60 */
buffer[ind] = 96; /*0x60 */
ind++;
buffer[ind] = 130;
ind++;
@@ -240,9 +240,9 @@ int start_ldap(int s, char *ip, int port, unsigned char options, char *miscptr,
buffer[ind] = strlen(miscptr);
ind++;
memcpy(&buffer[ind], miscptr, strlen(miscptr));
/*DN*/ buffer[ind + strlen(miscptr)] = 163; //0xa3
/*DN*/ buffer[ind + strlen(miscptr)] = 163; // 0xa3
ind++;
buffer[ind + strlen(miscptr)] = 130; //0x82
buffer[ind + strlen(miscptr)] = 130; // 0x82
ind++;
if (strlen(buffer2) + 6 + strlen("DIGEST-MD5") > 255) {
@@ -279,10 +279,10 @@ int start_ldap(int s, char *ip, int port, unsigned char options, char *miscptr,
memcpy(&buffer[ind + strlen(miscptr) + strlen("DIGEST-MD5")], buffer2, strlen(buffer2));
ind++;
if (hydra_send(s, (char *) buffer, length, 0) < 0)
if (hydra_send(s, (char *)buffer, length, 0) < 0)
return 1;
free(buf);
if ((buf = (unsigned char *) hydra_receive_line(s)) == NULL)
if ((buf = (unsigned char *)hydra_receive_line(s)) == NULL)
return 1;
}
}
@@ -306,21 +306,27 @@ int start_ldap(int s, char *ip, int port, unsigned char options, char *miscptr,
if ((buf[0] != 0 && buf[0] != 32) && buf[9] == 53) {
if (verbose)
hydra_report(stderr, "[VERBOSE] Server unwilling to perform action, maybe deny by server config or too busy when tried login: %s password: %s\n", login, pass);
hydra_report(stderr,
"[VERBOSE] Server unwilling to perform action, maybe deny by server "
"config or too busy when tried login: %s password: %s\n",
login, pass);
free(buf);
return 1;
}
if ((buf[0] != 0 && buf[0] != 32) && buf[9] == 2) {
hydra_report(stderr, "[ERROR] Invalid protocol version, you tried ldap%c, better try ldap%c\n", version + '0', version == 2 ? '3' : '2');
hydra_report(stderr,
"[ERROR] Invalid protocol version, you tried ldap%c, better "
"try ldap%c\n",
version + '0', version == 2 ? '3' : '2');
free(buf);
hydra_child_exit(2);
sleep(1);
hydra_child_exit(2);
}
//0 0x30, 0x84, 0x20, 0x20, 0x20, 0x10, 0x02, 0x01,
//8 0x01, 0x61, 0x84, 0x20, 0x20, 0x20, 0x07, 0x0a,
//16 0x01, 0x20, 0x04, 0x20, 0x04, 0x20, 0x00, 0x00,
// 0 0x30, 0x84, 0x20, 0x20, 0x20, 0x10, 0x02, 0x01,
// 8 0x01, 0x61, 0x84, 0x20, 0x20, 0x20, 0x07, 0x0a,
// 16 0x01, 0x20, 0x04, 0x20, 0x04, 0x20, 0x00, 0x00,
// this is for w2k8 active directory ldap auth
if (buf[0] == 48 && buf[1] == 132) {
@@ -335,10 +341,9 @@ int start_ldap(int s, char *ip, int port, unsigned char options, char *miscptr,
}
}
} else {
if (buf[9] != 49 && buf[9] != 2 && buf[9] != 53) {
hydra_report(stderr, "[ERROR] Uh, unknown LDAP response! Please report this: \n");
print_hex((unsigned char *) buf, 24);
print_hex((unsigned char *)buf, 24);
free(buf);
return 3;
}
@@ -351,19 +356,19 @@ int start_ldap(int s, char *ip, int port, unsigned char options, char *miscptr,
return 2;
}
void service_ldap(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname, char version, int auth_method) {
int run = 1, next_run = 1, sock = -1;
int myport = PORT_LDAP, mysslport = PORT_LDAP_SSL;
void service_ldap(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname, char version, int32_t auth_method) {
int32_t run = 1, next_run = 1, sock = -1;
int32_t myport = PORT_LDAP, mysslport = PORT_LDAP_SSL;
hydra_register_socket(sp);
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return;
while (1) {
switch (run) {
case 1: /* connect and service init function */
case 1: /* connect and service init function */
if (sock >= 0)
sock = hydra_disconnect(sock);
// sleepn(275);
// usleepn(275);
if ((options & OPTION_SSL) == 0) {
if (port != 0)
myport = port;
@@ -377,22 +382,25 @@ void service_ldap(char *ip, int sp, unsigned char options, char *miscptr, FILE *
}
if (sock < 0) {
if (verbose || debug)
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int) getpid());
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
hydra_child_exit(1);
}
counter = 1;
if (tls_required) {
/* Start TLS operation OID = 1.3.6.1.4.1.1466.20037 according to RFC 2830 */
char confidentiality_required[] = "\x30\x1d\x02\x01\x01\x77\x18\x80\x16\x31\x2e\x33\x2e\x36\x2e\x31\x2e\x34\x2e\x31\x2e\x31\x34\x36\x36\x2e\x32\x30\x30\x33\x37";
/* Start TLS operation OID = 1.3.6.1.4.1.1466.20037 according to RFC
* 2830 */
char confidentiality_required[] = "\x30\x1d\x02\x01\x01\x77\x18\x80\x16\x31\x2e\x33\x2e\x36\x2e\x31"
"\x2e\x34\x2e\x31\x2e\x31\x34\x36\x36\x2e\x32\x30\x30\x33\x37";
if (hydra_send(sock, confidentiality_required, strlen(confidentiality_required), 0) < 0)
hydra_child_exit(1);
if ((buf = (unsigned char *) hydra_receive_line(sock)) == NULL)
if ((buf = (unsigned char *)hydra_receive_line(sock)) == NULL)
hydra_child_exit(1);
if ((buf[0] != 0 && buf[9] == 0) || (buf[0] != 32 && buf[9] == 32)) {
/* TLS option negociation goes well, now trying to connect */
free(buf);
if ((hydra_connect_to_ssl(sock, hostname) == -1) && verbose) {
hydra_report(stderr, "[ERROR] Can't use TLS\n");
hydra_child_exit(1);
@@ -403,16 +411,17 @@ void service_ldap(char *ip, int sp, unsigned char options, char *miscptr, FILE *
}
} else {
hydra_report(stderr, "[ERROR] Can't use TLS %s\n", buf);
free(buf);
hydra_child_exit(1);
}
}
next_run = 2;
break;
case 2: /* run the cracking function */
case 2: /* run the cracking function */
next_run = start_ldap(sock, ip, port, options, miscptr, fp, hostname, version, auth_method);
counter++;
break;
case 3: /* clean exit */
case 3: /* clean exit */
if (sock >= 0)
sock = hydra_disconnect(sock);
hydra_child_exit(0);
@@ -425,32 +434,46 @@ void service_ldap(char *ip, int sp, unsigned char options, char *miscptr, FILE *
}
}
void service_ldap2(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
service_ldap(ip, sp, options, miscptr, fp, port, hostname, 2, AUTH_CLEAR);
}
void service_ldap2(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) { service_ldap(ip, sp, options, miscptr, fp, port, hostname, 2, AUTH_CLEAR); }
void service_ldap3(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
service_ldap(ip, sp, options, miscptr, fp, port, hostname, 3, AUTH_CLEAR);
}
void service_ldap3(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) { service_ldap(ip, sp, options, miscptr, fp, port, hostname, 3, AUTH_CLEAR); }
void service_ldap3_cram_md5(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
service_ldap(ip, sp, options, miscptr, fp, port, hostname, 3, AUTH_CRAMMD5);
}
void service_ldap3_cram_md5(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) { service_ldap(ip, sp, options, miscptr, fp, port, hostname, 3, AUTH_CRAMMD5); }
void service_ldap3_digest_md5(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
service_ldap(ip, sp, options, miscptr, fp, port, hostname, 3, AUTH_DIGESTMD5);
}
void service_ldap3_digest_md5(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) { service_ldap(ip, sp, options, miscptr, fp, port, hostname, 3, AUTH_DIGESTMD5); }
int service_ldap_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int32_t service_ldap_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
//
// fill if needed.
//
//
// return codes:
// 0 all OK
// -1 error, hydra will exit, so print a good error message here
if (miscptr != NULL && strlen(miscptr) > 220) {
fprintf(stderr, "[ERROR] the option string to this module may not be "
"larger than 220 bytes\n");
return -1;
}
return 0;
}
void usage_ldap(const char *service) {
printf("Module %s is optionally taking the DN (depending of the auth method "
"choosed\n"
"Note: you can also specify the DN as login when Simple auth method "
"is used).\n"
"The keyword \"^USER^\" is replaced with the login.\n"
"Special notes for Simple method has 3 operation modes: anonymous, "
"(no user no pass),\n"
"unauthenticated (user but no pass), user/pass authenticated (user "
"and pass).\n"
"So don't forget to set empty string as user/pass to test all modes.\n"
"Hint: to authenticate to a windows active directory ldap, this is "
"usually\n"
" cn=^USER^,cn=users,dc=foo,dc=bar,dc=com for domain foo.bar.com\n\n",
service);
}
+176
View File
@@ -0,0 +1,176 @@
// This plugin was written by <david dot maciejak at gmail D O T com>
// Tested on memcached 1.5.6-0ubuntu1
#ifdef LIBMCACHED
#include <libmemcached/memcached.h>
#endif
#include "hydra-mod.h"
#ifndef LIBMCACHED
void dummy_mcached() { printf("\n"); }
#else
extern int32_t hydra_data_ready_timed(int32_t socket, long sec, long usec);
extern char *HYDRA_EXIT;
int mcached_send_com_quit(int32_t sock) {
char *com_quit = "quit\r\n";
if (hydra_send(sock, com_quit, strlen(com_quit), 0) < 0)
return 1;
return 0;
}
int mcached_send_com_version(int32_t sock) {
char *com_version = "version\r\n";
if (hydra_send(sock, com_version, strlen(com_version), 0) < 0)
return 1;
return 0;
}
int32_t start_mcached(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
char *empty = "";
char *login, *pass;
memcached_server_st *servers = NULL;
memcached_return_t rc;
memcached_st *cache;
if (strlen(login = hydra_get_next_login()) == 0)
login = empty;
if (strlen(pass = hydra_get_next_password()) == 0)
pass = empty;
cache = memcached_create(NULL);
rc = memcached_set_sasl_auth_data(cache, login, pass);
if (rc != MEMCACHED_SUCCESS) {
if (verbose)
hydra_report(stderr, "[ERROR] Couldn't setup SASL auth: %s\n", memcached_strerror(cache, rc));
memcached_free(cache);
return 3;
}
rc = memcached_behavior_set(cache, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 1);
if (rc != MEMCACHED_SUCCESS) {
if (verbose)
hydra_report(stderr, "[ERROR] Couldn't use the binary protocol: %s\n", memcached_strerror(cache, rc));
memcached_destroy_sasl_auth_data(cache);
memcached_free(cache);
return 3;
}
rc = memcached_behavior_set(cache, MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT, 10000);
if (rc != MEMCACHED_SUCCESS) {
if (verbose)
hydra_report(stderr, "[ERROR] Couldn't set the connect timeout: %s\n", memcached_strerror(cache, rc));
memcached_destroy_sasl_auth_data(cache);
memcached_free(cache);
return 3;
}
servers = memcached_server_list_append(servers, hydra_address2string(ip), port, &rc);
rc = memcached_server_push(cache, servers);
if (rc != MEMCACHED_SUCCESS) {
if (verbose)
hydra_report(stderr, "[ERROR] Couldn't add server: %s\n", memcached_strerror(cache, rc));
memcached_destroy_sasl_auth_data(cache);
memcached_free(cache);
return 3;
}
rc = memcached_stat_execute(cache, "", NULL, NULL);
if (rc != MEMCACHED_SUCCESS) {
if (verbose)
hydra_report(stderr, "[ERROR] Couldn't get server stats: %s\n", memcached_strerror(cache, rc));
memcached_destroy_sasl_auth_data(cache);
memcached_free(cache);
hydra_completed_pair_skip();
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0) {
return 3;
}
return 2;
}
memcached_destroy_sasl_auth_data(cache);
memcached_free(cache);
hydra_report_found_host(port, ip, "memcached", fp);
hydra_completed_pair_found();
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return 3;
return 2;
}
void service_mcached(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
int32_t run = 1, next_run = 1, sock = -1;
hydra_register_socket(sp);
while (1) {
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return;
switch (run) {
case 1:
next_run = start_mcached(sock, ip, port, options, miscptr, fp);
break;
case 2:
hydra_child_exit(0);
return;
default:
if (!verbose)
hydra_report(stderr, "[ERROR] Caught unknown return code, try verbose "
"option for more details\n");
hydra_child_exit(2);
}
run = next_run;
}
}
int32_t service_mcached_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
int32_t sock = -1;
int32_t myport = PORT_MCACHED;
char *buf;
if (port != 0)
myport = port;
sock = hydra_connect_tcp(ip, myport);
if (sock < 0) {
if (verbose || debug)
hydra_report(stderr, "[ERROR] Can not connect\n");
return -1;
}
if (mcached_send_com_version(sock)) {
if (verbose || debug)
hydra_report(stderr, "[ERROR] Can not send request\n");
return -1;
}
if (hydra_data_ready_timed(sock, 0, 1000) > 0) {
buf = hydra_receive_line(sock);
if (strstr(buf, "VERSION ")) {
hydra_report_found_host(port, ip, "memcached", fp);
mcached_send_com_quit(sock);
if (sock >= 0)
sock = hydra_disconnect(sock);
hydra_report(stderr, "[ERROR] Memcached server does not require any authentication\n");
}
free(buf);
return -1;
}
if (sock >= 0)
sock = hydra_disconnect(sock);
return 0;
}
#endif
+436 -355
View File
File diff suppressed because it is too large Load Diff
+54 -34
View File
@@ -3,60 +3,80 @@
#include "hydra.h"
#ifdef __sun
#include <sys/int_types.h>
#elif defined(__FreeBSD__) || defined(__IBMCPP__) || defined(_AIX)
#include <inttypes.h>
#else
#include <stdint.h>
#endif
extern char quiet;
extern void hydra_child_exit(int code);
extern void hydra_register_socket(int s);
extern void hydra_child_exit(int32_t code);
extern void hydra_register_socket(int32_t s);
extern char *hydra_get_next_pair();
extern char *hydra_get_next_login();
extern char *hydra_get_next_password();
extern void hydra_completed_pair();
extern void hydra_completed_pair_found();
extern void hydra_completed_pair_skip();
extern void hydra_report_found(int port, char *svc, FILE * fp);
extern void hydra_report_pass_found(int port, char *ip, char *svc, FILE * fp);
extern void hydra_report_found_host(int port, char *ip, char *svc, FILE * fp);
extern void hydra_report_found_host_msg(int port, char *ip, char *svc, FILE * fp, char *msg);
extern void hydra_report_found(int32_t port, char *svc, FILE *fp);
extern void hydra_report_pass_found(int32_t port, char *ip, char *svc, FILE *fp);
extern void hydra_report_found_host(int32_t port, char *ip, char *svc, FILE *fp);
extern void hydra_report_found_host_msg(int32_t port, char *ip, char *svc, FILE *fp, char *msg);
extern void hydra_report_debug(FILE *st, char *format, ...);
extern int hydra_connect_to_ssl(int socket, char *hostname);
extern int hydra_connect_ssl(char *host, int port, char *hostname);
extern int hydra_connect_tcp(char *host, int port);
extern int hydra_connect_udp(char *host, int port);
extern int hydra_disconnect(int socket);
extern int hydra_data_ready(int socket);
extern int hydra_recv(int socket, char *buf, int length);
extern int hydra_recv_nb(int socket, char *buf, int length);
extern char *hydra_receive_line(int socket);
extern int hydra_send(int socket, char *buf, int size, int options);
extern int make_to_lower(char *buf);
extern int32_t hydra_connect_to_ssl(int32_t socket, char *hostname);
extern int32_t hydra_connect_ssl(char *host, int32_t port, char *hostname);
extern int32_t hydra_connect_tcp(char *host, int32_t port);
extern int32_t hydra_connect_udp(char *host, int32_t port);
extern int32_t hydra_disconnect(int32_t socket);
extern int32_t hydra_data_ready(int32_t socket);
extern int32_t hydra_recv(int32_t socket, char *buf, uint32_t length);
extern int32_t hydra_recv_nb(int32_t socket, char *buf, uint32_t length);
extern char *hydra_receive_line(int32_t socket);
extern int32_t hydra_send(int32_t socket, char *buf, uint32_t size, int32_t options);
extern int32_t make_to_lower(char *buf);
extern unsigned char hydra_conv64(unsigned char in);
extern void hydra_tobase64(unsigned char *buf, int buflen, int bufsize);
extern void hydra_dump_asciihex(unsigned char *string, int length);
extern void hydra_set_srcport(int port);
extern void hydra_tobase64(unsigned char *buf, uint32_t buflen, uint32_t bufsize);
extern void hydra_dump_asciihex(unsigned char *string, int32_t length);
extern void hydra_set_srcport(int32_t port);
extern char *hydra_address2string(char *address);
extern char *hydra_address2string_beautiful(char *address);
extern char *hydra_strcasestr(const char *haystack, const char *needle);
extern void hydra_dump_data(unsigned char *buf, int len, char *text);
extern int hydra_memsearch(char *haystack, int hlen, char *needle, int nlen);
extern void hydra_dump_data(unsigned char *buf, int32_t len, char *text);
extern int32_t hydra_memsearch(char *haystack, int32_t hlen, char *needle, int32_t nlen);
extern char *hydra_strrep(char *string, char *oldpiece, char *newpiece);
#ifdef HAVE_PCRE
int hydra_string_match(char *str, const char *regex);
int32_t hydra_string_match(char *str, const char *regex);
#endif
char *hydra_string_replace(const char *string, const char *substr, const char *replacement);
int debug;
int verbose;
int waittime;
int port;
int use_proxy;
int found;
char proxy_string_ip[36];
int proxy_string_port;
char proxy_string_type[10];
char *proxy_authentication;
int32_t debug;
int32_t verbose;
int32_t waittime;
int32_t port;
int32_t found;
int32_t proxy_count;
int32_t use_proxy;
int32_t selected_proxy;
char proxy_string_ip[MAX_PROXY_COUNT][36];
int32_t proxy_string_port[MAX_PROXY_COUNT];
char proxy_string_type[MAX_PROXY_COUNT][10];
char *proxy_authentication[MAX_PROXY_COUNT];
char *cmdlinetarget;
typedef int BOOL;
#ifndef __APPLE__
typedef int32_t BOOL;
#else /* __APPLE__ */
/* ensure compatibility with objc libraries */
#if (TARGET_OS_IPHONE && __LP64__) || TARGET_OS_WATCH
typedef bool BOOL;
#else
typedef signed char BOOL;
#endif
#endif /* __APPLE__ */
#define hydra_report fprintf
+185
View File
@@ -0,0 +1,185 @@
// This plugin was written by <david dot maciejak at gmail D O T com>
// Tested on mongodb-server 1:3.6.3-0ubuntu1
// MONGODB-CR is been deprecated
#ifdef LIBMONGODB
#include <mongoc.h>
#endif
#include "hydra-mod.h"
#ifndef LIBMONGODB
void dummy_mongodb() { printf("\n"); }
#else
extern int32_t hydra_data_ready_timed(int32_t socket, long sec, long usec);
extern char *HYDRA_EXIT;
char *buf;
#define DEFAULT_DB "admin"
int is_error_msg(char *msg) {
if (strstr(msg, "errmsg ")) {
if (debug)
hydra_report(stderr, "[ERROR] %s\n", msg);
return 1;
}
return 0;
}
int require_auth(int32_t sock) {
unsigned char m_hdr[] = "\x3f\x00\x00\x00" // messageLength (63)
"\x00\x00\x00\x41" // requestID
"\xff\xff\xff\xff" // responseTo
"\xd4\x07\x00\x00" // opCode (2004 OP_QUERY)
"\x00\x00\x00\x00" // flags
"\x61\x64\x6d\x69\x6e\x2e\x24\x63\x6d\x64\x00" // fullCollectionName
// (admin.$cmd)
"\x00\x00\x00\x00" // numberToSkip (0)
"\x01\x00\x00\x00" // numberToReturn (1)
"\x18\x00\x00\x00\x10\x6c\x69\x73\x74\x44\x61\x74\x61\x62\x61\x73\x65\x73"
"\x00\x01\x00\x00\x00\x00"; // query ({"listDatabases"=>1})
if (hydra_send(sock, m_hdr, sizeof(m_hdr), 0) > 0) {
if (hydra_data_ready_timed(sock, 0, 1000) > 0) {
buf = hydra_receive_line(sock);
return is_error_msg(buf);
}
}
return 2;
}
int32_t start_mongodb(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
char *empty = "";
char *login, *pass;
char uri[256];
mongoc_client_t *client;
mongoc_database_t *database;
mongoc_collection_t *collection;
mongoc_cursor_t *cursor;
bson_t q;
const bson_t *doc;
bson_error_t error;
bool r;
if (strlen(login = hydra_get_next_login()) == 0)
login = empty;
if (strlen(pass = hydra_get_next_password()) == 0)
pass = empty;
mongoc_init();
mongoc_log_set_handler(NULL, NULL);
bson_init(&q);
snprintf(uri, sizeof(uri), "mongodb://%s:%s@%s/?authSource=%s", login, pass, hydra_address2string(ip), miscptr);
client = mongoc_client_new(uri);
if (!client)
return 3;
mongoc_client_set_appname(client, "hydra");
collection = mongoc_client_get_collection(client, miscptr, "test");
cursor = mongoc_collection_find_with_opts(collection, &q, NULL, NULL);
r = mongoc_cursor_next(cursor, &doc);
if (!r) {
r = mongoc_cursor_error(cursor, &error);
if (r) {
if (verbose)
hydra_report(stderr, "[ERROR] Can not read document: %s\n", error.message);
mongoc_cursor_destroy(cursor);
mongoc_collection_destroy(collection);
mongoc_client_destroy(client);
mongoc_cleanup();
hydra_completed_pair_skip();
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0) {
return 3;
}
return 2;
}
}
mongoc_cursor_destroy(cursor);
mongoc_collection_destroy(collection);
mongoc_client_destroy(client);
mongoc_cleanup();
hydra_report_found_host(port, ip, "mongodb", fp);
hydra_completed_pair_found();
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return 3;
return 2;
}
void service_mongodb(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
int32_t run = 1, next_run = 1, sock = -1;
if (!miscptr) {
if (verbose)
hydra_report(stderr, "[INFO] Using default database \"admin\"\n");
miscptr = DEFAULT_DB;
}
hydra_register_socket(sp);
while (1) {
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return;
switch (run) {
case 1:
next_run = start_mongodb(sock, ip, port, options, miscptr, fp);
break;
case 2:
hydra_child_exit(0);
return;
default:
if (!verbose)
hydra_report(stderr, "[ERROR] Caught unknown return code, try verbose "
"option for more details\n");
hydra_child_exit(2);
}
run = next_run;
}
}
int32_t service_mongodb_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
int32_t myport = PORT_MONGODB;
int32_t sock = -1;
if (port != 0)
myport = port;
if ((options & OPTION_SSL) == 0)
sock = hydra_connect_tcp(ip, myport);
else
sock = hydra_connect_ssl(ip, myport, hostname);
if (sock < 0) {
if (verbose || debug)
hydra_report(stderr, "[ERROR] Can not connect\n");
return -1;
}
if (!require_auth(sock)) {
hydra_report_found_host(port, ip, "mongodb", fp);
hydra_report(stderr, "[ERROR] Mongodb server does not require any authentication\n");
if (sock >= 0)
sock = hydra_disconnect(sock);
return -1;
}
if (sock >= 0)
sock = hydra_disconnect(sock);
return 0;
}
#endif
void usage_mongodb(const char *service) {
printf("Module mongodb is optionally taking a database name to attack, "
"default is \"admin\"\n\n");
}
+59 -51
View File
@@ -5,53 +5,61 @@
extern char *HYDRA_EXIT;
char *buf;
unsigned char p_hdr[] =
"\x02\x00\x02\x00\x00\x00\x02\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00";
unsigned char p_pk2[] =
"\x30\x30\x30\x30\x30\x30\x61\x30\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x20\x18\x81\xb8\x2c\x08\x03"
"\x01\x06\x0a\x09\x01\x01\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x73\x71\x75\x65\x6c\x64\x61"
"\x20\x31\x2e\x30\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x0b\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00";
unsigned char p_pk3[] =
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x04\x02\x00\x00\x4d\x53\x44"
"\x42\x4c\x49\x42\x00\x00\x00\x07\x06\x00\x00" "\x00\x00\x0d\x11\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00";
unsigned char p_lng[] =
"\x02\x01\x00\x47\x00\x00\x02\x00\x00\x00\x00"
"\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x30\x30\x30\x00\x00" "\x00\x03\x00\x00\x00";
unsigned char p_hdr[] = "\x02\x00\x02\x00\x00\x00\x02\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00";
unsigned char p_pk2[] = "\x30\x30\x30\x30\x30\x30\x61\x30\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x20\x18\x81\xb8\x2c\x08\x03"
"\x01\x06\x0a\x09\x01\x01\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x73\x71\x75\x65\x6c\x64\x61"
"\x20\x31\x2e\x30\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x0b\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00";
unsigned char p_pk3[] = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x04\x02\x00\x00\x4d\x53\x44"
"\x42\x4c\x49\x42\x00\x00\x00\x07\x06\x00\x00"
"\x00\x00\x0d\x11\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00";
unsigned char p_lng[] = "\x02\x01\x00\x47\x00\x00\x02\x00\x00\x00\x00"
"\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x30\x30\x30\x00\x00"
"\x00\x03\x00\x00\x00";
int start_mssql(int s, char *ip, int port, unsigned char options, char *miscptr, FILE * fp) {
int32_t start_mssql(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
char *empty = "";
char *login, *pass, buffer[1024];
char ms_login[MSLEN + 1];
char ms_pass[MSLEN + 1];
unsigned char len_login, len_pass;
int ret = -1;
int32_t ret = -1;
if (strlen(login = hydra_get_next_login()) == 0)
login = empty;
@@ -81,7 +89,7 @@ int start_mssql(int s, char *ip, int port, unsigned char options, char *miscptr,
if (hydra_send(s, buffer, MSLEN + 1 + 39 + MSLEN + 1 + 110 + 1 + MSLEN + 270, 0) < 0)
return 1;
if (hydra_send(s, (char *) p_lng, 71, 0) < 0)
if (hydra_send(s, (char *)p_lng, 71, 0) < 0)
return 1;
memset(buffer, 0, sizeof(buffer));
@@ -107,16 +115,16 @@ int start_mssql(int s, char *ip, int port, unsigned char options, char *miscptr,
return 1;
}
void service_mssql(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int run = 1, next_run = 1, sock = -1;
int myport = PORT_MSSQL, mysslport = PORT_MSSQL_SSL;
void service_mssql(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
int32_t run = 1, next_run = 1, sock = -1;
int32_t myport = PORT_MSSQL, mysslport = PORT_MSSQL_SSL;
hydra_register_socket(sp);
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return;
while (1) {
switch (run) {
case 1: /* connect and service init function */
case 1: /* connect and service init function */
if ((options & OPTION_SSL) == 0) {
if (port != 0)
myport = port;
@@ -129,18 +137,18 @@ void service_mssql(char *ip, int sp, unsigned char options, char *miscptr, FILE
port = mysslport;
}
if (sock < 0) {
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int) getpid());
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
hydra_child_exit(1);
}
next_run = start_mssql(sock, ip, port, options, miscptr, fp);
hydra_disconnect(sock);
break;
case 2: /* clean exit */
case 2: /* clean exit */
if (sock >= 0)
sock = hydra_disconnect(sock);
hydra_child_exit(0);
return;
case 3: /* clean exit */
case 3: /* clean exit */
if (sock >= 0)
sock = hydra_disconnect(sock);
hydra_child_exit(2);
@@ -153,13 +161,13 @@ void service_mssql(char *ip, int sp, unsigned char options, char *miscptr, FILE
}
}
int service_mssql_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int32_t service_mssql_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
//
// fill if needed.
//
//
// return codes:
// 0 all OK
// -1 error, hydra will exit, so print a good error message here
+69 -70
View File
@@ -1,19 +1,16 @@
/* mysql 3.2x.x to 4.x support - by mcbethh (at) u-n-f (dot) com */
/* david (dot) maciejak (at) gmail (dot) com for using libmysqlclient-dev, adding support for mysql version 5.x */
/* david (dot) maciejak (at) gmail (dot) com for using libmysqlclient-dev,
* adding support for mysql version 5.x */
#include "hydra-mod.h"
#ifndef HAVE_MATH_H
#include <stdio.h>
void dummy_mysql() {
printf("\n");
}
void dummy_mysql() { printf("\n"); }
void service_mysql(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
printf("\n");
}
void service_mysql(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) { printf("\n"); }
#else
#include <math.h>
@@ -35,23 +32,24 @@ MYSQL *mysql = NULL;
void hydra_hash_password(unsigned long *result, const char *password);
char *hydra_scramble(char *to, const char *message, const char *password);
extern int internal__hydra_recv(int socket, char *buf, int length);
extern int hydra_data_ready_timed(int socket, long sec, long usec);
extern int32_t internal__hydra_recv(int32_t socket, char *buf, int32_t length);
extern int32_t hydra_data_ready_timed(int32_t socket, long sec, long usec);
extern char *HYDRA_EXIT;
char mysqlsalt[9];
/* modified hydra_receive_line, I've striped code which changed every 0x00 to 0x20 */
char *hydra_mysql_receive_line(int socket) {
/* modified hydra_receive_line, I've striped code which changed every 0x00 to
* 0x20 */
char *hydra_mysql_receive_line(int32_t socket) {
char buf[300], *buff, *buff2;
int i = 0, j = 0, buff_size = 300;
int32_t i = 0, j = 0, buff_size = 300;
buff = malloc(buff_size);
if (buff == NULL)
return NULL;
memset(buff, 0, sizeof(buf));
i = hydra_data_ready_timed(socket, (long) waittime, 0);
i = hydra_data_ready_timed(socket, (long)waittime, 0);
if (i > 0) {
if ((i = internal__hydra_recv(socket, buff, sizeof(buf))) < 0) {
free(buff);
@@ -87,7 +85,7 @@ char *hydra_mysql_receive_line(int socket) {
}
/* check if valid mysql protocol, mysql version and read salt */
char hydra_mysql_init(int sock) {
char hydra_mysql_init(int32_t sock) {
char *server_version, *pos, *buf;
unsigned char protocol;
@@ -98,7 +96,7 @@ char hydra_mysql_init(int sock) {
protocol = buf[4];
if (protocol == 0xff) {
pos = &buf[6];
// *(strchr(pos, '.')) = '\0';
// *(strchr(pos, '.')) = '\0';
hydra_report(stderr, "[ERROR] %s\n", pos);
free(buf);
return 2;
@@ -108,7 +106,10 @@ char hydra_mysql_init(int sock) {
return 2;
}
if (protocol > 10) {
fprintf(stderr, "[INFO] This is protocol version %d, only v10 is supported, not sure if it will work\n", protocol);
fprintf(stderr,
"[INFO] This is protocol version %d, only v10 is supported, not "
"sure if it will work\n",
protocol);
}
server_version = &buf[5];
pos = buf + strlen(server_version) + 10;
@@ -116,7 +117,8 @@ char hydra_mysql_init(int sock) {
if (!strstr(server_version, "3.") && !strstr(server_version, "4.") && strstr(server_version, "5.")) {
#ifndef LIBMYSQLCLIENT
hydra_report(stderr, "[ERROR] Not an MySQL protocol or unsupported version,\ncheck configure to see if libmysql is found\n");
hydra_report(stderr, "[ERROR] Not an MySQL protocol or unsupported version,\ncheck "
"configure to see if libmysql is found\n");
#endif
free(buf);
return 2;
@@ -130,35 +132,32 @@ char hydra_mysql_init(int sock) {
char *hydra_mysql_prepare_auth(char *login, char *pass) {
unsigned char *response;
unsigned long login_len = strlen(login) > 32 ? 32 : strlen(login);
unsigned long response_len = 4 /* header */ +
2 /* client flags */ +
3 /* max packet len */ +
login_len + 1 + 8 /* scrambled password len */ ;
unsigned long response_len = 4 /* header */ + 2 /* client flags */ + 3 /* max packet len */ + login_len + 1 + 8 /* scrambled password len */;
response = (unsigned char *) malloc(response_len + 4);
response = (unsigned char *)malloc(response_len + 4);
if (response == NULL) {
fprintf(stderr, "[ERROR] could not allocate memory\n");
return NULL;
}
memset(response, 0, response_len + 4);
*((unsigned long *) response) = response_len - 4;
response[3] = 0x01; /* packet number */
*((unsigned long *)response) = response_len - 4;
response[3] = 0x01; /* packet number */
response[4] = 0x85;
response[5] = 0x24; /* client flags */
response[6] = response[7] = response[8] = 0x00; /* max packet */
memcpy(&response[9], login, login_len); /* login */
response[9 + login_len] = '\0'; /* null terminate login */
hydra_scramble((char *) &response[9 + login_len + 1], mysqlsalt, pass);
response[5] = 0x24; /* client flags */
response[6] = response[7] = response[8] = 0x00; /* max packet */
memcpy(&response[9], login, login_len); /* login */
response[9 + login_len] = '\0'; /* null terminate login */
hydra_scramble((char *)&response[9 + login_len + 1], mysqlsalt, pass);
return (char *) response;
return (char *)response;
}
/* returns 0 if authentication succeed */
/* and 1 if failed */
char hydra_mysql_parse_response(unsigned char *response) {
unsigned long response_len = *((unsigned long *) response) & 0xffffff;
unsigned long response_len = *((unsigned long *)response) & 0xffffff;
if (response_len < 4)
return 0;
@@ -169,30 +168,24 @@ char hydra_mysql_parse_response(unsigned char *response) {
return 0;
}
char hydra_mysql_send_com_quit(int sock) {
char com_quit_packet[5] = { 0x01, 0x00, 0x00, 0x00, 0x01 };
char hydra_mysql_send_com_quit(int32_t sock) {
char com_quit_packet[5] = {0x01, 0x00, 0x00, 0x00, 0x01};
hydra_send(sock, com_quit_packet, 5, 0);
return 0;
}
int start_mysql(int sock, char *ip, int port, unsigned char options, char *miscptr, FILE * fp) {
int32_t start_mysql(int32_t sock, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
char *response = NULL, *login = NULL, *pass = NULL;
unsigned long response_len;
char res = 0;
char database[256];
char *database = NULL;
login = hydra_get_next_login();
pass = hydra_get_next_password();
if (miscptr)
strncpy(database, miscptr, sizeof(database) - 1);
else {
strncpy(database, DEFAULT_DB, sizeof(database) - 1);
if (verbose)
hydra_report(stderr, "[VERBOSE] using default db 'mysql'\n");
}
database[sizeof(database) - 1] = 0;
database = miscptr;
/* read server greeting */
res = hydra_mysql_init(sock);
@@ -212,8 +205,8 @@ int start_mysql(int sock, char *ip, int port, unsigned char options, char *miscp
}
}
/*mysql_options(&mysql,MYSQL_OPT_COMPRESS,0); */
if (!mysql_real_connect(mysql, hydra_address2string(ip), login, pass, database, 0, NULL, 0)) {
int my_errno = mysql_errno(mysql);
if (!mysql_real_connect(mysql, hydra_address2string(ip), login, pass, database, port, NULL, 0)) {
int32_t my_errno = mysql_errno(mysql);
if (debug)
hydra_report(stderr, "[ERROR] Failed to connect to database: %s\n", mysql_error(mysql));
@@ -227,7 +220,8 @@ int start_mysql(int sock, char *ip, int port, unsigned char options, char *miscp
}
if (my_errno == 1251) {
hydra_report(stderr, "[ERROR] Client does not support authentication protocol requested by server\n");
hydra_report(stderr, "[ERROR] Client does not support authentication "
"protocol requested by server\n");
}
/*
@@ -241,8 +235,8 @@ int start_mysql(int sock, char *ip, int port, unsigned char options, char *miscp
*/
//if the error is more critical, we just try to reconnect
//to the db later with the mysql_init
// if the error is more critical, we just try to reconnect
// to the db later with the mysql_init
if ((my_errno != 1044) && (my_errno != 1045)) {
mysql_close(mysql);
mysql = NULL;
@@ -270,7 +264,7 @@ int start_mysql(int sock, char *ip, int port, unsigned char options, char *miscp
response = hydra_mysql_prepare_auth(login, pass);
if (response == NULL)
return 3;
response_len = *((unsigned long *) response) & 0xffffff;
response_len = *((unsigned long *)response) & 0xffffff;
/* send client auth packet */
/* dunny why, mysql IO code had problem reading my response. */
@@ -286,7 +280,7 @@ int start_mysql(int sock, char *ip, int port, unsigned char options, char *miscp
/* read authentication response */
if ((response = hydra_mysql_receive_line(sock)) == NULL)
return 1;
res = hydra_mysql_parse_response((unsigned char *) response);
res = hydra_mysql_parse_response((unsigned char *)response);
if (!res) {
hydra_mysql_send_com_quit(sock);
@@ -308,21 +302,21 @@ int start_mysql(int sock, char *ip, int port, unsigned char options, char *miscp
return 1;
}
void service_mysql(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int run = 1, next_run = 1, sock = -1;
int myport = PORT_MYSQL;
void service_mysql(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
int32_t run = 1, next_run = 1, sock = -1;
int32_t myport = PORT_MYSQL;
hydra_register_socket(sp);
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return;
while (1) {
switch (run) {
case 1: /* connect and service init function */
case 1: /* connect and service init function */
if (sock >= 0) {
hydra_mysql_send_com_quit(sock);
sock = hydra_disconnect(sock);
}
// sleepn(300);
// usleepn(300);
if ((options & OPTION_SSL) == 0) {
if (port != 0)
myport = port;
@@ -330,15 +324,16 @@ void service_mysql(char *ip, int sp, unsigned char options, char *miscptr, FILE
port = myport;
}
if (sock < 0) {
if (quiet != 1) fprintf(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int) getpid());
if (quiet != 1)
fprintf(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
hydra_child_exit(1);
}
next_run = 2;
break;
case 2: /* run the cracking function */
case 2: /* run the cracking function */
next_run = start_mysql(sock, ip, port, options, miscptr, fp);
break;
case 3: /* clean exit */
case 3: /* clean exit */
if (sock >= 0) {
hydra_mysql_send_com_quit(sock);
sock = hydra_disconnect(sock);
@@ -355,8 +350,6 @@ void service_mysql(char *ip, int sp, unsigned char options, char *miscptr, FILE
#ifndef LIBMYSQLCLIENT
#endif
/************************************************************************/
@@ -373,9 +366,9 @@ struct hydra_rand_struct {
double max_value_dbl;
};
void hydra_randominit(struct hydra_rand_struct *rand_st, unsigned long seed1, unsigned long seed2) { /* For mysql 3.21.# */
void hydra_randominit(struct hydra_rand_struct *rand_st, unsigned long seed1, unsigned long seed2) { /* For mysql 3.21.# */
rand_st->max_value = 0x3FFFFFFFL;
rand_st->max_value_dbl = (double) rand_st->max_value;
rand_st->max_value_dbl = (double)rand_st->max_value;
rand_st->seed1 = seed1 % rand_st->max_value;
rand_st->seed2 = seed2 % rand_st->max_value;
}
@@ -383,7 +376,7 @@ void hydra_randominit(struct hydra_rand_struct *rand_st, unsigned long seed1, un
double hydra_rnd(struct hydra_rand_struct *rand_st) {
rand_st->seed1 = (rand_st->seed1 * 3 + rand_st->seed2) % rand_st->max_value;
rand_st->seed2 = (rand_st->seed1 + rand_st->seed2 + 33) % rand_st->max_value;
return (((double) rand_st->seed1) / rand_st->max_value_dbl);
return (((double)rand_st->seed1) / rand_st->max_value_dbl);
}
void hydra_hash_password(unsigned long *result, const char *password) {
register unsigned long nr = 1345345333L, add = 7, nr2 = 0x12345671L;
@@ -391,14 +384,15 @@ void hydra_hash_password(unsigned long *result, const char *password) {
for (; *password; password++) {
if (*password == ' ' || *password == '\t')
continue; /* skipp space in password */
tmp = (unsigned long) (unsigned char) *password;
continue; /* skipp space in password */
tmp = (unsigned long)(unsigned char)*password;
nr ^= (((nr & 63) + add) * tmp) + (nr << 8);
nr2 += (nr2 << 8) ^ nr;
add += tmp;
}
result[0] = nr & (((unsigned long) 1L << 31) - 1L); /* Don't use sign bit (str2int) */ ;
result[1] = nr2 & (((unsigned long) 1L << 31) - 1L);
result[0] = nr & (((unsigned long)1L << 31) - 1L); /* Don't use sign bit (str2int) */
;
result[1] = nr2 & (((unsigned long)1L << 31) - 1L);
return;
}
@@ -414,8 +408,8 @@ char *hydra_scramble(char *to, const char *message, const char *password) {
hydra_hash_password(hash_message, message);
hydra_randominit(&rand_st, hash_pass[0] ^ hash_message[0], hash_pass[1] ^ hash_message[1]);
while (*message++)
*to++ = (char) (floor(hydra_rnd(&rand_st) * 31) + 64);
extra = (char) (floor(hydra_rnd(&rand_st) * 31));
*to++ = (char)(floor(hydra_rnd(&rand_st) * 31) + 64);
extra = (char)(floor(hydra_rnd(&rand_st) * 31));
while (to_start != to)
*(to_start++) ^= extra;
}
@@ -424,16 +418,21 @@ char *hydra_scramble(char *to, const char *message, const char *password) {
}
#endif
int service_mysql_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int32_t service_mysql_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
//
// fill if needed.
//
//
// return codes:
// 0 all OK
// -1 error, hydra will exit, so print a good error message here
return 0;
}
void usage_mysql(const char *service) {
printf("Module mysql is optionally taking the database to attack, default is "
"\"mysql\"\n\n");
}
+43 -42
View File
@@ -1,32 +1,28 @@
/*
* Novell Network Core Protocol Support - by David Maciejak @ GMAIL dot com
* Tested on Netware 6.5
*
*
* you need to install libncp and libncp-dev (tested with version 2.2.6-3)
*
*
* you can passed full context as OPT
*
* example: ./hydra -L login -P passw 172.16.246.129 ncp .O=cx
*
*/
#include "hydra-mod.h"
#ifndef LIBNCP
void dummy_ncp() {
printf("\n");
}
void dummy_ncp() { printf("\n"); }
#else
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ncp/nwcalls.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
extern char *HYDRA_EXIT;
extern int child_head_no;
extern int32_t child_head_no;
typedef struct __NCP_DATA {
struct ncp_conn_spec spec;
@@ -34,27 +30,24 @@ typedef struct __NCP_DATA {
char *context;
} _NCP_DATA;
//uncomment line below to see more trace stack
// uncomment line below to see more trace stack
//#define NCP_DEBUG
int start_ncp(int s, char *ip, int port, unsigned char options, char *miscptr, FILE * fp) {
int32_t start_ncp(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
char *login;
char *pass;
char context[256];
unsigned int ncp_lib_error_code;
uint32_t ncp_lib_error_code;
char *empty = "";
int object_type = NCP_BINDERY_USER;
int32_t object_type = NCP_BINDERY_USER;
_NCP_DATA *session;
session = malloc(sizeof(_NCP_DATA));
memset(session, 0, sizeof(_NCP_DATA));
login = empty;
pass = empty;
if (strlen(login = hydra_get_next_login()) == 0) {
login = empty;
} else {
@@ -64,14 +57,16 @@ int start_ncp(int s, char *ip, int port, unsigned char options, char *miscptr, F
return 4;
}
memset(context, 0, sizeof(context));
strncpy(context, login, strlen(login));
strncpy(context + strlen(login), miscptr, sizeof(miscptr) + 1);
strncpy(context, login, sizeof(context) - 2);
context[sizeof(context) - 2] = 0;
strncpy(context + strlen(login), miscptr, sizeof(context) - strlen(login) - 1);
context[sizeof(context) - 1] = 0;
login = context;
}
}
//login and password are case insensitive
//str_upper(login);
// login and password are case insensitive
// str_upper(login);
if (strlen(pass = hydra_get_next_password()) == 0)
pass = empty;
@@ -90,27 +85,27 @@ int start_ncp(int s, char *ip, int port, unsigned char options, char *miscptr, F
memset(session->spec.password, 0, sizeof(session->spec.password));
memcpy(session->spec.password, pass, strlen(pass) + 1);
//str_upper(session->spec.password);
// str_upper(session->spec.password);
ncp_lib_error_code = ncp_login_conn(session->conn, session->spec.user, object_type, session->spec.password);
switch (ncp_lib_error_code & 0x0000FFFF) {
case 0x0000: /* Success */
case 0x0000: /* Success */
#ifdef NCP_DEBUG
printf("Connection success (%s / %s). Error code: %X\n", login, pass, ncp_lib_error_code);
#endif
ncp_close(session->conn);
hydra_report_found_host(port, ip, "ncp", fp); //ok
hydra_report_found_host(port, ip, "ncp", fp); // ok
hydra_completed_pair_found();
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return 3; //exit
return 3; // exit
free(session);
return 2; //next
return 2; // next
break;
case 0x89DE: /* PASSWORD INVALID */
case 0x89F0: /* BIND WILDCARD INVALID */
case 0x89FF: /* NO OBJ OR BAD PASSWORD */
case 0xFD63: /* FAILED_AUTHENTICATION */
case 0xFDA7: /* NO_SUCH_ENTRY */
case 0x89DE: /* PASSWORD INVALID */
case 0x89F0: /* BIND WILDCARD INVALID */
case 0x89FF: /* NO OBJ OR BAD PASSWORD */
case 0xFD63: /* FAILED_AUTHENTICATION */
case 0xFDA7: /* NO_SUCH_ENTRY */
#ifdef NCP_DEBUG
printf("Incorrect password (%s / %s). Error code: %X\n", login, pass, ncp_lib_error_code);
#endif
@@ -118,7 +113,7 @@ int start_ncp(int s, char *ip, int port, unsigned char options, char *miscptr, F
hydra_completed_pair();
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0) {
free(session);
return 2; //next
return 2; // next
}
break;
default:
@@ -130,12 +125,12 @@ int start_ncp(int s, char *ip, int port, unsigned char options, char *miscptr, F
break;
}
free(session);
return 1; //reconnect
return 1; // reconnect
}
void service_ncp(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int run = 1, next_run = 1, sock = -1;
int myport = PORT_NCP;
void service_ncp(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
int32_t run = 1, next_run = 1, sock = -1;
int32_t myport = PORT_NCP;
hydra_register_socket(sp);
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
@@ -143,7 +138,7 @@ void service_ncp(char *ip, int sp, unsigned char options, char *miscptr, FILE *
while (1) {
switch (run) {
case 1: /* connect and service init function */
case 1: /* connect and service init function */
if (sock >= 0)
sock = hydra_disconnect(sock);
if (port != 0)
@@ -151,14 +146,15 @@ void service_ncp(char *ip, int sp, unsigned char options, char *miscptr, FILE *
sock = hydra_connect_tcp(ip, myport);
port = myport;
if (sock < 0) {
if (quiet != 1) fprintf(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int) getpid());
if (quiet != 1)
fprintf(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
hydra_child_exit(1);
}
next_run = 2;
break;
case 2:
/*
* Here we start the password cracking process
* Here we start the password cracking process
*/
next_run = start_ncp(sock, ip, port, options, miscptr, fp);
break;
@@ -182,16 +178,21 @@ void service_ncp(char *ip, int sp, unsigned char options, char *miscptr, FILE *
#endif
int service_ncp_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int32_t service_ncp_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
//
// fill if needed.
//
//
// return codes:
// 0 all OK
// -1 error, hydra will exit, so print a good error message here
return 0;
}
void usage_ncp(const char *service) {
printf("Module ncp is optionally taking the full context, for example "
"\".O=cx\"\n\n");
}
+145 -142
View File
@@ -10,14 +10,14 @@ RFC 4643: Network News Transfer Protocol (NNTP) Extension for Authentication
*/
int nntp_auth_mechanism = AUTH_CLEAR;
int32_t nntp_auth_mechanism = AUTH_CLEAR;
extern char *HYDRA_EXIT;
char *buf;
char *nntp_read_server_capacity(int sock) {
char *nntp_read_server_capacity(int32_t sock) {
char *ptr = NULL;
int resp = 0;
int32_t resp = 0;
char *buf = NULL;
do {
@@ -25,20 +25,20 @@ char *nntp_read_server_capacity(int sock) {
free(buf);
ptr = buf = hydra_receive_line(sock);
if (buf != NULL) {
if (isdigit((int) buf[0]) && buf[3] == ' ')
if (isdigit((int32_t)buf[0]) && buf[3] == ' ')
resp = 1;
else {
if (buf[strlen(buf) - 1] == '\n')
buf[strlen(buf) - 1] = 0;
if (buf[strlen(buf) - 1] == '\r')
buf[strlen(buf) - 1] = 0;
#ifdef NO_RINDEX
if ((ptr = strrchr(buf, '\n')) != NULL) {
#else
#ifdef NO_STRRCHR
if ((ptr = rindex(buf, '\n')) != NULL) {
#else
if ((ptr = strrchr(buf, '\n')) != NULL) {
#endif
ptr++;
if (isdigit((int) *ptr) && *(ptr + 3) == ' ')
if (isdigit((int32_t)*ptr) && *(ptr + 3) == ' ')
resp = 1;
}
}
@@ -47,10 +47,10 @@ char *nntp_read_server_capacity(int sock) {
return buf;
}
int start_nntp(int s, char *ip, int port, unsigned char options, char *miscptr, FILE * fp) {
char *empty = "\"\"";
int32_t start_nntp(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
char *empty = "\"\"", *result = NULL;
char *login, *pass, buffer[500], buffer2[500], *fooptr;
int i = 1;
int32_t i = 1;
if (strlen(login = hydra_get_next_login()) == 0)
login = empty;
@@ -79,7 +79,7 @@ int start_nntp(int s, char *ip, int port, unsigned char options, char *miscptr,
}
free(buf);
strcpy(buffer2, login);
hydra_tobase64((unsigned char *) buffer2, strlen(buffer2), sizeof(buffer2));
hydra_tobase64((unsigned char *)buffer2, strlen(buffer2), sizeof(buffer2));
sprintf(buffer, "%.250s\r\n", buffer2);
if (hydra_send(s, buffer, strlen(buffer), 0) < 0) {
@@ -94,7 +94,7 @@ int start_nntp(int s, char *ip, int port, unsigned char options, char *miscptr,
}
free(buf);
strcpy(buffer2, pass);
hydra_tobase64((unsigned char *) buffer2, strlen(buffer2), sizeof(buffer2));
hydra_tobase64((unsigned char *)buffer2, strlen(buffer2), sizeof(buffer2));
sprintf(buffer, "%.250s\r\n", buffer2);
break;
case AUTH_PLAIN:
@@ -112,7 +112,9 @@ int start_nntp(int s, char *ip, int port, unsigned char options, char *miscptr,
free(buf);
memset(buffer, 0, sizeof(buffer));
sasl_plain(buffer, login, pass);
result = sasl_plain(buffer, login, pass);
if (result == NULL)
return 3;
char tmp_buffer[sizeof(buffer)];
sprintf(tmp_buffer, "%.250s\r\n", buffer);
@@ -120,128 +122,125 @@ int start_nntp(int s, char *ip, int port, unsigned char options, char *miscptr,
break;
#ifdef LIBOPENSSL
case AUTH_CRAMMD5:{
int rc = 0;
char *preplogin;
case AUTH_CRAMMD5: {
int32_t rc = 0;
char *preplogin;
rc = sasl_saslprep(login, SASL_ALLOW_UNASSIGNED, &preplogin);
if (rc) {
return 3;
}
sprintf(buffer, "AUTHINFO SASL CRAM-MD5\r\n");
if (hydra_send(s, buffer, strlen(buffer), 0) < 0) {
return 1;
}
//get the one-time BASE64 encoded challenge
if ((buf = hydra_receive_line(s)) == NULL)
return 1;
if (buf == NULL || strstr(buf, "383") == NULL) {
hydra_report(stderr, "[ERROR] NNTP CRAM-MD5 AUTH : %s\n", buf);
free(buf);
return 3;
}
memset(buffer, 0, sizeof(buffer));
from64tobits((char *) buffer, buf + 4);
free(buf);
memset(buffer2, 0, sizeof(buffer2));
sasl_cram_md5(buffer2, pass, buffer);
sprintf(buffer, "%s %.250s", preplogin, buffer2);
hydra_tobase64((unsigned char *) buffer, strlen(buffer), sizeof(buffer));
char tmp_buffer[sizeof(buffer)];
sprintf(tmp_buffer, "%.250s\r\n", buffer);
strcpy(buffer, tmp_buffer);
free(preplogin);
rc = sasl_saslprep(login, SASL_ALLOW_UNASSIGNED, &preplogin);
if (rc) {
return 3;
}
break;
case AUTH_DIGESTMD5:{
sprintf(buffer, "AUTHINFO SASL DIGEST-MD5\r\n");
if (hydra_send(s, buffer, strlen(buffer), 0) < 0)
return 1;
//receive
if ((buf = hydra_receive_line(s)) == NULL)
return 1;
if (buf == NULL || strstr(buf, "383") == NULL || strlen(buf) < 8) {
hydra_report(stderr, "[ERROR] NNTP DIGEST-MD5 AUTH : %s\n", buf);
free(buf);
return 3;
}
memset(buffer, 0, sizeof(buffer));
from64tobits((char *) buffer, buf + 4);
free(buf);
if (debug)
hydra_report(stderr, "DEBUG S: %s\n", buffer);
fooptr = buffer2;
sasl_digest_md5(fooptr, login, pass, buffer, miscptr, "nntp", NULL, 0, NULL);
if (fooptr == NULL)
return 3;
if (debug)
hydra_report(stderr, "DEBUG C: %s\n", buffer2);
hydra_tobase64((unsigned char *) buffer2, strlen(buffer2), sizeof(buffer2));
sprintf(buffer, "%s\r\n", buffer2);
sprintf(buffer, "AUTHINFO SASL CRAM-MD5\r\n");
if (hydra_send(s, buffer, strlen(buffer), 0) < 0) {
return 1;
}
break;
// get the one-time BASE64 encoded challenge
if ((buf = hydra_receive_line(s)) == NULL)
return 1;
if (buf == NULL || strstr(buf, "383") == NULL) {
hydra_report(stderr, "[ERROR] NNTP CRAM-MD5 AUTH : %s\n", buf);
free(buf);
return 3;
}
memset(buffer, 0, sizeof(buffer));
from64tobits((char *)buffer, buf + 4);
free(buf);
memset(buffer2, 0, sizeof(buffer2));
result = sasl_cram_md5(buffer2, pass, buffer);
if (result == NULL)
return 3;
sprintf(buffer, "%s %.250s", preplogin, buffer2);
hydra_tobase64((unsigned char *)buffer, strlen(buffer), sizeof(buffer));
char tmp_buffer[sizeof(buffer)];
sprintf(tmp_buffer, "%.250s\r\n", buffer);
strcpy(buffer, tmp_buffer);
free(preplogin);
} break;
case AUTH_DIGESTMD5: {
sprintf(buffer, "AUTHINFO SASL DIGEST-MD5\r\n");
if (hydra_send(s, buffer, strlen(buffer), 0) < 0)
return 1;
// receive
if ((buf = hydra_receive_line(s)) == NULL)
return 1;
if (buf == NULL || strstr(buf, "383") == NULL || strlen(buf) < 8) {
hydra_report(stderr, "[ERROR] NNTP DIGEST-MD5 AUTH : %s\n", buf);
free(buf);
return 3;
}
memset(buffer, 0, sizeof(buffer));
from64tobits((char *)buffer, buf + 4);
free(buf);
if (debug)
hydra_report(stderr, "DEBUG S: %s\n", buffer);
fooptr = buffer2;
result = sasl_digest_md5(fooptr, login, pass, buffer, miscptr, "nntp", NULL, 0, NULL);
if (result == NULL)
return 3;
if (debug)
hydra_report(stderr, "DEBUG C: %s\n", buffer2);
hydra_tobase64((unsigned char *)buffer2, strlen(buffer2), sizeof(buffer2));
sprintf(buffer, "%s\r\n", buffer2);
} break;
#endif
case AUTH_NTLM:{
unsigned char buf1[4096];
unsigned char buf2[4096];
case AUTH_NTLM: {
unsigned char buf1[4096];
unsigned char buf2[4096];
//send auth and receive challenge
buildAuthRequest((tSmbNtlmAuthRequest *) buf2, 0, NULL, NULL);
to64frombits(buf1, buf2, SmbLength((tSmbNtlmAuthRequest *) buf2));
sprintf(buffer, "AUTHINFO SASL NTLM %s\r\n", (char *) buf1);
if (hydra_send(s, buffer, strlen(buffer), 0) < 0) {
return 1;
}
if ((buf = hydra_receive_line(s)) == NULL)
return 1;
if (buf == NULL || strstr(buf, "383") == NULL || strlen(buf) < 8) {
hydra_report(stderr, "[ERROR] NNTP NTLM AUTH : %s\n", buf);
free(buf);
return 3;
}
//recover challenge
from64tobits((char *) buf1, buf + 4);
free(buf);
buildAuthResponse((tSmbNtlmAuthChallenge *) buf1, (tSmbNtlmAuthResponse *) buf2, 0, login, pass, NULL, NULL);
to64frombits(buf1, buf2, SmbLength((tSmbNtlmAuthResponse *) buf2));
sprintf(buffer, "%s\r\n", (char *) buf1);
// send auth and receive challenge
buildAuthRequest((tSmbNtlmAuthRequest *)buf2, 0, NULL, NULL);
to64frombits(buf1, buf2, SmbLength((tSmbNtlmAuthRequest *)buf2));
sprintf(buffer, "AUTHINFO SASL NTLM %s\r\n", (char *)buf1);
if (hydra_send(s, buffer, strlen(buffer), 0) < 0) {
return 1;
}
break;
default:{
sprintf(buffer, "AUTHINFO USER %.250s\r\n", login);
if (hydra_send(s, buffer, strlen(buffer), 0) < 0) {
return 1;
}
buf = hydra_receive_line(s);
if (buf == NULL)
return 1;
if (buf[0] != '3') {
if (verbose || debug)
hydra_report(stderr, "[ERROR] Not an NNTP protocol or service shutdown: %s\n", buf);
free(buf);
return (3);
}
if ((buf = hydra_receive_line(s)) == NULL)
return 1;
if (buf == NULL || strstr(buf, "383") == NULL || strlen(buf) < 8) {
hydra_report(stderr, "[ERROR] NNTP NTLM AUTH : %s\n", buf);
free(buf);
sprintf(buffer, "AUTHINFO PASS %.250s\r\n", pass);
return 3;
}
break;
// recover challenge
from64tobits((char *)buf1, buf + 4);
free(buf);
buildAuthResponse((tSmbNtlmAuthChallenge *)buf1, (tSmbNtlmAuthResponse *)buf2, 0, login, pass, NULL, NULL);
to64frombits(buf1, buf2, SmbLength((tSmbNtlmAuthResponse *)buf2));
sprintf(buffer, "%s\r\n", (char *)buf1);
} break;
default: {
sprintf(buffer, "AUTHINFO USER %.250s\r\n", login);
if (hydra_send(s, buffer, strlen(buffer), 0) < 0) {
return 1;
}
buf = hydra_receive_line(s);
if (buf == NULL)
return 1;
if (buf[0] != '3') {
if (verbose || debug)
hydra_report(stderr, "[ERROR] Not an NNTP protocol or service shutdown: %s\n", buf);
free(buf);
return (3);
}
free(buf);
sprintf(buffer, "AUTHINFO PASS %.250s\r\n", pass);
} break;
}
if (hydra_send(s, buffer, strlen(buffer), 0) < 0) {
return 1;
}
@@ -266,9 +265,9 @@ int start_nntp(int s, char *ip, int port, unsigned char options, char *miscptr,
return 2;
}
void service_nntp(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int i = 0, run = 1, next_run = 1, sock = -1;
int myport = PORT_NNTP, mysslport = PORT_NNTP_SSL, disable_tls = 0;
void service_nntp(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
int32_t i = 0, run = 1, next_run = 1, sock = -1;
int32_t myport = PORT_NNTP, mysslport = PORT_NNTP_SSL, disable_tls = 0;
char *buffer1 = "CAPABILITIES\r\n";
hydra_register_socket(sp);
@@ -276,10 +275,10 @@ void service_nntp(char *ip, int sp, unsigned char options, char *miscptr, FILE *
return;
while (1) {
switch (run) {
case 1: /* connect and service init function */
case 1: /* connect and service init function */
if (sock >= 0)
sock = hydra_disconnect(sock);
// sleepn(300);
// usleepn(300);
if ((options & OPTION_SSL) == 0) {
if (port != 0)
myport = port;
@@ -293,12 +292,12 @@ void service_nntp(char *ip, int sp, unsigned char options, char *miscptr, FILE *
}
if (sock < 0) {
if (verbose || debug)
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int) getpid());
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
hydra_child_exit(1);
}
// sleepn(300);
// usleepn(300);
buf = hydra_receive_line(sock);
if (buf == NULL || buf[0] != '2') { /* check the first line */
if (buf == NULL || buf[0] != '2') { /* check the first line */
if (verbose || debug)
hydra_report(stderr, "[ERROR] Not an NNTP protocol or service shutdown: %s\n", buf);
hydra_child_exit(2);
@@ -352,10 +351,10 @@ void service_nntp(char *ip, int sp, unsigned char options, char *miscptr, FILE *
}
#endif
/*
AUTHINFO USER SASL
SASL PLAIN DIGEST-MD5 LOGIN NTLM CRAM-MD5
*/
/*
AUTHINFO USER SASL
SASL PLAIN DIGEST-MD5 LOGIN NTLM CRAM-MD5
*/
#ifdef HAVE_PCRE
if (hydra_string_match(buf, "SASL\\s.*NTLM")) {
@@ -405,7 +404,7 @@ SASL PLAIN DIGEST-MD5 LOGIN NTLM CRAM-MD5
if ((miscptr != NULL) && (strlen(miscptr) > 0)) {
for (i = 0; i < strlen(miscptr); i++)
miscptr[i] = (char) toupper((int) miscptr[i]);
miscptr[i] = (char)toupper((int32_t)miscptr[i]);
if (strncmp(miscptr, "USER", 4) == 0)
nntp_auth_mechanism = AUTH_CLEAR;
@@ -426,7 +425,6 @@ SASL PLAIN DIGEST-MD5 LOGIN NTLM CRAM-MD5
if (strncmp(miscptr, "NTLM", 4) == 0)
nntp_auth_mechanism = AUTH_NTLM;
}
if (verbose) {
switch (nntp_auth_mechanism) {
@@ -452,14 +450,14 @@ SASL PLAIN DIGEST-MD5 LOGIN NTLM CRAM-MD5
break;
}
}
sleepn(25);
usleepn(25);
free(buf);
next_run = 2;
break;
case 2: /* run the cracking function */
case 2: /* run the cracking function */
next_run = start_nntp(sock, ip, port, options, miscptr, fp);
break;
case 3: /* clean exit */
case 3: /* clean exit */
if (sock >= 0)
sock = hydra_disconnect(sock);
hydra_child_exit(0);
@@ -472,16 +470,21 @@ SASL PLAIN DIGEST-MD5 LOGIN NTLM CRAM-MD5
}
}
int service_nntp_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int32_t service_nntp_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
//
// fill if needed.
//
//
// return codes:
// 0 all OK
// -1 error, hydra will exit, so print a good error message here
return 0;
}
void usage_nntp(const char *service) {
printf("Module nntp is optionally taking one authentication type of:\n"
" USER (default), LOGIN, PLAIN, CRAM-MD5, DIGEST-MD5, NTLM\n\n");
}
+50 -47
View File
@@ -1,4 +1,3 @@
/*
david:
@@ -14,25 +13,23 @@ at http://marcellmajor.com/frame_listenerhash.html
#include "hydra-mod.h"
#ifndef LIBOPENSSL
#include <stdio.h>
void dummy_oracle_listener() {
printf("\n");
}
void dummy_oracle_listener() { printf("\n"); }
#else
#include <sasl.h>
#include "sasl.h"
#include <openssl/des.h>
#define HASHSIZE 17
extern char *HYDRA_EXIT;
char *buf;
unsigned char *hash;
int sid_mechanism = AUTH_PLAIN;
int32_t sid_mechanism = AUTH_PLAIN;
int initial_permutation(unsigned char **result, char *p_str, int *sz) {
int k = 0;
int i = strlen(p_str);
int32_t initial_permutation(unsigned char **result, char *p_str, int32_t *sz) {
int32_t k = 0;
int32_t i = strlen(p_str);
char *buff;
//expand the string with zero so that length is a multiple of 4
// expand the string with zero so that length is a multiple of 4
while ((i % 4) != 0) {
i = i + 1;
}
@@ -45,14 +42,14 @@ int initial_permutation(unsigned char **result, char *p_str, int *sz) {
memset(buff, 0, i + 4);
strcpy(buff, p_str);
//swap the order of every byte pair
// swap the order of every byte pair
for (k = 0; k < i; k += 2) {
char bck = buff[k + 1];
buff[k + 1] = buff[k];
buff[k] = bck;
}
//convert to unicode
// convert to unicode
if ((*result = malloc(2 * i)) == NULL) {
hydra_report(stderr, "[ERROR] Can't allocate memory\n");
free(buff);
@@ -67,8 +64,8 @@ int initial_permutation(unsigned char **result, char *p_str, int *sz) {
return 0;
}
int ora_hash(unsigned char **orahash, unsigned char *buf, int len) {
int i;
int32_t ora_hash(unsigned char **orahash, unsigned char *buf, int32_t len) {
int32_t i;
if ((*orahash = malloc(HASHSIZE)) == NULL) {
hydra_report(stderr, "[ERROR] Can't allocate memory\n");
@@ -76,13 +73,13 @@ int ora_hash(unsigned char **orahash, unsigned char *buf, int len) {
}
for (i = 0; i < 8; i++) {
sprintf(((char *) *orahash) + i * 2, "%02X", buf[len - 8 + i]);
sprintf(((char *)*orahash) + i * 2, "%02X", buf[len - 8 + i]);
}
return 0;
}
int convert_byteorder(unsigned char **result, int size) {
int i = 0;
int32_t convert_byteorder(unsigned char **result, int32_t size) {
int32_t i = 0;
char *buff;
if ((buff = malloc(size)) == NULL) {
@@ -103,12 +100,12 @@ int convert_byteorder(unsigned char **result, int size) {
return 0;
}
int ora_descrypt(unsigned char **rs, unsigned char *result, int siz) {
int i = 0;
int32_t ora_descrypt(unsigned char **rs, unsigned char *result, int32_t siz) {
int32_t i = 0;
char lastkey[8];
DES_key_schedule ks1;
unsigned char key1[8] = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF };
unsigned char ivec1[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
unsigned char key1[8] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF};
unsigned char ivec1[] = {0, 0, 0, 0, 0, 0, 0, 0};
unsigned char *desresult;
memset(ivec1, 0, sizeof(ivec1));
@@ -116,14 +113,14 @@ int ora_descrypt(unsigned char **rs, unsigned char *result, int siz) {
hydra_report(stderr, "[ERROR] Can't allocate memory\n");
return 1;
}
DES_key_sched((const_DES_cblock *) key1, &ks1);
DES_key_sched((const_DES_cblock *)key1, &ks1);
DES_ncbc_encrypt(result, desresult, siz, &ks1, &ivec1, DES_ENCRYPT);
for (i = 0; i < 8; i++) {
lastkey[i] = desresult[siz - 8 + i];
}
DES_key_sched((const_DES_cblock *) lastkey, &ks1);
DES_key_sched((const_DES_cblock *)lastkey, &ks1);
memset(desresult, 0, siz);
memset(ivec1, 0, sizeof(ivec1));
DES_ncbc_encrypt(result, desresult, siz, &ks1, &ivec1, DES_ENCRYPT);
@@ -138,16 +135,16 @@ int ora_descrypt(unsigned char **rs, unsigned char *result, int siz) {
return 0;
}
int ora_hash_password(char *pass) {
int32_t ora_hash_password(char *pass) {
// secret hash function comes here, and written to char *hash
int siz = 0;
int32_t siz = 0;
unsigned char *desresult;
unsigned char *result;
char buff[strlen(pass) + 5];
memset(buff, 0, sizeof(buff));
//concatenate Arb string and convert the resulting string to uppercase
// concatenate Arb string and convert the resulting string to uppercase
snprintf(buff, sizeof(buff), "Arb%s", pass);
strupper(buff);
@@ -180,19 +177,17 @@ int ora_hash_password(char *pass) {
return 0;
}
int start_oracle_listener(int s, char *ip, int port, unsigned char options, char *miscptr, FILE * fp) {
unsigned char tns_packet_begin[22] = {
"\x00\x00\x01\x00\x00\x00\x01\x36\x01\x2c\x00\x00\x08\x00\x7f\xff\x86\x0e\x00\x00\x01\x00"
};
unsigned char tns_packet_end[32] = {
"\x00\x3a\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x09\x94\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00"
};
int32_t start_oracle_listener(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
unsigned char tns_packet_begin[22] = {"\x00\x00\x01\x00\x00\x00\x01\x36\x01\x2c\x00\x00\x08\x00\x7f\xff\x86\x0e"
"\x00\x00\x01\x00"};
unsigned char tns_packet_end[32] = {"\x00\x3a\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x09\x94\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00"};
char *empty = "";
char *pass;
char connect_string[200];
char buffer2[260];
int siz = 0;
int32_t siz = 0;
memset(connect_string, 0, sizeof(connect_string));
memset(buffer2, 0, sizeof(buffer2));
@@ -211,9 +206,12 @@ int start_oracle_listener(int s, char *ip, int port, unsigned char options, char
free(hash);
return 1;
}
pass = (char *) hash;
pass = (char *)hash;
}
snprintf(connect_string, sizeof(connect_string), "(DESCRIPTION=(CONNECT_DATA=(CID=(PROGRAM=))(COMMAND=reload)(PASSWORD=%s)(SERVICE=)(VERSION=169869568)))", pass);
snprintf(connect_string, sizeof(connect_string),
"(DESCRIPTION=(CONNECT_DATA=(CID=(PROGRAM=))(COMMAND=reload)("
"PASSWORD=%s)(SERVICE=)(VERSION=169869568)))",
pass);
if (hash != NULL)
free(hash);
@@ -227,7 +225,7 @@ int start_oracle_listener(int s, char *ip, int port, unsigned char options, char
} else {
buffer2[1] = siz;
}
memcpy(buffer2 + 2, (char *) tns_packet_begin, sizeof(tns_packet_begin));
memcpy(buffer2 + 2, (char *)tns_packet_begin, sizeof(tns_packet_begin));
siz = strlen(connect_string);
if (siz > 255) {
buffer2[2 + sizeof(tns_packet_begin)] = 1;
@@ -235,7 +233,7 @@ int start_oracle_listener(int s, char *ip, int port, unsigned char options, char
} else {
buffer2[1 + 2 + sizeof(tns_packet_begin)] = siz;
}
memcpy(buffer2 + 2 + sizeof(tns_packet_begin) + 2, (char *) tns_packet_end, sizeof(tns_packet_end));
memcpy(buffer2 + 2 + sizeof(tns_packet_begin) + 2, (char *)tns_packet_end, sizeof(tns_packet_end));
memcpy(buffer2 + 2 + sizeof(tns_packet_begin) + 2 + sizeof(tns_packet_end), connect_string, strlen(connect_string));
if (hydra_send(s, buffer2, 2 + sizeof(tns_packet_begin) + 2 + sizeof(tns_packet_end) + strlen(connect_string), 0) < 0) {
return 1;
@@ -258,9 +256,9 @@ int start_oracle_listener(int s, char *ip, int port, unsigned char options, char
return 1;
}
void service_oracle_listener(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int run = 1, next_run = 1, sock = -1;
int myport = PORT_ORACLE, mysslport = PORT_ORACLE_SSL;
void service_oracle_listener(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
int32_t run = 1, next_run = 1, sock = -1;
int32_t myport = PORT_ORACLE, mysslport = PORT_ORACLE_SSL;
hydra_register_socket(sp);
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
@@ -284,10 +282,10 @@ void service_oracle_listener(char *ip, int sp, unsigned char options, char *misc
while (1) {
switch (run) {
case 1: /* connect and service init function */
case 1: /* connect and service init function */
if (sock >= 0)
sock = hydra_disconnect(sock);
// sleepn(300);
// usleepn(300);
if ((options & OPTION_SSL) == 0) {
if (port != 0)
myport = port;
@@ -301,13 +299,13 @@ void service_oracle_listener(char *ip, int sp, unsigned char options, char *misc
}
if (sock < 0) {
if (verbose || debug)
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int) getpid());
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
hydra_child_exit(1);
}
/* run the cracking function */
next_run = start_oracle_listener(sock, ip, port, options, miscptr, fp);
break;
case 3: /* clean exit */
case 3: /* clean exit */
if (sock >= 0)
sock = hydra_disconnect(sock);
hydra_child_exit(0);
@@ -325,13 +323,13 @@ void service_oracle_listener(char *ip, int sp, unsigned char options, char *misc
}
}
int service_oracle_listener_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int32_t service_oracle_listener_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
//
// fill if needed.
//
//
// return codes:
// 0 all OK
// -1 error, hydra will exit, so print a good error message here
@@ -339,4 +337,9 @@ int service_oracle_listener_init(char *ip, int sp, unsigned char options, char *
return 0;
}
void usage_oracle_listener(const char *service) {
printf("Module oracle-listener / tns is optionally taking the mode the "
"password is stored as, could be PLAIN (default) or CLEAR\n\n");
}
#endif
+24 -26
View File
@@ -11,9 +11,7 @@ find a big list on the Internet
#include "hydra-mod.h"
#ifndef LIBOPENSSL
#include <stdio.h>
void dummy_oracle_sid() {
printf("\n");
}
void dummy_oracle_sid() { printf("\n"); }
#else
#include <openssl/des.h>
#define HASHSIZE 16
@@ -22,24 +20,21 @@ extern char *HYDRA_EXIT;
char *buf;
unsigned char *hash;
int start_oracle_sid(int s, char *ip, int port, unsigned char options, char *miscptr, FILE * fp) {
int32_t start_oracle_sid(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
/*
PP is the packet length
XX is the length of connect data
PP + tns_packet_begin + XX + tns_packet_end
*/
unsigned char tns_packet_begin[22] = {
"\x00\x00\x01\x00\x00\x00\x01\x36\x01\x2c\x00\x00\x08\x00\x7f\xff\x86\x0e\x00\x00\x01\x00"
};
unsigned char tns_packet_end[32] = {
"\x00\x3a\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x09\x94\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00"
};
unsigned char tns_packet_begin[22] = {"\x00\x00\x01\x00\x00\x00\x01\x36\x01\x2c\x00\x00\x08\x00\x7f\xff\x86\x0e"
"\x00\x00\x01\x00"};
unsigned char tns_packet_end[32] = {"\x00\x3a\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x09\x94\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00"};
char *empty = "";
char *login;
char connect_string[200];
char buffer2[260];
int siz = 0;
int32_t siz = 0;
memset(connect_string, 0, sizeof(connect_string));
memset(buffer2, 0, sizeof(buffer2));
@@ -47,8 +42,10 @@ int start_oracle_sid(int s, char *ip, int port, unsigned char options, char *mis
if (strlen(login = hydra_get_next_login()) == 0)
login = empty;
snprintf(connect_string, sizeof(connect_string), "(DESCRIPTION=(CONNECT_DATA=(SID=%s)(CID=(PROGRAM=)(HOST=__jdbc__)(USER=)))(ADDRESS=(PROTOCOL=tcp)(HOST=%s)(PORT=%d)))", login,
hydra_address2string(ip), port);
snprintf(connect_string, sizeof(connect_string),
"(DESCRIPTION=(CONNECT_DATA=(SID=%s)(CID=(PROGRAM=)(HOST=__jdbc__)("
"USER=)))(ADDRESS=(PROTOCOL=tcp)(HOST=%s)(PORT=%d)))",
login, hydra_address2string(ip), port);
siz = 2 + sizeof(tns_packet_begin) + 2 + sizeof(tns_packet_end) + strlen(connect_string);
if (siz > 255) {
buffer2[0] = 1;
@@ -56,7 +53,7 @@ int start_oracle_sid(int s, char *ip, int port, unsigned char options, char *mis
} else {
buffer2[1] = siz;
}
memcpy(buffer2 + 2, (char *) tns_packet_begin, sizeof(tns_packet_begin));
memcpy(buffer2 + 2, (char *)tns_packet_begin, sizeof(tns_packet_begin));
siz = strlen(connect_string);
if (siz > 255) {
buffer2[2 + sizeof(tns_packet_begin)] = 1;
@@ -64,7 +61,7 @@ int start_oracle_sid(int s, char *ip, int port, unsigned char options, char *mis
} else {
buffer2[1 + 2 + sizeof(tns_packet_begin)] = siz;
}
memcpy(buffer2 + 2 + sizeof(tns_packet_begin) + 2, (char *) tns_packet_end, sizeof(tns_packet_end));
memcpy(buffer2 + 2 + sizeof(tns_packet_begin) + 2, (char *)tns_packet_end, sizeof(tns_packet_end));
memcpy(buffer2 + 2 + sizeof(tns_packet_begin) + 2 + sizeof(tns_packet_end), connect_string, strlen(connect_string));
if (hydra_send(s, buffer2, 2 + sizeof(tns_packet_begin) + 2 + sizeof(tns_packet_end) + strlen(connect_string), 0) < 0) {
return 1;
@@ -72,7 +69,8 @@ int start_oracle_sid(int s, char *ip, int port, unsigned char options, char *mis
if ((buf = hydra_receive_line(s)) == NULL)
return 1;
//if no error reported. it should be a resend packet type 00 08 00 00 0b 00 00 00, 4 is refuse
// if no error reported. it should be a resend packet type 00 08 00 00 0b 00
// 00 00, 4 is refuse
if ((strstr(buf, "ERR=") == NULL) && (buf[4] != 4)) {
hydra_report_found_host(port, ip, "oracle-sid", fp);
hydra_completed_pair_found();
@@ -85,19 +83,19 @@ int start_oracle_sid(int s, char *ip, int port, unsigned char options, char *mis
return 1;
}
void service_oracle_sid(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int run = 1, next_run = 1, sock = -1;
int myport = PORT_ORACLE, mysslport = PORT_ORACLE_SSL;
void service_oracle_sid(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
int32_t run = 1, next_run = 1, sock = -1;
int32_t myport = PORT_ORACLE, mysslport = PORT_ORACLE_SSL;
hydra_register_socket(sp);
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return;
while (1) {
switch (run) {
case 1: /* connect and service init function */
case 1: /* connect and service init function */
if (sock >= 0)
sock = hydra_disconnect(sock);
// sleepn(300);
// usleepn(300);
if ((options & OPTION_SSL) == 0) {
if (port != 0)
myport = port;
@@ -110,13 +108,13 @@ void service_oracle_sid(char *ip, int sp, unsigned char options, char *miscptr,
port = mysslport;
}
if (sock < 0) {
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int) getpid());
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
hydra_child_exit(1);
}
/* run the cracking function */
next_run = start_oracle_sid(sock, ip, port, options, miscptr, fp);
break;
case 3: /* clean exit */
case 3: /* clean exit */
if (sock >= 0)
sock = hydra_disconnect(sock);
hydra_child_exit(0);
@@ -134,13 +132,13 @@ void service_oracle_sid(char *ip, int sp, unsigned char options, char *miscptr,
}
}
int service_oracle_sid_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int32_t service_oracle_sid_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
//
// fill if needed.
//
//
// return codes:
// 0 all OK
// -1 error, hydra will exit, so print a good error message here
+67 -51
View File
@@ -1,12 +1,11 @@
/*
david: code is based on SNORT spo_database.c
tested with :
-instantclient_10_2 on Oracle 10.2.0
-instantclient-basic-linux.*-11.2.0.3.0.zip + instantclient-sdk-linux.*-11.2.0.3.0.zip
on Oracle 9i and on Oracle 11g
-instantclient-basic-linux.*-11.2.0.3.0.zip +
instantclient-sdk-linux.*-11.2.0.3.0.zip on Oracle 9i and on Oracle 11g
*/
@@ -14,13 +13,12 @@ on Oracle 9i and on Oracle 11g
#ifndef LIBORACLE
void dummy_oracle() {
printf("\n");
}
void dummy_oracle() { printf("\n"); }
#else
#include <oci.h>
#include <stdbool.h>
#include <sys/types.h>
extern char *HYDRA_EXIT;
@@ -41,7 +39,7 @@ void print_oracle_error(char *err) {
}
}
int start_oracle(int s, char *ip, int port, unsigned char options, char *miscptr, FILE * fp) {
int32_t start_oracle(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
char *empty = "";
char *login, *pass, buffer[200], sid[100];
@@ -56,14 +54,17 @@ int start_oracle(int s, char *ip, int port, unsigned char options, char *miscptr
/*
To use the Easy Connect naming method, PHP must be linked with Oracle 10g or greater Client libraries.
The Easy Connect string for Oracle 10g is of the form: [//]host_name[:port][/service_name].
With Oracle 11g, the syntax is: [//]host_name[:port][/service_name][:server_type][/instance_name].
Service names can be found by running the Oracle utility lsnrctl status on the database server machine.
To use the Easy Connect naming method, PHP must be linked with Oracle 10g
or greater Client libraries. The Easy Connect string for Oracle 10g is of
the form: [//]host_name[:port][/service_name]. With Oracle 11g, the syntax
is: [//]host_name[:port][/service_name][:server_type][/instance_name].
Service names can be found by running the Oracle utility lsnrctl status on
the database server machine.
The tnsnames.ora file can be in the Oracle Net search path, which includes $ORACLE_HOME/network/admin
and /etc. Alternatively set TNS_ADMIN so that $TNS_ADMIN/tnsnames.ora is read. Make sure the web
daemon has read access to the file.
The tnsnames.ora file can be in the Oracle Net search path, which includes
$ORACLE_HOME/network/admin and /etc. Alternatively set TNS_ADMIN so that
$TNS_ADMIN/tnsnames.ora is read. Make sure the web daemon has read access
to the file.
*/
@@ -79,70 +80,75 @@ int start_oracle(int s, char *ip, int port, unsigned char options, char *miscptr
print_oracle_error("OCIEnvInit 2");
return 4;
}
if (OCIHandleAlloc(o_environment, (dvoid **) & o_error, OCI_HTYPE_ERROR, (size_t) 0, NULL)) {
if (OCIHandleAlloc(o_environment, (dvoid **)&o_error, OCI_HTYPE_ERROR, (size_t)0, NULL)) {
print_oracle_error("OCIHandleAlloc");
return 4;
}
if (OCILogon(o_environment, o_error, &o_servicecontext, (const OraText *) login, strlen(login), (const OraText *) pass, strlen(pass), (const OraText *) buffer, strlen(buffer))) {
bool success = true;
if (OCILogon(o_environment, o_error, &o_servicecontext, (const OraText *)login, strlen(login), (const OraText *)pass, strlen(pass), (const OraText *)buffer, strlen(buffer))) {
success = false;
OCIErrorGet(o_error, 1, NULL, &o_errorcode, o_errormsg, sizeof(o_errormsg), OCI_HTYPE_ERROR);
//database: oracle_error: ORA-01017: invalid username/password; logon denied
//database: oracle_error: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
//database: oracle_error: ORA-28000: the account is locked
//Failed login attempts is set to 10 by default
// database: oracle_error: ORA-01017: invalid username/password; logon
// denied database: oracle_error: ORA-12514: TNS:listener does not currently
// know of service requested in connect descriptor database: oracle_error:
// ORA-28000: the account is locked Failed login attempts is set to 10 by
// default
if (verbose) {
hydra_report(stderr, "[VERBOSE] database: oracle_error: %s\n", o_errormsg);
}
if (strstr((const char *) o_errormsg, "ORA-12514") != NULL) {
hydra_report(stderr, "[ERROR] ORACLE SID is not valid, you should try to enumerate them.\n");
if (strstr((const char *)o_errormsg, "ORA-12514") != NULL) {
hydra_report(stderr, "[ERROR] ORACLE SID is not valid, you should try to "
"enumerate them.\n");
hydra_completed_pair();
return 3;
}
if (strstr((const char *) o_errormsg, "ORA-28000") != NULL) {
hydra_report(stderr, "[ERROR] ORACLE account %s is locked.\n", login);
if (strstr((const char *)o_errormsg, "ORA-28000") != NULL) {
hydra_report(stderr, "[INFO] ORACLE account %s is locked.\n", login);
hydra_completed_pair_skip();
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return 3;
return 2;
}
if (o_error) {
OCIHandleFree((dvoid *) o_error, OCI_HTYPE_ERROR);
// ORA-28002: the password will expire within 7 days
if (strstr((const char *)o_errormsg, "ORA-28002") != NULL) {
hydra_report(stderr, "[INFO] ORACLE account %s password will expire soon.\n", login);
success = true;
}
}
hydra_completed_pair();
//by default, set in sqlnet.ora, the trace file is generated in pwd to log any errors happening,
//as we don't care, we are deleting the file
//set these parameters to not generate the file
//LOG_DIRECTORY_CLIENT = /dev/null
//LOG_FILE_CLIENT = /dev/null
unlink("sqlnet.log");
return 2;
} else {
if (success) {
OCILogoff(o_servicecontext, o_error);
if (o_error) {
OCIHandleFree((dvoid *) o_error, OCI_HTYPE_ERROR);
}
hydra_report_found_host(port, ip, "oracle", fp);
hydra_completed_pair_found();
} else {
hydra_completed_pair();
}
if (o_error) {
OCIHandleFree((dvoid *)o_error, OCI_HTYPE_ERROR);
}
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return 3;
return 1;
return success ? 1 : 2;
}
void service_oracle(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int run = 1, next_run = 1, sock = -1;
int myport = PORT_ORACLE;
void service_oracle(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
int32_t run = 1, next_run = 1, sock = -1;
int32_t myport = PORT_ORACLE;
hydra_register_socket(sp);
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return;
if ((miscptr == NULL) || (strlen(miscptr) == 0)) {
//SID is required as miscptr
// SID is required as miscptr
hydra_report(stderr, "[ERROR] Oracle SID is required, using ORCL as default\n");
miscptr = "ORCL";
}
while (1) {
switch (run) {
case 1: /* connect and service init function */
case 1: /* connect and service init function */
if (sock >= 0)
sock = hydra_disconnect(sock);
if (port != 0)
@@ -152,18 +158,23 @@ void service_oracle(char *ip, int sp, unsigned char options, char *miscptr, FILE
if (sock < 0) {
if (verbose || debug)
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int) getpid());
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
hydra_child_exit(1);
}
next_run = 2;
break;
case 2:
next_run = start_oracle(sock, ip, port, options, miscptr, fp);
hydra_child_exit(0);
break;
case 3: /* clean exit */
case 3: /* clean exit */
if (sock >= 0)
sock = hydra_disconnect(sock);
// by default, set in sqlnet.ora, the trace file is generated in pwd to log
// any errors happening, as we don't care, we are deleting the file set
// these parameters to not generate the file LOG_DIRECTORY_CLIENT =
// /dev/null LOG_FILE_CLIENT = /dev/null
unlink("sqlnet.log");
hydra_child_exit(0);
return;
default:
@@ -176,16 +187,21 @@ void service_oracle(char *ip, int sp, unsigned char options, char *miscptr, FILE
#endif
int service_oracle_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int32_t service_oracle_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
//
// fill if needed.
//
//
// return codes:
// 0 all OK
// -1 error, hydra will exit, so print a good error message here
return 0;
}
void usage_oracle(const char *service) {
printf("Module oracle / ora is optionally taking the ORACLE SID, default is "
"\"ORCL\"\n\n");
}
+28 -28
View File
@@ -1,6 +1,6 @@
//This plugin was written by <david dot maciejak at kyxar dot fr>
// This plugin was written by <david dot maciejak at kyxar dot fr>
//
//PC-Anywhere authentication protocol test on Symantec PC-Anywhere 10.5
// PC-Anywhere authentication protocol test on Symantec PC-Anywhere 10.5
//
// no memleaks found on 110425
@@ -8,9 +8,9 @@
extern char *HYDRA_EXIT;
int pcadebug = 0;
int32_t pcadebug = 0;
int send_cstring(int s, char *crypted_string) {
int32_t send_cstring(int32_t s, char *crypted_string) {
char buffer2[100], *bptr = buffer2;
char clientcryptheader[] = "\x06";
@@ -25,8 +25,8 @@ int send_cstring(int s, char *crypted_string) {
return hydra_send(s, buffer2, 2 + strlen(crypted_string), 0);
}
void show_buffer(char *buffer, int size) {
int i;
void show_buffer(char *buffer, int32_t size) {
int32_t i;
printf("size: %d, buffer:\n", size);
for (i = 0; i < size; i++) {
@@ -35,11 +35,11 @@ void show_buffer(char *buffer, int size) {
printf("\n");
}
void clean_buffer(char *buf, int size) {
int i;
void clean_buffer(char *buf, int32_t size) {
int32_t i;
for (i = 0; i < size; i++) {
int pos = buf[i];
int32_t pos = buf[i];
if (pos < 32 || pos > 126) {
// . char
@@ -49,7 +49,7 @@ void clean_buffer(char *buf, int size) {
}
void print_encrypted_str(char *str) {
int i;
int32_t i;
printf("encode string: ");
for (i = 0; i < strlen(str); i++) {
@@ -60,7 +60,7 @@ void print_encrypted_str(char *str) {
void pca_encrypt(char *cleartxt) {
char passwd[128];
int i;
int32_t i;
strncpy(passwd, cleartxt, sizeof(passwd) - 1);
passwd[sizeof(passwd) - 1] = 0;
@@ -71,12 +71,11 @@ void pca_encrypt(char *cleartxt) {
passwd[strlen(passwd)] = '\0';
strcpy(cleartxt, passwd);
}
}
void pca_decrypt(char *password) {
char cleartext[128];
int i;
int32_t i;
if (strlen(password) > 0) {
cleartext[0] = password[0] ^ 0xab;
@@ -92,17 +91,17 @@ void debugprintf(char *msg) {
printf("debug: %s\n", msg);
}
int start_pcanywhere(int s, char *ip, int port, unsigned char options, char *miscptr, FILE * fp) {
int32_t start_pcanywhere(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
char *empty = "";
char *login, *pass;
char buffer[2048] = "";
char clogin[128] = "";
char cpass[128] = "";
int ret, i;
int32_t ret, i;
char *client[4];
char *server[5];
int clientsize[4];
int32_t clientsize[4];
client[0] = "\x00\x00\x00\x00";
clientsize[0] = 4;
@@ -119,7 +118,6 @@ int start_pcanywhere(int s, char *ip, int port, unsigned char options, char *mis
server[3] = "Enter login name";
server[4] = "denying connection";
if (strlen(login = hydra_get_next_login()) == 0)
login = empty;
if (strlen(pass = hydra_get_next_password()) == 0)
@@ -158,13 +156,15 @@ int start_pcanywhere(int s, char *ip, int port, unsigned char options, char *mis
if (i == 0 || i == 3)
clean_buffer(buffer, ret);
if (debug) show_buffer(buffer, ret);
if (debug)
show_buffer(buffer, ret);
if (i == 2) {
clean_buffer(buffer, ret);
buffer[sizeof(buffer) - 1] = 0;
if (strstr(buffer, server[i + 2]) != NULL) {
fprintf(stderr, "[ERROR] PC Anywhere host denying connection because you have requested a lower encrypt level\n");
fprintf(stderr, "[ERROR] PC Anywhere host denying connection because "
"you have requested a lower encrypt level\n");
return 3;
}
}
@@ -224,21 +224,20 @@ int start_pcanywhere(int s, char *ip, int port, unsigned char options, char *mis
return 1;
}
void service_pcanywhere(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int run = 1, next_run = 1, sock = -1;
int myport = PORT_PCANYWHERE, mysslport = PORT_PCANYWHERE_SSL;
void service_pcanywhere(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
int32_t run = 1, next_run = 1, sock = -1;
int32_t myport = PORT_PCANYWHERE, mysslport = PORT_PCANYWHERE_SSL;
hydra_register_socket(sp);
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return;
while (1) {
switch (run) {
case 1: /* connect and service init function */
case 1: /* connect and service init function */
if (sock >= 0)
sock = hydra_disconnect(sock);
sleepn(275);
usleepn(275);
if ((options & OPTION_SSL) == 0) {
if (port != 0)
myport = port;
@@ -251,7 +250,8 @@ void service_pcanywhere(char *ip, int sp, unsigned char options, char *miscptr,
port = mysslport;
}
if (sock < 0) {
if (quiet != 1) fprintf(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int) getpid());
if (quiet != 1)
fprintf(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
hydra_child_exit(1);
}
@@ -278,13 +278,13 @@ void service_pcanywhere(char *ip, int sp, unsigned char options, char *miscptr,
}
}
int service_pcanywhere_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int32_t service_pcanywhere_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
//
// fill if needed.
//
//
// return codes:
// 0 all OK
// -1 error, hydra will exit, so print a good error message here
+41 -38
View File
@@ -5,11 +5,11 @@
extern char *HYDRA_EXIT;
char *buf;
#define LEN_HDR_RPC 24
#define LEN_AUTH_UNIX 72+12
#define LEN_HDR_RPC 24
#define LEN_AUTH_UNIX 72 + 12
/* RPC common hdr */
struct rpc_hdr { /* 24 */
struct rpc_hdr { /* 24 */
unsigned long xid;
unsigned long type_msg;
unsigned long version_rpc;
@@ -29,11 +29,11 @@ struct pr_auth_args {
char comments[255];
};
#define LEN_HDR_PCN_AUTH sizeof(struct pr_auth_args)
#define LEN_HDR_PCN_AUTH sizeof(struct pr_auth_args)
/* Lets start ... */
int start_pcnfs(int s, char *ip, int port, unsigned char options, char *miscptr, FILE * fp) {
int32_t start_pcnfs(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
char *empty = "";
char *login, *pass, buffer[LEN_HDR_RPC + LEN_AUTH_UNIX + LEN_HDR_PCN_AUTH];
char *ptr, *pkt = buffer;
@@ -51,22 +51,24 @@ int start_pcnfs(int s, char *ip, int port, unsigned char options, char *miscptr,
memset(pkt, 0, sizeof(buffer));
rpch = (struct rpc_hdr *) (pkt);
authp = (unsigned long *) (pkt + LEN_HDR_RPC);
prh = (struct pr_auth_args *) (pkt + LEN_HDR_RPC + LEN_AUTH_UNIX);
rpch = (struct rpc_hdr *)(pkt);
authp = (unsigned long *)(pkt + LEN_HDR_RPC);
prh = (struct pr_auth_args *)(pkt + LEN_HDR_RPC + LEN_AUTH_UNIX);
rpch->xid = htonl(0x32544843);
rpch->type_msg = htonl(0);
rpch->version_rpc = htonl(2);
rpch->prog_id = htonl(150001);
rpch->prog_ver = htonl(2);
rpch->prog_proc = htonl(13); /* PCNFSD_PROC_PRAUTH */
rpch->prog_proc = htonl(13); /* PCNFSD_PROC_PRAUTH */
prh->len_clnt = htonl(63);
prh->len_id = htonl(31);
prh->len_passwd = htonl(63);
prh->len_comments = htonl(254);
strcpy(prh->comments, " Hydra - THC password cracker - visit http://www.thc.org - use only allowed for legal purposes ");
strcpy(prh->comments, " Hydra - THC password cracker - visit "
"https://github.com/vanhauser-thc/thc-hydra - use only "
"allowed for legal purposes ");
strcpy(prh->name, "localhost");
ptr = prh->id;
@@ -82,16 +84,16 @@ int start_pcnfs(int s, char *ip, int port, unsigned char options, char *miscptr,
}
*ptr = 0;
gettimeofday(&tv, (struct timezone *) NULL);
*(authp) = htonl(1); /* auth unix */
*(++authp) = htonl(LEN_AUTH_UNIX - 16); /* length auth */
*(++authp) = htonl(tv.tv_sec); /* local time */
*(++authp) = htonl(9); /* length host */
strcpy((char *) ++authp, "localhost"); /* hostname */
authp += (3); /* len(host)%4 */
*(authp) = htonl(0); /* uid root */
*(++authp) = htonl(0); /* gid root */
*(++authp) = htonl(9); /* 9 gid grps */
gettimeofday(&tv, (struct timezone *)NULL);
*(authp) = htonl(1); /* auth unix */
*(++authp) = htonl(LEN_AUTH_UNIX - 16); /* length auth */
*(++authp) = htonl(tv.tv_sec); /* local time */
*(++authp) = htonl(9); /* length host */
strcpy((char *)++authp, "localhost"); /* hostname */
authp += (3); /* len(host)%4 */
*(authp) = htonl(0); /* uid root */
*(++authp) = htonl(0); /* gid root */
*(++authp) = htonl(9); /* 9 gid grps */
/* group root, bin, daemon, sys, adm, disk, wheel, floppy, "user gid" */
*(++authp) = htonl(0);
*(++authp) = htonl(1);
@@ -113,7 +115,7 @@ int start_pcnfs(int s, char *ip, int port, unsigned char options, char *miscptr,
return 1;
}
/* analyze the output */
/* analyze the output */
if (buf[2] != 'g' || buf[5] != 32) {
fprintf(stderr, "[ERROR] RPC answer status : bad proc/version/auth\n");
free(buf);
@@ -136,8 +138,8 @@ int start_pcnfs(int s, char *ip, int port, unsigned char options, char *miscptr,
return 1;
}
void service_pcnfs(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int run = 1, next_run = 1, sock = -1;
void service_pcnfs(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
int32_t run = 1, next_run = 1, sock = -1;
hydra_register_socket(sp);
if (port == 0) {
@@ -155,22 +157,23 @@ void service_pcnfs(char *ip, int sp, unsigned char options, char *miscptr, FILE
while (1) {
next_run = 0;
switch (run) {
case 1: /* connect and service init function */
{
if (sock >= 0)
sock = hydra_disconnect(sock);
// sleepn(275);
if ((sock = hydra_connect_udp(ip, port)) < 0) {
if (quiet != 1) fprintf(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int) getpid());
hydra_child_exit(1);
}
next_run = 2;
break;
case 1: /* connect and service init function */
{
if (sock >= 0)
sock = hydra_disconnect(sock);
// usleepn(275);
if ((sock = hydra_connect_udp(ip, port)) < 0) {
if (quiet != 1)
fprintf(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
hydra_child_exit(1);
}
case 2: /* run the cracking function */
next_run = 2;
break;
}
case 2: /* run the cracking function */
next_run = start_pcnfs(sock, ip, port, options, miscptr, fp);
break;
case 3: /* clean exit */
case 3: /* clean exit */
if (sock >= 0)
sock = hydra_disconnect(sock);
hydra_child_exit(0);
@@ -183,13 +186,13 @@ void service_pcnfs(char *ip, int sp, unsigned char options, char *miscptr, FILE
}
}
int service_pcnfs_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int32_t service_pcnfs_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
//
// fill if needed.
//
//
// return codes:
// 0 all OK
// -1 error, hydra will exit, so print a good error message here
+257 -250
View File
@@ -1,14 +1,14 @@
#include "hydra-mod.h"
#include "sasl.h"
//openssl s_client -starttls pop3 -crlf -connect 192.168.0.10:110
// openssl s_client -starttls pop3 -crlf -connect 192.168.0.10:110
typedef struct pool_str {
char ip[36];
/* int port;*/// not needed
int pop3_auth_mechanism;
int disable_tls;
/* int32_t port;*/ // not needed
int32_t pop3_auth_mechanism;
int32_t disable_tls;
struct pool_str *next;
} pool;
@@ -18,7 +18,7 @@ char apop_challenge[300] = "";
pool *plist = NULL, *p = NULL;
/* functions */
int service_pop3_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname);
int32_t service_pop3_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname);
pool *list_create(pool data) {
pool *p;
@@ -27,7 +27,7 @@ pool *list_create(pool data) {
return NULL;
memcpy(p->ip, data.ip, 36);
//p->port = data.port;
// p->port = data.port;
p->pop3_auth_mechanism = data.pop3_auth_mechanism;
p->disable_tls = data.disable_tls;
p->next = NULL;
@@ -40,7 +40,7 @@ pool *list_insert(pool data) {
newnode = list_create(data);
newnode->next = plist;
plist = newnode->next; // to be sure!
plist = newnode->next; // to be sure!
return newnode;
}
@@ -59,9 +59,9 @@ pool *list_find(char *ip) {
/* how to know when to release the mem ?
-> well, after _start has determined which pool number it is */
int list_remove(pool * node) {
int32_t list_remove(pool *node) {
pool *save, *list = plist;
int ok = -1;
int32_t ok = -1;
if (list == NULL || node == NULL)
return -2;
@@ -78,9 +78,9 @@ int list_remove(pool * node) {
return ok;
}
char *pop3_read_server_capacity(int sock) {
char *pop3_read_server_capacity(int32_t sock) {
char *ptr = NULL;
int resp = 0;
int32_t resp = 0;
char *buf = NULL;
do {
@@ -88,18 +88,18 @@ char *pop3_read_server_capacity(int sock) {
free(buf);
ptr = buf = hydra_receive_line(sock);
if (buf != NULL) {
/*
exchange capa:
/*
exchange capa:
+OK
UIDL
STLS
+OK
UIDL
STLS
*/
*/
if (strstr(buf, "\r\n.\r\n") != NULL && buf[0] == '+') {
resp = 1;
/* we got the capability info then get the completed warning info from server */
/* we got the capability info then get the completed warning info from
* server */
while (hydra_data_ready(sock)) {
free(buf);
buf = hydra_receive_line(sock);
@@ -117,8 +117,8 @@ STLS
return buf;
}
int start_pop3(int s, char *ip, int port, unsigned char options, char *miscptr, FILE * fp) {
char *empty = "\"\"";
int32_t start_pop3(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
char *empty = "\"\"", *result = NULL;
char *login, *pass, buffer[500], buffer2[500], *fooptr;
if (strlen(login = hydra_get_next_login()) == 0)
@@ -134,235 +134,234 @@ int start_pop3(int s, char *ip, int port, unsigned char options, char *miscptr,
switch (p->pop3_auth_mechanism) {
#ifdef LIBOPENSSL
case AUTH_APOP:{
MD5_CTX c;
unsigned char md5_raw[MD5_DIGEST_LENGTH];
int i;
char *pbuffer = buffer2;
case AUTH_APOP: {
MD5_CTX c;
unsigned char md5_raw[MD5_DIGEST_LENGTH];
int32_t i;
char *pbuffer = buffer2;
MD5_Init(&c);
MD5_Update(&c, apop_challenge, strlen(apop_challenge));
MD5_Update(&c, pass, strlen(pass));
MD5_Final(md5_raw, &c);
MD5_Init(&c);
MD5_Update(&c, apop_challenge, strlen(apop_challenge));
MD5_Update(&c, pass, strlen(pass));
MD5_Final(md5_raw, &c);
for (i = 0; i < MD5_DIGEST_LENGTH; i++) {
sprintf(pbuffer, "%02x", md5_raw[i]);
pbuffer += 2;
}
sprintf(buffer, "APOP %s %s\r\n", login, buffer2);
for (i = 0; i < MD5_DIGEST_LENGTH; i++) {
sprintf(pbuffer, "%02x", md5_raw[i]);
pbuffer += 2;
}
break;
sprintf(buffer, "APOP %s %s\r\n", login, buffer2);
} break;
#endif
case AUTH_LOGIN:{
sprintf(buffer, "AUTH LOGIN\r\n");
if (hydra_send(s, buffer, strlen(buffer), 0) < 0) {
return 1;
}
if ((buf = hydra_receive_line(s)) == NULL)
return 4;
if (buf[0] != '+') {
hydra_report(stderr, "[ERROR] POP3 LOGIN AUTH : %s\n", buf);
free(buf);
return 3;
}
free(buf);
strcpy(buffer2, login);
hydra_tobase64((unsigned char *) buffer2, strlen(buffer2), sizeof(buffer2));
sprintf(buffer, "%.250s\r\n", buffer2);
if (hydra_send(s, buffer, strlen(buffer), 0) < 0) {
return 1;
}
if ((buf = hydra_receive_line(s)) == NULL)
return 4;
if (buf[0] != '+') {
hydra_report(stderr, "[ERROR] POP3 LOGIN AUTH : %s\n", buf);
free(buf);
return 3;
}
free(buf);
strcpy(buffer2, pass);
hydra_tobase64((unsigned char *) buffer2, strlen(buffer2), sizeof(buffer2));
sprintf(buffer, "%.250s\r\n", buffer2);
case AUTH_LOGIN: {
sprintf(buffer, "AUTH LOGIN\r\n");
if (hydra_send(s, buffer, strlen(buffer), 0) < 0) {
return 1;
}
break;
case AUTH_PLAIN:{
sprintf(buffer, "AUTH PLAIN\r\n");
if (hydra_send(s, buffer, strlen(buffer), 0) < 0) {
return 1;
}
if ((buf = hydra_receive_line(s)) == NULL)
return 4;
if (buf[0] != '+') {
hydra_report(stderr, "[ERROR] POP3 PLAIN AUTH : %s\n", buf);
free(buf);
return 3;
}
if ((buf = hydra_receive_line(s)) == NULL)
return 4;
if (buf[0] != '+') {
hydra_report(stderr, "[ERROR] POP3 LOGIN AUTH : %s\n", buf);
free(buf);
memset(buffer, 0, sizeof(buffer));
sasl_plain(buffer, login, pass);
char tmp_buffer[sizeof(buffer)];
sprintf(tmp_buffer, "%.250s\r\n", buffer);
strcpy(buffer, tmp_buffer);
return 3;
}
break;
free(buf);
strcpy(buffer2, login);
hydra_tobase64((unsigned char *)buffer2, strlen(buffer2), sizeof(buffer2));
sprintf(buffer, "%.250s\r\n", buffer2);
if (hydra_send(s, buffer, strlen(buffer), 0) < 0) {
return 1;
}
if ((buf = hydra_receive_line(s)) == NULL)
return 4;
if (buf[0] != '+') {
hydra_report(stderr, "[ERROR] POP3 LOGIN AUTH : %s\n", buf);
free(buf);
return 3;
}
free(buf);
strcpy(buffer2, pass);
hydra_tobase64((unsigned char *)buffer2, strlen(buffer2), sizeof(buffer2));
sprintf(buffer, "%.250s\r\n", buffer2);
} break;
case AUTH_PLAIN: {
sprintf(buffer, "AUTH PLAIN\r\n");
if (hydra_send(s, buffer, strlen(buffer), 0) < 0) {
return 1;
}
if ((buf = hydra_receive_line(s)) == NULL)
return 4;
if (buf[0] != '+') {
hydra_report(stderr, "[ERROR] POP3 PLAIN AUTH : %s\n", buf);
free(buf);
return 3;
}
free(buf);
memset(buffer, 0, sizeof(buffer));
result = sasl_plain(buffer, login, pass);
if (result == NULL)
return 3;
char tmp_buffer[sizeof(buffer)];
sprintf(tmp_buffer, "%.250s\r\n", buffer);
strcpy(buffer, tmp_buffer);
} break;
#ifdef LIBOPENSSL
case AUTH_CRAMMD5:
case AUTH_CRAMSHA1:
case AUTH_CRAMSHA256:{
int rc = 0;
char *preplogin;
case AUTH_CRAMSHA256: {
int32_t rc = 0;
char *preplogin;
rc = sasl_saslprep(login, SASL_ALLOW_UNASSIGNED, &preplogin);
if (rc) {
return 3;
}
rc = sasl_saslprep(login, SASL_ALLOW_UNASSIGNED, &preplogin);
if (rc) {
return 3;
}
switch (p->pop3_auth_mechanism) {
case AUTH_CRAMMD5:
sprintf(buffer, "AUTH CRAM-MD5\r\n");
break;
case AUTH_CRAMSHA1:
sprintf(buffer, "AUTH CRAM-SHA1\r\n");
break;
case AUTH_CRAMSHA256:
sprintf(buffer, "AUTH CRAM-SHA256\r\n");
break;
}
if (hydra_send(s, buffer, strlen(buffer), 0) < 0) {
return 1;
}
// get the one-time BASE64 encoded challenge
if ((buf = hydra_receive_line(s)) == NULL)
return 4;
if (buf[0] != '+') {
switch (p->pop3_auth_mechanism) {
case AUTH_CRAMMD5:
sprintf(buffer, "AUTH CRAM-MD5\r\n");
hydra_report(stderr, "[ERROR] POP3 CRAM-MD5 AUTH : %s\n", buf);
break;
case AUTH_CRAMSHA1:
sprintf(buffer, "AUTH CRAM-SHA1\r\n");
hydra_report(stderr, "[ERROR] POP3 CRAM-SHA1 AUTH : %s\n", buf);
break;
case AUTH_CRAMSHA256:
sprintf(buffer, "AUTH CRAM-SHA256\r\n");
hydra_report(stderr, "[ERROR] POP3 CRAM-SHA256 AUTH : %s\n", buf);
break;
}
if (hydra_send(s, buffer, strlen(buffer), 0) < 0) {
return 1;
}
//get the one-time BASE64 encoded challenge
if ((buf = hydra_receive_line(s)) == NULL)
return 4;
if (buf[0] != '+') {
switch (p->pop3_auth_mechanism) {
case AUTH_CRAMMD5:
hydra_report(stderr, "[ERROR] POP3 CRAM-MD5 AUTH : %s\n", buf);
break;
case AUTH_CRAMSHA1:
hydra_report(stderr, "[ERROR] POP3 CRAM-SHA1 AUTH : %s\n", buf);
break;
case AUTH_CRAMSHA256:
hydra_report(stderr, "[ERROR] POP3 CRAM-SHA256 AUTH : %s\n", buf);
break;
}
free(buf);
return 3;
}
memset(buffer, 0, sizeof(buffer));
from64tobits((char *) buffer, buf + 2);
free(buf);
memset(buffer2, 0, sizeof(buffer2));
switch (p->pop3_auth_mechanism) {
case AUTH_CRAMMD5:{
sasl_cram_md5(buffer2, pass, buffer);
sprintf(buffer, "%s %.250s", preplogin, buffer2);
}
break;
case AUTH_CRAMSHA1:{
sasl_cram_sha1(buffer2, pass, buffer);
sprintf(buffer, "%s %.250s", preplogin, buffer2);
}
break;
case AUTH_CRAMSHA256:{
sasl_cram_sha256(buffer2, pass, buffer);
sprintf(buffer, "%s %.250s", preplogin, buffer2);
}
break;
}
hydra_tobase64((unsigned char *) buffer, strlen(buffer), sizeof(buffer));
char tmp_buffer[sizeof(buffer)];
sprintf(tmp_buffer, "%.250s\r\n", buffer);
strcpy(buffer, tmp_buffer);
free(preplogin);
return 3;
}
break;
case AUTH_DIGESTMD5:{
sprintf(buffer, "AUTH DIGEST-MD5\r\n");
memset(buffer, 0, sizeof(buffer));
from64tobits((char *)buffer, buf + 2);
free(buf);
if (hydra_send(s, buffer, strlen(buffer), 0) < 0)
return 1;
//receive
if ((buf = hydra_receive_line(s)) == NULL)
return 4;
if (buf[0] != '+') {
hydra_report(stderr, "[ERROR] POP3 DIGEST-MD5 AUTH : %s\n", buf);
free(buf);
memset(buffer2, 0, sizeof(buffer2));
switch (p->pop3_auth_mechanism) {
case AUTH_CRAMMD5: {
result = sasl_cram_md5(buffer2, pass, buffer);
if (result == NULL)
return 3;
}
memset(buffer, 0, sizeof(buffer));
from64tobits((char *) buffer, buf);
sprintf(buffer, "%s %.250s", preplogin, buffer2);
} break;
case AUTH_CRAMSHA1: {
result = sasl_cram_sha1(buffer2, pass, buffer);
if (result == NULL)
return 3;
sprintf(buffer, "%s %.250s", preplogin, buffer2);
} break;
case AUTH_CRAMSHA256: {
result = sasl_cram_sha256(buffer2, pass, buffer);
if (result == NULL)
return 3;
sprintf(buffer, "%s %.250s", preplogin, buffer2);
} break;
}
hydra_tobase64((unsigned char *)buffer, strlen(buffer), sizeof(buffer));
char tmp_buffer[sizeof(buffer)];
sprintf(tmp_buffer, "%.250s\r\n", buffer);
strcpy(buffer, tmp_buffer);
free(preplogin);
} break;
case AUTH_DIGESTMD5: {
sprintf(buffer, "AUTH DIGEST-MD5\r\n");
if (hydra_send(s, buffer, strlen(buffer), 0) < 0)
return 1;
// receive
if ((buf = hydra_receive_line(s)) == NULL)
return 4;
if (buf[0] != '+') {
hydra_report(stderr, "[ERROR] POP3 DIGEST-MD5 AUTH : %s\n", buf);
free(buf);
if (debug)
hydra_report(stderr, "[DEBUG] S: %s\n", buffer);
fooptr = buffer2;
sasl_digest_md5(fooptr, login, pass, buffer, miscptr, "pop", NULL, 0, NULL);
if (fooptr == NULL)
return 3;
if (debug)
hydra_report(stderr, "[DEBUG] C: %s\n", buffer2);
hydra_tobase64((unsigned char *) buffer2, strlen(buffer2), sizeof(buffer2));
sprintf(buffer, "%s\r\n", buffer2);
return 3;
}
break;
memset(buffer, 0, sizeof(buffer));
from64tobits((char *)buffer, buf);
free(buf);
if (debug)
hydra_report(stderr, "[DEBUG] S: %s\n", buffer);
fooptr = buffer2;
result = sasl_digest_md5(fooptr, login, pass, buffer, miscptr, "pop", NULL, 0, NULL);
if (result == NULL)
return 3;
if (debug)
hydra_report(stderr, "[DEBUG] C: %s\n", buffer2);
hydra_tobase64((unsigned char *)buffer2, strlen(buffer2), sizeof(buffer2));
sprintf(buffer, "%s\r\n", buffer2);
} break;
#endif
case AUTH_NTLM:{
unsigned char buf1[4096];
unsigned char buf2[4096];
case AUTH_NTLM: {
unsigned char buf1[4096];
unsigned char buf2[4096];
//Send auth request
sprintf(buffer, "AUTH NTLM\r\n");
// Send auth request
sprintf(buffer, "AUTH NTLM\r\n");
if (hydra_send(s, buffer, strlen(buffer), 0) < 0)
return 1;
//receive
if ((buf = hydra_receive_line(s)) == NULL)
return 4;
if (buf[0] != '+') {
hydra_report(stderr, "[ERROR] POP3 NTLM AUTH : %s\n", buf);
free(buf);
return 3;
}
if (hydra_send(s, buffer, strlen(buffer), 0) < 0)
return 1;
// receive
if ((buf = hydra_receive_line(s)) == NULL)
return 4;
if (buf[0] != '+') {
hydra_report(stderr, "[ERROR] POP3 NTLM AUTH : %s\n", buf);
free(buf);
//send auth and receive challenge
//send auth request: lst the server send it's own hostname and domainname
buildAuthRequest((tSmbNtlmAuthRequest *) buf2, 0, NULL, NULL);
to64frombits(buf1, buf2, SmbLength((tSmbNtlmAuthRequest *) buf2));
sprintf(buffer, "%s\r\n", buf1);
if (hydra_send(s, buffer, strlen(buffer), 0) < 0)
return 1;
if ((buf = hydra_receive_line(s)) == NULL || strlen(buf) < 6)
return 4;
//recover challenge
from64tobits((char *) buf1, buf + 2);
free(buf);
//Send response
buildAuthResponse((tSmbNtlmAuthChallenge *) buf1, (tSmbNtlmAuthResponse *) buf2, 0, login, pass, NULL, NULL);
to64frombits(buf1, buf2, SmbLength((tSmbNtlmAuthResponse *) buf2));
sprintf(buffer, "%s\r\n", buf1);
return 3;
}
break;
free(buf);
// send auth and receive challenge
// send auth request: lst the server send it's own hostname and domainname
buildAuthRequest((tSmbNtlmAuthRequest *)buf2, 0, NULL, NULL);
to64frombits(buf1, buf2, SmbLength((tSmbNtlmAuthRequest *)buf2));
sprintf(buffer, "%s\r\n", buf1);
if (hydra_send(s, buffer, strlen(buffer), 0) < 0)
return 1;
if ((buf = hydra_receive_line(s)) == NULL || strlen(buf) < 6)
return 4;
// recover challenge
from64tobits((char *)buf1, buf + 2);
free(buf);
// Send response
buildAuthResponse((tSmbNtlmAuthChallenge *)buf1, (tSmbNtlmAuthResponse *)buf2, 0, login, pass, NULL, NULL);
to64frombits(buf1, buf2, SmbLength((tSmbNtlmAuthResponse *)buf2));
sprintf(buffer, "%s\r\n", buf1);
} break;
default:
sprintf(buffer, "USER %.250s\r\n", login);
if (hydra_send(s, buffer, strlen(buffer), 0) < 0) {
@@ -397,6 +396,8 @@ int start_pop3(int s, char *ip, int port, unsigned char options, char *miscptr,
}
/* special AS/400 hack */
if (strstr(buf, "CPF2204") != NULL || strstr(buf, "CPF22E3") != NULL || strstr(buf, "CPF22E4") != NULL || strstr(buf, "CPF22E5") != NULL) {
if (verbose)
printf("[INFO] user %s does not exist, skipping\n", login);
hydra_completed_pair_skip();
free(buf);
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
@@ -411,11 +412,11 @@ int start_pop3(int s, char *ip, int port, unsigned char options, char *miscptr,
return 2;
}
void service_pop3(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int run = 1, next_run = 1, sock = -1;
void service_pop3(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
int32_t run = 1, next_run = 1, sock = -1;
char *ptr = NULL;
//extract data from the pool, ip is the key
// extract data from the pool, ip is the key
if (plist == NULL)
if (service_pop3_init(ip, sp, options, miscptr, fp, port, hostname) != 0)
hydra_child_exit(2);
@@ -431,14 +432,13 @@ void service_pop3(char *ip, int sp, unsigned char options, char *miscptr, FILE *
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return;
while (1) {
switch (run) {
case 1: /* connect and service init function */
case 1: /* connect and service init function */
if (sock >= 0)
sock = hydra_disconnect(sock);
// sleepn(300);
// usleepn(300);
if ((options & OPTION_SSL) == 0) {
sock = hydra_connect_tcp(ip, port);
} else {
@@ -446,11 +446,11 @@ void service_pop3(char *ip, int sp, unsigned char options, char *miscptr, FILE *
}
if (sock < 0) {
if (verbose || debug)
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int) getpid());
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
hydra_child_exit(1);
}
buf = hydra_receive_line(sock);
if (buf == NULL || buf[0] != '+') { /* check the first line */
if (buf == NULL || buf[0] != '+') { /* check the first line */
if (verbose || debug)
hydra_report(stderr, "[ERROR] Not an POP3 protocol or service shutdown: %s\n", buf);
hydra_child_exit(2);
@@ -468,11 +468,13 @@ void service_pop3(char *ip, int sp, unsigned char options, char *miscptr, FILE *
#ifdef LIBOPENSSL
if (!p->disable_tls) {
/* check for STARTTLS, if available we may have access to more basic auth methods */
/* check for STARTTLS, if available we may have access to more basic
* auth methods */
hydra_send(sock, "STLS\r\n", strlen("STLS\r\n"), 0);
buf = hydra_receive_line(sock);
if (buf[0] != '+') {
hydra_report(stderr, "[ERROR] TLS negotiation failed, no answer received from STARTTLS request\n");
hydra_report(stderr, "[ERROR] TLS negotiation failed, no answer "
"received from STARTTLS request\n");
} else {
free(buf);
if ((hydra_connect_to_ssl(sock, hostname) == -1)) {
@@ -489,15 +491,15 @@ void service_pop3(char *ip, int sp, unsigned char options, char *miscptr, FILE *
next_run = 2;
break;
case 2: /* run the cracking function */
case 2: /* run the cracking function */
next_run = start_pop3(sock, ip, port, options, miscptr, fp);
break;
case 3: /* clean exit */
case 3: /* clean exit */
if (sock >= 0)
sock = hydra_disconnect(sock);
hydra_child_exit(0);
return;
case 4: /* clean exit */
case 4: /* clean exit */
if (sock >= 0)
sock = hydra_disconnect(sock);
hydra_child_exit(2);
@@ -510,22 +512,19 @@ void service_pop3(char *ip, int sp, unsigned char options, char *miscptr, FILE *
}
}
int service_pop3_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int myport = PORT_POP3, mysslport = PORT_POP3_SSL;
int32_t service_pop3_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
int32_t myport = PORT_POP3, mysslport = PORT_POP3_SSL;
char *ptr = NULL;
int sock = -1;
int32_t sock = -1;
char *capa_str = "CAPA\r\n";
char *quit_str = "QUIT\r\n";
pool p;
p.pop3_auth_mechanism = AUTH_CLEAR;
p.disable_tls = 1;
p.next = NULL;
memcpy(p.ip, ip, 36);
if (sock >= 0)
sock = hydra_disconnect(sock);
// sleepn(300);
if ((options & OPTION_SSL) == 0) {
if (port != 0)
myport = port;
@@ -537,11 +536,11 @@ int service_pop3_init(char *ip, int sp, unsigned char options, char *miscptr, FI
}
if (sock < 0) {
if (verbose || debug)
hydra_report(stderr, "[ERROR] pid %d terminating, can not connect\n", (int) getpid());
hydra_report(stderr, "[ERROR] pid %d terminating, can not connect\n", (int32_t)getpid());
return -1;
}
buf = hydra_receive_line(sock);
if (buf == NULL || buf[0] != '+') { /* check the first line */
if (buf == NULL || buf[0] != '+') { /* check the first line */
if (verbose || debug)
hydra_report(stderr, "[ERROR] Not an POP3 protocol or service shutdown: %s\n", buf);
return -1;
@@ -572,25 +571,27 @@ int service_pop3_init(char *ip, int sp, unsigned char options, char *miscptr, FI
}
if ((miscptr != NULL) && (strlen(miscptr) > 0)) {
int i;
int32_t i;
for (i = 0; i < strlen(miscptr); i++)
miscptr[i] = (char) toupper((int) miscptr[i]);
miscptr[i] = (char)toupper((int32_t)miscptr[i]);
if (strstr(miscptr, "TLS") || strstr(miscptr, "SSL")) {
if (strstr(miscptr, "TLS") || strstr(miscptr, "SSL") || strstr(miscptr, "STARTTLS")) {
p.disable_tls = 0;
}
}
#ifdef LIBOPENSSL
if (!p.disable_tls) {
/* check for STARTTLS, if available we may have access to more basic auth methods */
/* check for STARTTLS, if available we may have access to more basic auth
* methods */
if (strstr(buf, "STLS") != NULL) {
hydra_send(sock, "STLS\r\n", strlen("STLS\r\n"), 0);
free(buf);
buf = hydra_receive_line(sock);
if (buf[0] != '+') {
hydra_report(stderr, "[ERROR] TLS negotiation failed, no answer received from STARTTLS request\n");
hydra_report(stderr, "[ERROR] TLS negotiation failed, no answer "
"received from STARTTLS request\n");
} else {
free(buf);
if ((hydra_connect_to_ssl(sock, hostname) == -1)) {
@@ -616,16 +617,16 @@ int service_pop3_init(char *ip, int sp, unsigned char options, char *miscptr, FI
}
}
} else
hydra_report(stderr, "[ERROR] option to use TLS/SSL failed as it is not supported by the server\n");
hydra_report(stderr, "[ERROR] option to use TLS/SSL failed as it is not "
"supported by the server\n");
}
#endif
if (hydra_send(sock, quit_str, strlen(quit_str), 0) < 0) {
//we dont care if the server is not receiving the quit msg
// we don't care if the server is not receiving the quit msg
}
hydra_disconnect(sock);
if (verbose)
hydra_report(stderr, "[VERBOSE] CAPABILITY: %s", buf);
@@ -648,7 +649,8 @@ int service_pop3_init(char *ip, int sp, unsigned char options, char *miscptr, FI
which are supported.
*/
/* which mean threre will *always* have a space before the LOGIN auth keyword */
/* which mean threre will *always* have a space before the LOGIN auth keyword
*/
if ((strstr(buf, " LOGIN") == NULL) && (strstr(buf, "NTLM") != NULL)) {
p.pop3_auth_mechanism = AUTH_NTLM;
}
@@ -688,12 +690,10 @@ int service_pop3_init(char *ip, int sp, unsigned char options, char *miscptr, FI
#else
p.pop3_auth_mechanism = AUTH_CLEAR;
#endif
}
free(buf);
if ((miscptr != NULL) && (strlen(miscptr) > 0)) {
if (strstr(miscptr, "CLEAR"))
p.pop3_auth_mechanism = AUTH_CLEAR;
@@ -722,7 +722,6 @@ int service_pop3_init(char *ip, int sp, unsigned char options, char *miscptr, FI
if (strstr(miscptr, "NTLM"))
p.pop3_auth_mechanism = AUTH_NTLM;
}
if (verbose) {
@@ -765,7 +764,6 @@ int service_pop3_init(char *ip, int sp, unsigned char options, char *miscptr, FI
case AUTH_NTLM:
hydra_report(stderr, "[VERBOSE] using POP3 NTLM AUTH mechanism\n");
break;
}
}
@@ -776,3 +774,12 @@ int service_pop3_init(char *ip, int sp, unsigned char options, char *miscptr, FI
return 0;
}
void usage_pop3(const char *service) {
printf("Module pop3 is optionally taking one authentication type of:\n"
" CLEAR (default), LOGIN, PLAIN, CRAM-MD5, CRAM-SHA1,\n"
" CRAM-SHA256, DIGEST-MD5, NTLM.\n"
"Additionally TLS encryption via STLS can be enforced with the TLS "
"option.\n\n"
"Example: pop3://target/TLS:PLAIN\n");
}
+20 -19
View File
@@ -1,27 +1,24 @@
/*
* PostgresSQL Support - by Diaul (at) devilopers.org
* PostgresSQL Support - by Diaul (at) devilopers.org
*
*
*
* 110425 no obvious memleaks found
*/
#include "hydra-mod.h"
#ifndef LIBPOSTGRES
void dummy_postgres() {
printf("\n");
}
void dummy_postgres() { printf("\n"); }
#else
#include "libpq-fe.h" // Postgres connection functions
#include "libpq-fe.h" // Postgres connection functions
#include <stdio.h>
#define DEFAULT_DB "template1"
extern char *HYDRA_EXIT;
int start_postgres(int s, char *ip, int port, unsigned char options, char *miscptr, FILE * fp) {
int32_t start_postgres(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
char *empty = "";
char *login, *pass;
char database[256];
@@ -43,7 +40,6 @@ int start_postgres(int s, char *ip, int port, unsigned char options, char *miscp
* Building the connection string
*/
snprintf(connection_string, sizeof(connection_string), "host = '%s' dbname = '%s' user = '%s' password = '%s' ", hydra_address2string(ip), database, login, pass);
if (verbose)
@@ -66,21 +62,20 @@ int start_postgres(int s, char *ip, int port, unsigned char options, char *miscp
return 1;
}
void service_postgres(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int run = 1, next_run = 1, sock = -1;
int myport = PORT_POSTGRES, mysslport = PORT_POSTGRES_SSL;
void service_postgres(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
int32_t run = 1, next_run = 1, sock = -1;
int32_t myport = PORT_POSTGRES, mysslport = PORT_POSTGRES_SSL;
hydra_register_socket(sp);
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return;
while (1) {
switch (run) {
case 1: /* connect and service init function */
case 1: /* connect and service init function */
if (sock >= 0)
sock = hydra_disconnect(sock);
// sleepn(275);
// usleepn(275);
if ((options & OPTION_SSL) == 0) {
if (port != 0)
myport = port;
@@ -93,14 +88,15 @@ void service_postgres(char *ip, int sp, unsigned char options, char *miscptr, FI
port = mysslport;
}
if (sock < 0) {
if (quiet != 1) fprintf(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int) getpid());
if (quiet != 1)
fprintf(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
hydra_child_exit(1);
}
next_run = 2;
break;
case 2:
/*
* Here we start the password cracking process
* Here we start the password cracking process
*/
next_run = start_postgres(sock, ip, port, options, miscptr, fp);
break;
@@ -119,16 +115,21 @@ void service_postgres(char *ip, int sp, unsigned char options, char *miscptr, FI
#endif
int service_postgres_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int32_t service_postgres_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
//
// fill if needed.
//
//
// return codes:
// 0 all OK
// -1 error, hydra will exit, so print a good error message here
return 0;
}
void usage_postgres(const char *service) {
printf("Module postgres is optionally taking the database to attack, default "
"is \"template1\"\n\n");
}
+385
View File
@@ -0,0 +1,385 @@
#include "hydra-mod.h"
#include <arpa/inet.h>
#include <unistd.h>
#ifdef HAVE_GCRYPT
#include <gcrypt.h>
#endif
extern char *HYDRA_EXIT;
// RAdmin 2.x
struct rmessage {
uint8_t magic; // Indicates version, probably?
uint32_t length; // Total message size of data.
uint32_t checksum; // Checksum from type to end of data.
uint8_t type; // Command type, table below.
unsigned char data[32]; // data to be sent.
};
/*
* Usage: sum = checksum(message);
* Function: Returns a 4 byte little endian sum of the messages typecode+data.
* This data is zero padded for alignment. Example message (big endian):
* [01][00000021][0f43d461] sum([1b6e779a f37189bb c1b22982 c80d1f4d 66678ff9
* 4b10f0ce eabff6e8 f4fb8338 3b] + zeropad(3)]) Sum: is 0f43d461 (big endian)
*/
uint32_t checksum(struct rmessage *msg) {
int32_t blen;
uint8_t *stream;
uint32_t sum;
blen = msg->length; // Get the real length.
blen += (4 - (blen % 4));
// Allocate a worksapce.
stream = calloc(blen, sizeof(uint8_t));
memcpy(stream, &msg->type, sizeof(uint8_t));
memcpy(stream + 1, msg->data, blen - 1);
sum = 0;
for (blen -= sizeof(uint32_t); blen > 0; blen -= sizeof(uint32_t)) {
sum += *(uint32_t *)(stream + blen);
}
sum += *(uint32_t *)stream;
// Free the workspace.
free(stream);
return sum;
}
/*
* Usage: challenge_request(message);
* Function: Modifies message to reflect a request for a challenge. Updates the
* checksum as appropriate.
*/
void challenge_request(struct rmessage *msg) {
msg->magic = 0x01;
msg->length = 0x01;
msg->type = 0x1b;
msg->checksum = checksum(msg);
}
/*
* Usage: challenge_request(message);
* Function: Modifies message to reflect a response to a challenge. Updates the
* checksum as appropriate.
*/
void challenge_response(struct rmessage *msg, unsigned char *solution) {
msg->magic = 0x01;
msg->length = 0x21;
msg->type = 0x09;
memcpy(msg->data, solution, 0x20);
msg->checksum = checksum(msg);
}
/*
* Usage: buffer = message2buffer(message); send(buffer, message->length + 10);
* free(buffer) Function: Allocates a buffer for transmission and fills the
* buffer with message data such that it is ready to transmit.
*/
// TODO: conver to a sendMessage() function?
char *message2buffer(struct rmessage *msg) {
char *data;
if (msg == NULL) {
hydra_report(stderr, "rmessage is null\n");
hydra_child_exit(0);
return NULL;
}
switch (msg->type) {
case 0x1b: // Challenge request
data = (char *)calloc(10, sizeof(char));
if (data == NULL) {
hydra_report(stderr, "calloc failure\n");
hydra_child_exit(0);
}
memcpy(data, &msg->magic, sizeof(char));
*((int32_t *)(data + 1)) = htonl(msg->length);
*((int32_t *)(data + 5)) = htonl(msg->checksum);
memcpy((data + 9), &msg->type, sizeof(char));
break;
case 0x09:
data = (char *)calloc(42, sizeof(char));
if (data == NULL) {
hydra_report(stderr, "calloc failure\n");
hydra_child_exit(0);
}
memcpy(data, &msg->magic, sizeof(char));
*((int32_t *)(data + 1)) = htonl(msg->length);
*((int32_t *)(data + 5)) = htonl(msg->checksum);
memcpy((data + 9), &msg->type, sizeof(char));
memcpy((data + 10), msg->data, sizeof(char) * 32);
break;
default:
hydra_report(stderr, "unknown rmessage type\n");
hydra_child_exit(0);
return NULL;
}
return data;
}
struct rmessage *buffer2message(char *buffer) {
struct rmessage *msg;
msg = calloc(1, sizeof(struct rmessage));
if (msg == NULL) {
hydra_report(stderr, "calloc failure\n");
hydra_child_exit(0);
}
// Start parsing...
msg->magic = buffer[0];
buffer += sizeof(char);
msg->length = ntohl(*((uint32_t *)(buffer)));
buffer += sizeof(uint32_t);
msg->checksum = ntohl(*((uint32_t *)(buffer)));
buffer += sizeof(uint32_t);
msg->type = buffer[0];
buffer += sizeof(char);
// Verify known fields...
if (msg->magic != 0x01) {
hydra_report(stderr, "Bad magic\n");
hydra_child_exit(0);
return NULL;
}
switch (msg->type) {
case 0x1b:
if (msg->length != 0x21) {
hydra_report(stderr, "Bad length...%08x\n", msg->length);
hydra_child_exit(0);
return NULL;
}
memcpy(msg->data, buffer, 32);
break;
case 0x0a:
// Win!
case 0x0b:
// Lose!
break;
default:
hydra_report(stderr, "unknown rmessage type");
hydra_child_exit(0);
return NULL;
}
return msg;
}
int32_t start_radmin2(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) { return 0; }
void service_radmin2(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
#ifdef HAVE_GCRYPT
int32_t sock = -1;
int32_t index;
int32_t bytecount;
char *request;
struct rmessage *msg;
int32_t myport = PORT_RADMIN2;
char buffer[42];
char password[101];
uint8_t rawkey[16];
uint8_t *IV = "\xFE\xDC\xBA\x98\x76\x54\x32\x10\xA3\x9D\x4A\x18\xF8\x5B\x4A\x52";
uint8_t encrypted[32];
gcry_error_t err;
gcry_cipher_hd_t cipher;
gcry_md_hd_t md;
if (port != 0) {
myport = port;
}
gcry_check_version(NULL);
memset(buffer, 0x00, sizeof(buffer));
// Phone the mother ship
hydra_register_socket(sp);
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0) {
return;
}
while (1) {
/* Typical conversation goes as follows...
0) connect to server
1) request challenge
2) receive 32 byte challenge response
3) send 32 byte challenge solution
4) receive 1 byte auth success/fail message
*/
// 0) Connect to the server
sock = hydra_connect_tcp(ip, myport);
if (sock < 0) {
hydra_report(stderr, "Error: Child with pid %d terminating, can not connect\n", (int32_t)getpid());
hydra_child_exit(1);
}
// 1) request challenge (working)
msg = calloc(1, sizeof(struct rmessage));
challenge_request(msg);
request = message2buffer(msg);
hydra_send(sock, request, 10, 0);
free(msg);
free(request);
// 2) receive response (working)
index = 0;
while (index < 42) { // We're always expecting back a 42 byte buffer from a
// challenge request.
switch (hydra_data_ready(sock)) {
case -1:
hydra_report(stderr, "Error: Child with pid %d terminating, receive error\nerror:\t%s\n", (int32_t)getpid(), strerror(errno));
hydra_child_exit(1);
break;
case 0:
// keep waiting...
break;
default:
bytecount = hydra_recv(sock, buffer + index, 42 - index);
if (bytecount < 0) {
hydra_report(stderr,
"Error: Child with pid %d terminating, receive "
"error\nerror:\t%s\n",
(int32_t)getpid(), strerror(errno));
hydra_child_exit(1);
}
index += bytecount;
}
}
// 3) Send challenge solution.
// Get a password to work with.
memset(password, 0x00, sizeof(password));
memset(encrypted, 0x00, sizeof(encrypted));
hydra_get_next_pair();
strncpy(password, hydra_get_next_password(), sizeof(password) - 1);
// MD5 the password to generate the password key, this is used with twofish
// below.
err = gcry_md_open(&md, GCRY_MD_MD5, 0);
if (err) {
hydra_report(stderr,
"Error: Child with pid %d terminating, gcry_md_open error "
"(%08x)\n%s/%s",
(int32_t)getpid(), index, gcry_strsource(err), gcry_strerror(err));
hydra_child_exit(1);
}
gcry_md_reset(md);
gcry_md_write(md, password, 100);
if (gcry_md_read(md, 0) == NULL) {
hydra_report(stderr, "Error: Child with pid %d terminating, gcry_md_read error (%08x)\n", (int32_t)getpid(), index);
hydra_child_exit(1);
}
memcpy(rawkey, gcry_md_read(md, 0), 16);
gcry_md_close(md);
// 3.a) generate a new message from the buffer
msg = buffer2message(buffer);
// 3.b) encrypt data received using pkey & known IV
err = gcry_cipher_open(&cipher, GCRY_CIPHER_TWOFISH128, GCRY_CIPHER_MODE_CBC, 0);
if (err) {
hydra_report(stderr,
"Error: Child with pid %d terminating, gcry_cipher_open "
"error (%08x)\n%s/%s",
(int32_t)getpid(), index, gcry_strsource(err), gcry_strerror(err));
hydra_child_exit(1);
}
err = gcry_cipher_setiv(cipher, IV, 16);
if (err) {
hydra_report(stderr,
"Error: Child with pid %d terminating, gcry_cipher_setiv "
"error (%08x)\n%s/%s",
(int32_t)getpid(), index, gcry_strsource(err), gcry_strerror(err));
hydra_child_exit(1);
}
err = gcry_cipher_setkey(cipher, rawkey, 16);
if (err) {
hydra_report(stderr,
"Error: Child with pid %d terminating, gcry_cipher_setkey "
"error (%08x)\n%s/%s",
(int32_t)getpid(), index, gcry_strsource(err), gcry_strerror(err));
hydra_child_exit(1);
}
err = gcry_cipher_encrypt(cipher, encrypted, 32, msg->data, 32);
if (err) {
hydra_report(stderr,
"Error: Child with pid %d terminating, gcry_cipher_encrypt "
"error (%08x)\n%s/%s",
(int32_t)getpid(), index, gcry_strsource(err), gcry_strerror(err));
hydra_child_exit(1);
}
gcry_cipher_close(cipher);
// 3.c) half sum - this is the solution to the challenge.
for (index = 0; index < 16; index++) {
*(encrypted + index) += *(encrypted + index + 16);
}
memset((encrypted + 16), 0x00, 16);
// 3.d) send half sum
challenge_response(msg, encrypted);
request = message2buffer(msg);
hydra_send(sock, request, 42, 0);
free(msg);
free(request);
// 4) receive auth success/failure
index = 0;
while (index < 10) { // We're always expecting back a 42 byte buffer from a
// challenge request.
switch (hydra_data_ready(sock)) {
case -1:
hydra_report(stderr, "Error: Child with pid %d terminating, receive error\nerror:\t%s\n", (int32_t)getpid(), strerror(errno));
hydra_child_exit(1);
break;
case 0:
// keep waiting...
break;
default:
bytecount = hydra_recv(sock, buffer + index, 10 - index);
if (bytecount < 0) {
hydra_report(stderr,
"Error: Child with pid %d terminating, receive "
"error\nerror:\t%s\n",
(int32_t)getpid(), strerror(errno));
hydra_child_exit(1);
}
index += bytecount;
}
}
msg = buffer2message(buffer);
switch (msg->type) {
case 0x0a:
hydra_completed_pair_found();
break;
case 0x0b:
hydra_completed_pair();
hydra_disconnect(sock);
break;
default:
hydra_report(stderr, "Error: Child with pid %d terminating, protocol error\n", (int32_t)getpid());
hydra_child_exit(2);
}
}
#endif
}
int32_t service_radmin2_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
//
// fill if needed.
//
// return codes:
// 0 all OK
// -1 error, hydra will exit, so print a good error message here
return 0;
}
+90 -3179
View File
File diff suppressed because it is too large Load Diff
+69 -50
View File
@@ -3,14 +3,22 @@
extern char *HYDRA_EXIT;
char *buf;
int start_redis(int s, char *ip, int port, unsigned char options, char *miscptr, FILE * fp) {
int32_t start_redis(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
char *pass, buffer[510];
char *empty = "";
if (strlen(pass = hydra_get_next_password()) == 0)
pass = empty;
sprintf(buffer, "AUTH %.250s\r\n", pass);
char pass_num[50];
int32_t pass_len = strlen(pass);
snprintf(pass_num, 50, "%d", pass_len);
memset(buffer, 0, sizeof(buffer));
sprintf(buffer, "*2\r\n$4\r\nAUTH\r\n$%.50s\r\n%.250s\r\n", pass_num, pass);
if (debug)
hydra_report(stderr, "[DEBUG] Auth:\n %s\n", buffer);
if (hydra_send(s, buffer, strlen(buffer), 0) < 0) {
return 1;
@@ -21,21 +29,31 @@ int start_redis(int s, char *ip, int port, unsigned char options, char *miscptr,
hydra_completed_pair_found();
free(buf);
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return 3;
return 4;
return 1;
}
if (verbose > 1)
hydra_report(stderr, "[VERBOSE] Authentication failed for password %s\n", pass);
hydra_completed_pair();
free(buf);
if (buf[0] == '-') {
if (verbose > 1)
hydra_report(stderr, "[VERBOSE] Authentication failed for password %s\n", pass);
hydra_completed_pair();
free(buf);
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return 4;
return 2;
} else {
hydra_report(stderr, "[ERROR] Redis service shutdown.\n");
free(buf);
return 3;
}
/* not reached */
return 1;
}
void service_redis_core(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname, int tls) {
int run = 1, next_run = 1, sock = -1;
int myport = PORT_REDIS, mysslport = PORT_REDIS_SSL;
void service_redis_core(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname, int32_t tls) {
int32_t run = 1, next_run = 1, sock = -1;
int32_t myport = PORT_REDIS, mysslport = PORT_REDIS_SSL;
hydra_register_socket(sp);
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
@@ -43,7 +61,7 @@ void service_redis_core(char *ip, int sp, unsigned char options, char *miscptr,
while (1) {
switch (run) {
case 1: /* connect and service init function */
case 1: /* connect and service init function */
if (sock >= 0)
sock = hydra_disconnect(sock);
if ((options & OPTION_SSL) == 0) {
@@ -59,23 +77,25 @@ void service_redis_core(char *ip, int sp, unsigned char options, char *miscptr,
}
if (sock < 0) {
if (verbose || debug)
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int) getpid());
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
hydra_child_exit(1);
}
usleepn(250);
next_run = 2;
break;
case 2: /* run the cracking function */
case 2: /* run the cracking function */
next_run = start_redis(sock, ip, port, options, miscptr, fp);
break;
case 3: /* error exit */
case 3: /* error exit */
if (sock >= 0)
sock = hydra_disconnect(sock);
hydra_child_exit(2);
case 4: /* clean exit */
break;
case 4: /* clean exit */
if (sock >= 0)
sock = hydra_disconnect(sock);
hydra_child_exit(0);
break;
default:
hydra_report(stderr, "[ERROR] Caught unknown return code, exiting!\n");
hydra_child_exit(2);
@@ -84,40 +104,38 @@ void service_redis_core(char *ip, int sp, unsigned char options, char *miscptr,
}
}
void service_redis(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
service_redis_core(ip, sp, options, miscptr, fp, port, hostname, 0);
}
void service_redis(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) { service_redis_core(ip, sp, options, miscptr, fp, port, hostname, 0); }
/*
* Initial password authentication test and response test for the redis server,
* added by Petar Kaleychev <petar.kaleychev@gmail.com>
* The service_redis_init function is generating ping request as redis-cli (command line interface).
* You can use redis-cli to connect with Redis. After start of the redis-server in another terminal the following:
* % ./redis-cli
* redis> ping
* when the server do not require password, leads to:
* PONG
* when the server requires password, leads to:
* (error) NOAUTH Authentication required.
* or
* (error) ERR operation not permitted (for older redis versions)
* That is used for initial password authentication and redis server response tests in service_redis_init
*/
int service_redis_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
/*
* Initial password authentication test and response test for the redis server,
* added by Petar Kaleychev <petar.kaleychev@gmail.com>
* The service_redis_init function is generating ping request as redis-cli
* (command line interface). You can use redis-cli to connect with Redis. After
* start of the redis-server in another terminal the following: % ./redis-cli
* redis> ping
* when the server does not require password, leads to:
* PONG
* when the server requires password, leads to:
* (error) NOAUTH Authentication required.
* or
* (error) ERR operation not permitted (for older redis versions)
* That is used for initial password authentication and redis server response
* tests in service_redis_init
*/
int32_t service_redis_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
// return codes:
// 0 - when the server is redis and it requires password
// 1 - when the server is not redis or when the server do not require password
// n - when the server is not redis or when the server does not require
// password
int sock = -1;
int myport = PORT_REDIS, mysslport = PORT_REDIS_SSL;
int32_t sock = -1;
int32_t myport = PORT_REDIS, mysslport = PORT_REDIS_SSL;
char buffer[] = "*1\r\n$4\r\nping\r\n";
hydra_register_socket(sp);
if (sock >= 0)
sock = hydra_disconnect(sock);
if ((options & OPTION_SSL) == 0) {
if (port != 0)
myport = port;
@@ -130,35 +148,36 @@ int service_redis_init(char *ip, int sp, unsigned char options, char *miscptr, F
port = mysslport;
}
if (verbose)
printf("[VERBOSE] Initial redis password authentication test and response test ...\n");
printf("[VERBOSE] Initial redis password authentication test and response "
"test ...\n");
if (sock < 0) {
hydra_report(stderr, "[ERROR] Can not connect to port %d on the target\n", myport);
hydra_child_exit(1);
return 3;
}
// generating ping request as redis-cli
if (debug)
printf("[DEBUG] buffer = %s\n", buffer);
// [debug mode]: buffer is:
// *1
// $4
// ping
// [debug mode]: buffer is:
// *1
// $4
// ping
if (hydra_send(sock, buffer, strlen(buffer), 0) < 0) {
return 1;
return 2;
}
buf = hydra_receive_line(sock);
if (debug)
printf("[DEBUG] buf = %s\n", buf);
// authentication test
if (strstr(buf, "+PONG") != NULL) { // the server do not require password
hydra_report(stderr, "[!] The server do not require password.\n");
if (strstr(buf, "+PONG") != NULL) { // the server does not require password
hydra_report(stderr, "[!] The server %s does not require password.\n", hostname);
free(buf);
return 1;
return 2;
}
// server response test
if (strstr(buf, "-NOAUTH Authentication required") == NULL && strstr(buf, "-ERR operation not permitted") == NULL) {
hydra_report(stderr, "[ERROR] The server is not redis, exit.\n");
free(buf);
return 1;
return 2;
}
if (verbose)
printf("[VERBOSE] The redis server requires password.\n");
+31 -33
View File
@@ -5,12 +5,11 @@
#define COMMAND "/bin/ls /"
extern char *HYDRA_EXIT;
char *buf;
int start_rexec(int s, char *ip, int port, unsigned char options, char *miscptr, FILE * fp) {
int32_t start_rexec(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
char *empty = "";
char *login, *pass, buffer[300] = "", buffer2[100], *bptr = buffer2;
int ret;
int32_t ret;
if (strlen(login = hydra_get_next_login()) == 0)
login = empty;
@@ -45,9 +44,9 @@ int start_rexec(int s, char *ip, int port, unsigned char options, char *miscptr,
return 1;
}
void service_rexec(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int run = 1, next_run = 1, sock = -1;
int myport = PORT_REXEC, mysslport = PORT_REXEC_SSL;
void service_rexec(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
int32_t run = 1, next_run = 1, sock = -1;
int32_t myport = PORT_REXEC, mysslport = PORT_REXEC_SSL;
hydra_register_socket(sp);
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
@@ -55,33 +54,33 @@ void service_rexec(char *ip, int sp, unsigned char options, char *miscptr, FILE
while (1) {
next_run = 0;
switch (run) {
case 1: /* connect and service init function */
{
if (sock >= 0)
sock = hydra_disconnect(sock);
// sleepn(275);
if ((options & OPTION_SSL) == 0) {
if (port != 0)
myport = port;
sock = hydra_connect_tcp(ip, myport);
port = myport;
} else {
if (port != 0)
mysslport = port;
sock = hydra_connect_ssl(ip, mysslport, hostname);
port = mysslport;
}
if (sock < 0) {
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int) getpid());
hydra_child_exit(1);
}
next_run = 2;
break;
case 1: /* connect and service init function */
{
if (sock >= 0)
sock = hydra_disconnect(sock);
// usleepn(275);
if ((options & OPTION_SSL) == 0) {
if (port != 0)
myport = port;
sock = hydra_connect_tcp(ip, myport);
port = myport;
} else {
if (port != 0)
mysslport = port;
sock = hydra_connect_ssl(ip, mysslport, hostname);
port = mysslport;
}
case 2: /* run the cracking function */
if (sock < 0) {
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
hydra_child_exit(1);
}
next_run = 2;
break;
}
case 2: /* run the cracking function */
next_run = start_rexec(sock, ip, port, options, miscptr, fp);
break;
case 3: /* clean exit */
case 3: /* clean exit */
if (sock >= 0)
sock = hydra_disconnect(sock);
hydra_child_exit(0);
@@ -89,19 +88,18 @@ void service_rexec(char *ip, int sp, unsigned char options, char *miscptr, FILE
default:
hydra_report(stderr, "[ERROR] Caught unknown return code, exiting!\n");
hydra_child_exit(0);
}
run = next_run;
}
}
int service_rexec_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int32_t service_rexec_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
//
// fill if needed.
//
//
// return codes:
// 0 all OK
// -1 error, hydra will exit, so print a good error message here
+36 -38
View File
@@ -8,16 +8,14 @@ client have to use port from 512 -> 1023 or server is denying the connection
no memleaks found on 110425
*/
#define TERM "vt100/9600"
extern char *HYDRA_EXIT;
char *buf;
int start_rlogin(int s, char *ip, int port, unsigned char options, char *miscptr, FILE * fp) {
int32_t start_rlogin(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
char *empty = "";
char *login, *pass, buffer[300] = "", buffer2[100], *bptr = buffer2;
int ret;
int32_t ret;
if (strlen(login = hydra_get_next_login()) == 0)
login = empty;
@@ -61,8 +59,7 @@ int start_rlogin(int s, char *ip, int port, unsigned char options, char *miscptr
memset(buffer, 0, sizeof(buffer));
ret = hydra_recv(s, buffer, sizeof(buffer));
if (strcmp(buffer, "\r\n"))
ret = hydra_recv(s, buffer, sizeof(buffer) - 1);
if (ret >= 0)
if ((ret = hydra_recv(s, buffer, sizeof(buffer) - 1)) > 0)
buffer[ret] = 0;
}
/* Authentication failure */
@@ -80,7 +77,8 @@ int start_rlogin(int s, char *ip, int port, unsigned char options, char *miscptr
hydra_completed_pair();
}
} else {
/* if password is asked a second time, it means the pass we provided is wrong */
/* if password is asked a second time, it means the pass we provided is
* wrong */
hydra_completed_pair();
}
@@ -89,9 +87,9 @@ int start_rlogin(int s, char *ip, int port, unsigned char options, char *miscptr
return 1;
}
void service_rlogin(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int run = 1, next_run = 1, sock = -1;
int myport = PORT_RLOGIN, mysslport = PORT_RLOGIN_SSL;
void service_rlogin(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
int32_t run = 1, next_run = 1, sock = -1;
int32_t myport = PORT_RLOGIN, mysslport = PORT_RLOGIN_SSL;
hydra_register_socket(sp);
@@ -100,35 +98,35 @@ void service_rlogin(char *ip, int sp, unsigned char options, char *miscptr, FILE
while (1) {
next_run = 0;
switch (run) {
case 1: /* connect and service init function */
{
/* 512 -> 1023 */
hydra_set_srcport(1023);
if (sock >= 0)
sock = hydra_disconnect(sock);
// sleepn(275);
if ((options & OPTION_SSL) == 0) {
if (port != 0)
myport = port;
sock = hydra_connect_tcp(ip, myport);
port = myport;
} else {
if (port != 0)
mysslport = port;
sock = hydra_connect_ssl(ip, mysslport, hostname);
port = mysslport;
}
if (sock < 0) {
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int) getpid());
hydra_child_exit(1);
}
next_run = 2;
break;
case 1: /* connect and service init function */
{
/* 512 -> 1023 */
hydra_set_srcport(1023);
if (sock >= 0)
sock = hydra_disconnect(sock);
// usleepn(275);
if ((options & OPTION_SSL) == 0) {
if (port != 0)
myport = port;
sock = hydra_connect_tcp(ip, myport);
port = myport;
} else {
if (port != 0)
mysslport = port;
sock = hydra_connect_ssl(ip, mysslport, hostname);
port = mysslport;
}
case 2: /* run the cracking function */
if (sock < 0) {
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
hydra_child_exit(1);
}
next_run = 2;
break;
}
case 2: /* run the cracking function */
next_run = start_rlogin(sock, ip, port, options, miscptr, fp);
break;
case 3: /* clean exit */
case 3: /* clean exit */
if (sock >= 0)
sock = hydra_disconnect(sock);
hydra_child_exit(0);
@@ -141,13 +139,13 @@ void service_rlogin(char *ip, int sp, unsigned char options, char *miscptr, FILE
}
}
int service_rlogin_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int32_t service_rlogin_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
//
// fill if needed.
//
//
// return codes:
// 0 all OK
// -1 error, hydra will exit, so print a good error message here
+166
View File
@@ -0,0 +1,166 @@
// rpcap
// Petar Kaleychev
#include "hydra-mod.h"
extern char *HYDRA_EXIT;
char *buf;
int32_t start_rpcap(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
char *empty = "";
char *login, *pass, buffer[1024];
if (strlen(login = hydra_get_next_login()) == 0)
login = empty;
if (strlen(pass = hydra_get_next_password()) == 0)
pass = empty;
char bfr1[] = "\x00";
char bfr2[] = "\x08";
char bfr3[] = "\x00\x00\x00\x00\x00";
char bfr4[] = " ";
bfr4[0] = strlen(login) + strlen(pass) + 8;
char bfr5[] = "\x00";
char bfr6[] = "\x01"; // x01 - when a password is required, x00 - when no need
// of password
char bfr7[] = "\x00\x00\x00";
char bfr8[] = " ";
bfr8[0] = strlen(login);
char bfr9[] = "\x00";
char bfr10[] = " ";
bfr10[0] = strlen(pass);
memset(buffer, 0, sizeof(buffer));
memcpy(buffer, bfr1, 1);
memcpy(buffer + 1, bfr2, 1);
memcpy(buffer + 2, bfr3, 5);
memcpy(buffer + 7, bfr4, 1);
memcpy(buffer + 8, bfr5, 1);
memcpy(buffer + 9, bfr6, 1);
memcpy(buffer + 10, bfr7, 3);
memcpy(buffer + 13, bfr8, 1);
memcpy(buffer + 14, bfr9, 1);
memcpy(buffer + 15, bfr10, 1);
memcpy(buffer + 16, login, strlen(login));
memcpy(buffer + 16 + strlen(login), pass, strlen(pass));
if (hydra_send(s, buffer, 16 + strlen(login) + strlen(pass), 0) < 0) {
return 1;
}
buf = hydra_receive_line(s);
if (buf[1] == '\x88') {
hydra_report_found_host(port, ip, "rpcap", fp);
hydra_completed_pair_found();
free(buf);
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return 3;
return 1;
}
/*
if (strstr(buf, "Logon failure") == NULL) {
hydra_report(stderr, "[ERROR] rpcap error or service shutdown: %s\n",
buf); free(buf); return 4;
}
*/
free(buf);
hydra_completed_pair();
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return 3;
return 2;
}
void service_rpcap(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
int32_t run = 1, next_run = 1, sock = -1;
int32_t myport = PORT_RPCAP, mysslport = PORT_RPCAP_SSL;
hydra_register_socket(sp);
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return;
while (1) {
switch (run) {
case 1: /* connect and service init function */
if (sock >= 0)
sock = hydra_disconnect(sock);
// usleep(300000);
if ((options & OPTION_SSL) == 0) {
if (port != 0)
myport = port;
sock = hydra_connect_tcp(ip, myport);
port = myport;
} else {
if (port != 0)
mysslport = port;
sock = hydra_connect_ssl(ip, mysslport, hostname);
port = mysslport;
}
if (sock < 0) {
if (verbose || debug)
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
hydra_child_exit(1);
}
next_run = 2;
break;
case 2: /* run the cracking function */
next_run = start_rpcap(sock, ip, port, options, miscptr, fp);
break;
case 3: /* clean exit */
if (sock >= 0)
sock = hydra_disconnect(sock);
hydra_child_exit(0);
break;
default:
hydra_report(stderr, "[ERROR] Caught unknown return code, exiting!\n");
hydra_child_exit(2);
}
run = next_run;
}
}
int32_t service_rpcap_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, performed once only.
// return codes:
// 0 - rpcap with authentication
// 1 - rpcap error or no need of authentication
int32_t sock = -1;
int32_t myport = PORT_RPCAP, mysslport = PORT_RPCAP_SSL;
char buffer[] = "\x00\x08\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00";
hydra_register_socket(sp);
if ((options & OPTION_SSL) == 0) {
if (port != 0)
myport = port;
sock = hydra_connect_tcp(ip, myport);
port = myport;
} else {
if (port != 0)
mysslport = port;
sock = hydra_connect_ssl(ip, mysslport, hostname);
port = mysslport;
}
if (sock < 0) {
hydra_report(stderr, "[ERROR] Can not connect to port %d on the target\n", myport);
hydra_child_exit(1);
}
if (hydra_send(sock, buffer, 16, 0) < 0) {
return 1;
}
buf = hydra_receive_line(sock);
if (strstr(buf, "NULL authentication not permitted") == NULL) {
hydra_report(stderr, "[!] rpcap error or no need of authentication!\n");
free(buf);
return 1;
}
free(buf);
sock = hydra_disconnect(sock);
return 0;
}
+36 -39
View File
@@ -11,12 +11,11 @@ no memleaks found on 110425
*/
extern char *HYDRA_EXIT;
char *buf;
int start_rsh(int s, char *ip, int port, unsigned char options, char *miscptr, FILE * fp) {
int32_t start_rsh(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
char *empty = "";
char *login, buffer[300] = "", buffer2[100], *bptr = buffer2;
int ret;
int32_t ret;
if (strlen(login = hydra_get_next_login()) == 0)
login = empty;
@@ -37,13 +36,11 @@ int start_rsh(int s, char *ip, int port, unsigned char options, char *miscptr, F
}
buffer[0] = 0;
if ((ret = hydra_recv(s, buffer, sizeof(buffer) - 1)) >= 0)
if ((ret = hydra_recv(s, buffer, sizeof(buffer) - 1)) > 0)
buffer[ret] = 0;
else /* 0x00 is sent but hydra_recv transformed it */
if ((ret = hydra_recv(s, buffer, sizeof(buffer) - 1)) > 0)
buffer[ret] = 0;
/* 0x00 is sent but hydra_recv transformed it */
if (strlen(buffer) == 0)
ret = hydra_recv(s, buffer, sizeof(buffer) - 1);
if (ret >= 0)
buffer[ret] = 0;
#ifdef HAVE_PCRE
if (ret > 0 && (!hydra_string_match(buffer, "\\s(failure|incorrect|denied)"))) {
#else
@@ -60,9 +57,9 @@ int start_rsh(int s, char *ip, int port, unsigned char options, char *miscptr, F
return 1;
}
void service_rsh(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int run = 1, next_run = 1, sock = -1;
int myport = PORT_RSH, mysslport = PORT_RSH_SSL;
void service_rsh(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
int32_t run = 1, next_run = 1, sock = -1;
int32_t myport = PORT_RSH, mysslport = PORT_RSH_SSL;
hydra_register_socket(sp);
@@ -71,34 +68,34 @@ void service_rsh(char *ip, int sp, unsigned char options, char *miscptr, FILE *
while (1) {
next_run = 0;
switch (run) {
case 1: /* connect and service init function */
{
hydra_set_srcport(1023);
if (sock >= 0)
sock = hydra_disconnect(sock);
// sleepn(275);
if ((options & OPTION_SSL) == 0) {
if (port != 0)
myport = port;
sock = hydra_connect_tcp(ip, myport);
port = myport;
} else {
if (port != 0)
mysslport = port;
sock = hydra_connect_ssl(ip, mysslport, hostname);
port = mysslport;
}
if (sock < 0) {
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int) getpid());
hydra_child_exit(1);
}
next_run = 2;
break;
case 1: /* connect and service init function */
{
hydra_set_srcport(1023);
if (sock >= 0)
sock = hydra_disconnect(sock);
// usleepn(275);
if ((options & OPTION_SSL) == 0) {
if (port != 0)
myport = port;
sock = hydra_connect_tcp(ip, myport);
port = myport;
} else {
if (port != 0)
mysslport = port;
sock = hydra_connect_ssl(ip, mysslport, hostname);
port = mysslport;
}
case 2: /* run the cracking function */
if (sock < 0) {
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
hydra_child_exit(1);
}
next_run = 2;
break;
}
case 2: /* run the cracking function */
next_run = start_rsh(sock, ip, port, options, miscptr, fp);
break;
case 3: /* clean exit */
case 3: /* clean exit */
if (sock >= 0)
sock = hydra_disconnect(sock);
hydra_child_exit(0);
@@ -111,13 +108,13 @@ void service_rsh(char *ip, int sp, unsigned char options, char *miscptr, FILE *
}
}
int service_rsh_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int32_t service_rsh_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
//
// fill if needed.
//
//
// return codes:
// 0 all OK
// -1 error, hydra will exit, so print a good error message here
+65 -68
View File
@@ -6,18 +6,16 @@
//
//
#include <stdio.h>
#include "hydra-mod.h"
#include <string.h>
#include "sasl.h"
#include <stdio.h>
#include <string.h>
extern char *HYDRA_EXIT;
char *buf;
char packet[500];
char packet2[500];
int is_Unauthorized(char *s) {
int32_t is_Unauthorized(char *s) {
if (strstr(s, "401 Unauthorized") != NULL) {
return 1;
} else {
@@ -25,8 +23,7 @@ int is_Unauthorized(char *s) {
}
}
int is_NotFound(char *s) {
int32_t is_NotFound(char *s) {
if (strstr(s, "404 Stream Not Found") != NULL) {
return 1;
} else {
@@ -34,8 +31,7 @@ int is_NotFound(char *s) {
}
}
int is_Authorized(char *s) {
int32_t is_Authorized(char *s) {
if (strstr(s, "200 OK") != NULL) {
return 1;
} else {
@@ -43,8 +39,7 @@ int is_Authorized(char *s) {
}
}
int use_Basic_Auth(char *s) {
int32_t use_Basic_Auth(char *s) {
if (strstr(s, "WWW-Authenticate: Basic") != NULL) {
return 1;
} else {
@@ -52,8 +47,7 @@ int use_Basic_Auth(char *s) {
}
}
int use_Digest_Auth(char *s) {
int32_t use_Digest_Auth(char *s) {
if (strstr(s, "WWW-Authenticate: Digest") != NULL) {
return 1;
} else {
@@ -61,11 +55,7 @@ int use_Digest_Auth(char *s) {
}
}
void create_core_packet(int control, char *ip, int port) {
char buffer[500];
void create_core_packet(int32_t control, char *ip, int32_t port) {
char *target = hydra_address2string(ip);
if (control == 0) {
@@ -78,12 +68,14 @@ void create_core_packet(int control, char *ip, int port) {
}
}
}
int start_rtsp(int s, char *ip, int port, unsigned char options, char *miscptr, FILE * fp) {
int32_t start_rtsp(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
char *empty = "";
char *login, *pass, buffer[500], buffer2[500];
char *login, *pass, buffer[1030], buffer2[500];
char *lresp;
memset(buffer, 0, sizeof(buffer));
memset(buffer2, 0, sizeof(buffer2));
if (strlen(login = hydra_get_next_login()) == 0)
login = empty;
if (strlen(pass = hydra_get_next_password()) == 0)
@@ -97,58 +89,62 @@ int start_rtsp(int s, char *ip, int port, unsigned char options, char *miscptr,
lresp = hydra_receive_line(s);
if (lresp == NULL) {
fprintf(stderr, "[ERROR] no server reply");
hydra_report(stderr, "[ERROR] no server reply\n");
return 1;
}
if (is_NotFound(lresp)) {
printf("[INFO] Server does not need credentials\n");
free(lresp);
hydra_report(stderr, "[INFO] Server does not need credentials\n");
hydra_completed_pair_found();
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0) {
return 3;
}
return 1;
} else {
create_core_packet(1, ip, port);
if (use_Basic_Auth(lresp) == 1) {
free(lresp);
sprintf(buffer2, "%.249s:%.249s", login, pass);
hydra_tobase64((unsigned char *)buffer2, strlen(buffer2), sizeof(buffer2));
sprintf(buffer2, "%.260s:%.260s", login, pass);
hydra_tobase64((unsigned char *) buffer2, strlen(buffer2), sizeof(buffer2));
sprintf(buffer, "%sAuthorization: : Basic %s\r\n\r\n", packet2, buffer2);
sprintf(buffer, "%.500sAuthorization: : Basic %.500s\r\n\r\n", packet2, buffer2);
if (debug) {
hydra_report(stderr, "C:%s\n", buffer);
}
} else {
if (use_Digest_Auth(lresp) == 1) {
char aux[500] = "", dbuf[500] = "", *result = NULL;
char *pbuffer = hydra_strcasestr(lresp, "WWW-Authenticate: Digest ");
strncpy(aux, pbuffer + strlen("WWW-Authenticate: Digest "), sizeof(aux));
aux[sizeof(aux) - 1] = '\0';
free(lresp);
#ifdef LIBOPENSSL
result = sasl_digest_md5(dbuf, login, pass, aux, miscptr, "rtsp", hydra_address2string(ip), port, "");
#else
hydra_report(stderr, "[ERROR] Digest auth required but compiled "
"without OpenSSL/MD5 support\n");
return 3;
#endif
if (result == NULL) {
hydra_report(stderr, "[ERROR] digest generation failed\n");
return 3;
}
sprintf(buffer, "%.500sAuthorization: Digest %.500s\r\n\r\n", packet2, dbuf);
if (debug) {
hydra_report(stderr, "C:%s\n", buffer);
}
}
}
if (use_Digest_Auth(lresp) == 1) {
char *dbuf;
char dbuffer[500] = "";
char aux[500] = "";
char *pbuffer = hydra_strcasestr(lresp, "WWW-Authenticate: Digest ");
strncpy(aux, pbuffer + strlen("WWW-Authenticate: Digest "), sizeof(buffer));
aux[sizeof(aux) - 1] = '\0';
#ifdef LIBOPENSSL
sasl_digest_md5(dbuf, login, pass, aux, miscptr, "rtsp", hydra_address2string(ip), port, "");
#else
printf("[ERROR] Digest auth required but compiled without OpenSSL/MD5 support\n");
return 3;
#endif
if (dbuf == NULL) {
fprintf(stderr, "[ERROR] digest generation failed\n");
return 3;
}
sprintf(buffer, "%sAuthorization: Digest %s\r\n\r\n", packet2, dbuf);
if (debug) {
hydra_report(stderr, "C:%s\n", buffer);
}
if (strlen(buffer) == 0) {
hydra_report(stderr, "[ERROR] could not identify HTTP authentication used\n");
return 1;
}
if (hydra_send(s, buffer, strlen(buffer), 0) < 0) {
@@ -156,34 +152,36 @@ int start_rtsp(int s, char *ip, int port, unsigned char options, char *miscptr,
}
lresp = NULL;
lresp = hydra_receive_line(s);
if ((is_NotFound(lresp))) {
if (lresp == NULL) {
hydra_report(stderr, "[ERROR] no server reply\n");
return 1;
}
if ((is_NotFound(lresp))) {
free(lresp);
hydra_completed_pair_found();
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0) {
return 3;
}
return 1;
}
free(lresp);
hydra_completed_pair();
}
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return 3;
//not rechead
// not rechead
return 2;
}
void service_rtsp(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int run = 1, next_run = 1, sock = -1;
int myport = PORT_RTSP, mysslport = PORT_RTSP_SSL;
char *ptr, *ptr2;
void service_rtsp(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
int32_t run = 1, next_run = 1, sock = -1;
int32_t myport = PORT_RTSP /*, mysslport = PORT_RTSP_SSL*/;
hydra_register_socket(sp);
@@ -191,9 +189,8 @@ void service_rtsp(char *ip, int sp, unsigned char options, char *miscptr, FILE *
return;
while (1) {
switch (run) {
case 1: /* connect and service init function */
case 1: /* connect and service init function */
if (sock >= 0) {
sock = hydra_disconnect(sock);
}
@@ -206,16 +203,16 @@ void service_rtsp(char *ip, int sp, unsigned char options, char *miscptr, FILE *
}
if (sock < 0) {
if (verbose || debug)
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int) getpid());
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
hydra_child_exit(1);
}
next_run = 2;
break;
case 2: /* run the cracking function */
case 2: /* run the cracking function */
next_run = start_rtsp(sock, ip, port, options, miscptr, fp);
break;
case 3: /* clean exit */
case 3: /* clean exit */
if (sock >= 0) {
sock = hydra_disconnect(sock);
}
@@ -229,7 +226,7 @@ void service_rtsp(char *ip, int sp, unsigned char options, char *miscptr, FILE *
}
}
int service_rtsp_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int32_t service_rtsp_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
+45 -30
View File
@@ -1,4 +1,5 @@
// submitted by Alexander Timorin <ATimorin@ptsecurity.com> and Sergey Gordeychik
// submitted by Alexander Timorin <ATimorin@ptsecurity.com> and Sergey
// Gordeychik
#include "hydra-mod.h"
@@ -6,22 +7,30 @@
extern char *HYDRA_EXIT;
unsigned char p_cotp[] = "\x03\x00\x00\x16\x11\xe0\x00\x00\x00\x17" "\x00\xc1\x02\x01\x00\xc2\x02\x01\x02\xc0" "\x01\x0a";
unsigned char p_cotp[] = "\x03\x00\x00\x16\x11\xe0\x00\x00\x00\x17"
"\x00\xc1\x02\x01\x00\xc2\x02\x01\x02\xc0"
"\x01\x0a";
unsigned char p_s7_negotiate_pdu[] = "\x03\x00\x00\x19\x02\xf0\x80\x32\x01\x00" "\x00\x02\x00\x00\x08\x00\x00\xf0\x00\x00" "\x01\x00\x01\x01\xe0";
unsigned char p_s7_negotiate_pdu[] = "\x03\x00\x00\x19\x02\xf0\x80\x32\x01\x00"
"\x00\x02\x00\x00\x08\x00\x00\xf0\x00\x00"
"\x01\x00\x01\x01\xe0";
unsigned char p_s7_read_szl[] = "\x03\x00\x00\x21\x02\xf0\x80\x32\x07\x00" "\x00\x03\x00\x00\x08\x00\x08\x00\x01\x12" "\x04\x11\x44\x01\x00\xff\x09\x00\x04\x01" "\x32\x00\x04";
unsigned char p_s7_read_szl[] = "\x03\x00\x00\x21\x02\xf0\x80\x32\x07\x00"
"\x00\x03\x00\x00\x08\x00\x08\x00\x01\x12"
"\x04\x11\x44\x01\x00\xff\x09\x00\x04\x01"
"\x32\x00\x04";
unsigned char p_s7_password_request[] = "\x03\x00\x00\x25\x02\xf0\x80\x32\x07\x00" "\x00\x00\x00\x00\x08\x00\x0c\x00\x01\x12" "\x04\x11\x45\x01\x00\xff\x09\x00\x08";
unsigned char p_s7_password_request[] = "\x03\x00\x00\x25\x02\xf0\x80\x32\x07\x00"
"\x00\x00\x00\x00\x08\x00\x0c\x00\x01\x12"
"\x04\x11\x45\x01\x00\xff\x09\x00\x08";
int start_s7_300(int s, char *ip, int port, unsigned char options, char *miscptr, FILE * fp) {
int32_t start_s7_300(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
char *empty = "";
char *pass, buffer[1024];
char context[S7PASSLEN + 1];
unsigned char encoded_password[S7PASSLEN];
char *spaces = " ";
int ret = -1;
int32_t ret = -1;
if (strlen(pass = hydra_get_next_password()) == 0)
pass = empty;
@@ -38,14 +47,14 @@ int start_s7_300(int s, char *ip, int port, unsigned char options, char *miscptr
// encode password
encoded_password[0] = context[0] ^ 0x55;
encoded_password[1] = context[1] ^ 0x55;
int i;
int32_t i;
for (i = 2; i < S7PASSLEN; i++) {
encoded_password[i] = context[i] ^ encoded_password[i - 2] ^ 0x55;
}
// send p_cotp and check first 2 bytes of answer
if (hydra_send(s, (char *) p_cotp, 22, 0) < 0)
if (hydra_send(s, (char *)p_cotp, 22, 0) < 0)
return 1;
memset(buffer, 0, sizeof(buffer));
ret = hydra_recv_nb(s, buffer, sizeof(buffer));
@@ -57,7 +66,7 @@ int start_s7_300(int s, char *ip, int port, unsigned char options, char *miscptr
return 3;
// send p_s7_negotiate_pdu and check first 2 bytes of answer
if (hydra_send(s, (char *) p_s7_negotiate_pdu, 25, 0) < 0)
if (hydra_send(s, (char *)p_s7_negotiate_pdu, 25, 0) < 0)
return 1;
memset(buffer, 0, sizeof(buffer));
ret = hydra_recv_nb(s, buffer, sizeof(buffer));
@@ -69,7 +78,7 @@ int start_s7_300(int s, char *ip, int port, unsigned char options, char *miscptr
return 3;
// send p_s7_read_szl and check first 2 bytes of answer
if (hydra_send(s, (char *) p_s7_read_szl, 33, 0) < 0)
if (hydra_send(s, (char *)p_s7_read_szl, 33, 0) < 0)
return 1;
memset(buffer, 0, sizeof(buffer));
ret = hydra_recv_nb(s, buffer, sizeof(buffer));
@@ -108,7 +117,7 @@ int start_s7_300(int s, char *ip, int port, unsigned char options, char *miscptr
}
if (buffer[27] == '\xd6' && buffer[28] == '\x05') {
//hydra_report_found_host(port, ip, "s7-300", fp);
// hydra_report_found_host(port, ip, "s7-300", fp);
hydra_completed_pair_found();
hydra_report(stderr, "[INFO] No password protection enabled\n");
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
@@ -124,9 +133,9 @@ int start_s7_300(int s, char *ip, int port, unsigned char options, char *miscptr
return 1;
}
void service_s7_300(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int run = 1, next_run = 1, sock = -1;
int s7port = PORT_S7_300;
void service_s7_300(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
int32_t run = 1, next_run = 1, sock = -1;
int32_t s7port = PORT_S7_300;
if (port != 0)
s7port = port;
@@ -136,21 +145,21 @@ void service_s7_300(char *ip, int sp, unsigned char options, char *miscptr, FILE
return;
while (1) {
switch (run) {
case 1: /* connect and service init function */
case 1: /* connect and service init function */
sock = hydra_connect_tcp(ip, s7port);
if (sock < 0) {
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int) getpid());
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
hydra_child_exit(1);
}
next_run = start_s7_300(sock, ip, s7port, options, miscptr, fp);
sock = hydra_disconnect(sock);
break;
case 2: /* clean exit */
case 2: /* clean exit */
if (sock >= 0)
sock = hydra_disconnect(sock);
hydra_child_exit(0);
return;
case 3: /* clean exit */
case 3: /* clean exit */
if (sock >= 0)
sock = hydra_disconnect(sock);
hydra_child_exit(2);
@@ -163,27 +172,27 @@ void service_s7_300(char *ip, int sp, unsigned char options, char *miscptr, FILE
}
}
int service_s7_300_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int32_t service_s7_300_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
//
// fill if needed.
//
//
// return codes:
// 0 all OK
// 1 skip target without generating an error
// 2 skip target because of protocol problems
// 3 skip target because its unreachable
int sock = -1;
int s7port = PORT_S7_300;
int32_t sock = -1;
int32_t s7port = PORT_S7_300;
char *empty = "";
char *pass, buffer[1024];
char context[S7PASSLEN + 1];
unsigned char encoded_password[S7PASSLEN];
char *spaces = " ";
int ret = -1;
int i;
int32_t ret = -1;
int32_t i;
if (port != 0)
s7port = port;
@@ -211,7 +220,7 @@ int service_s7_300_init(char *ip, int sp, unsigned char options, char *miscptr,
}
// send p_cotp and check first 2 bytes of answer
if (hydra_send(sock, (char *) p_cotp, 22, 0) < 0) {
if (hydra_send(sock, (char *)p_cotp, 22, 0) < 0) {
fprintf(stderr, "[ERROR] can not send data to service\n");
return 3;
}
@@ -226,7 +235,7 @@ int service_s7_300_init(char *ip, int sp, unsigned char options, char *miscptr,
return 3;
}
// send p_s7_negotiate_pdu and check first 2 bytes of answer
if (hydra_send(sock, (char *) p_s7_negotiate_pdu, 25, 0) < 0) {
if (hydra_send(sock, (char *)p_s7_negotiate_pdu, 25, 0) < 0) {
fprintf(stderr, "[ERROR] can not send data to service (2)\n");
return 3;
}
@@ -241,7 +250,7 @@ int service_s7_300_init(char *ip, int sp, unsigned char options, char *miscptr,
return 3;
}
// send p_s7_read_szl and check first 2 bytes of answer
if (hydra_send(sock, (char *) p_s7_read_szl, 33, 0) < 0) {
if (hydra_send(sock, (char *)p_s7_read_szl, 33, 0) < 0) {
fprintf(stderr, "[ERROR] can not send data to service (3)\n");
return 3;
}
@@ -276,7 +285,8 @@ int service_s7_300_init(char *ip, int sp, unsigned char options, char *miscptr,
// 0xd602 - wrong password
if (ret > 30) {
if ((buffer[27] == '\x00' && buffer[28] == '\x00') || (buffer[27] == '\xd6' && buffer[28] == '\x05')) {
hydra_report(stderr, "[INFO] No password protection enabled, no password tests are necessary!\n");
hydra_report(stderr, "[INFO] No password protection enabled, no password "
"tests are necessary!\n");
return 1;
}
}
@@ -285,3 +295,8 @@ int service_s7_300_init(char *ip, int sp, unsigned char options, char *miscptr,
return 0;
}
void usage_s7_300(const char *service) {
printf("Module S7-300 is for a special Siemens PLC. It either requires only a "
"password or no authentication, so just use the -p or -P option.\n\n");
}
+38 -36
View File
@@ -1,34 +1,33 @@
#include "hydra-mod.h"
// checked for memleaks on 110425, none found
#ifndef LIBSAPR3
void dummy_sapr3() {
printf("\n");
}
void dummy_sapr3() { printf("\n"); }
#else
#include <saprfc.h>
#include <ctype.h>
#include <saprfc.h>
/* temporary workaround fix */
const int *__ctype_tolower;
const int *__ctype_toupper;
const int *__ctype_b;
const int32_t *__ctype_tolower;
const int32_t *__ctype_toupper;
const int32_t *__ctype_b;
extern void flood(); /* for -lm */
extern void flood(); /* for -lm */
extern char *HYDRA_EXIT;
RFC_ERROR_INFO_EX error_info;
int start_sapr3(int s, char *ip, int port, unsigned char options, char *miscptr, FILE * fp) {
int32_t start_sapr3(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
RFC_HANDLE handle;
char *empty = "";
char *login, *pass, buffer[1024];
char *buf;
int i;
int sysnr = port % 100;
int32_t i;
int32_t sysnr = port % 100;
char opts[] = "RFCINI=N RFCTRACE=N BALANCE=N DEBUG=N TRACE=0 ABAP_DEBUG=0";
// char opts[] = "RFCINI=N RFCTRACE=Y BALANCE=N DEBUG=Y TRACE=Y ABAP_DEBUG=Y";
// char opts[] = "RFCINI=N RFCTRACE=Y BALANCE=N DEBUG=Y TRACE=Y
// ABAP_DEBUG=Y";
if (strlen(login = hydra_get_next_login()) == 0)
login = empty;
@@ -37,36 +36,37 @@ int start_sapr3(int s, char *ip, int port, unsigned char options, char *miscptr,
if (strlen(login) > 0)
for (i = 0; i < strlen(login); i++)
login[i] = (char) toupper(login[i]);
login[i] = (char)toupper(login[i]);
if (strlen(pass) > 0)
for (i = 0; i < strlen(pass); i++)
pass[i] = (char) toupper(pass[i]);
pass[i] = (char)toupper(pass[i]);
memset(buffer, 0, sizeof(buffer));
memset(&error_info, 0, sizeof(error_info));
//strcpy(buf, "mvse001");
// strcpy(buf, "mvse001");
snprintf(buffer, sizeof(buffer), "ASHOST=%s SYSNR=%02d CLIENT=%03d USER=\"%s\" PASSWD=\"%s\" LANG=DE %s", hydra_address2string(ip), sysnr, atoi(miscptr), login, pass, opts);
/*
USER=SAPCPIC PASSWORD=admin
USER=SAP* PASSWORD=PASS
/*
USER=SAPCPIC PASSWORD=admin
USER=SAP* PASSWORD=PASS
## do we need these options?
SAPSYS=3 SNC_MODE=N SAPGUI=N INVISIBLE=N GUIATOPEN=Y NRCALL=00001 CLOSE=N
## do we need these options?
SAPSYS=3 SNC_MODE=N SAPGUI=N INVISIBLE=N GUIATOPEN=Y NRCALL=00001 CLOSE=N
ASHOST= // IP
SYSNR= // port - 3200, scale 2
CLIENT= // miscptr, scale 2
ABAP_DEBUG=0
USER=
PASSWD=
LANG=DE
*/
//printf ("DEBUG: %d Connectstring \"%s\"\n",sizeof(error_info),buffer);
ASHOST= // IP
SYSNR= // port - 3200, scale 2
CLIENT= // miscptr, scale 2
ABAP_DEBUG=0
USER=
PASSWD=
LANG=DE
*/
// printf ("DEBUG: %d Connectstring \"%s\"\n",sizeof(error_info),buffer);
handle = RfcOpenEx(buffer, &error_info);
//printf("DEBUG: handle %d, key %s, message %s\n", handle, error_info.key, error_info.message);
// printf("DEBUG: handle %d, key %s, message %s\n", handle, error_info.key,
// error_info.message);
if (handle <= RFC_HANDLE_NULL)
return 3;
@@ -89,20 +89,20 @@ int start_sapr3(int s, char *ip, int port, unsigned char options, char *miscptr,
return 1;
}
void service_sapr3(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int run = 1, next_run = 1, sock = -1;
void service_sapr3(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
int32_t run = 1, next_run = 1, sock = -1;
hydra_register_socket(sp);
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return;
while (1) {
switch (run) {
case 1: /* connect and service init function */
case 1: /* connect and service init function */
next_run = start_sapr3(sock, ip, port, options, miscptr, fp);
break;
case 2:
hydra_child_exit(0);
case 3: /* clean exit */
case 3: /* clean exit */
fprintf(stderr, "[ERROR] could not connect to target port %d\n", port);
hydra_child_exit(1);
case 4:
@@ -117,16 +117,18 @@ void service_sapr3(char *ip, int sp, unsigned char options, char *miscptr, FILE
#endif
int service_sapr3_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int32_t service_sapr3_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
//
// fill if needed.
//
//
// return codes:
// 0 all OK
// -1 error, hydra will exit, so print a good error message here
return 0;
}
void usage_sapr3(const char *service) { printf("Module sapr3 requires the client id, a number between 0 and 99\n\n"); }
+65 -51
View File
@@ -1,56 +1,59 @@
/* simple sip digest auth (md5) module 2009/02/19
/* simple sip digest auth (md5) module 2009/02/19
* written by gh0st 2005
* modified by Jean-Baptiste Aviat <jba [at] hsc [dot] `french tld`> - should
* work now, but only with -T 1
*
* 05042011 david: modified to use sasl lib
*/
#include "hydra-mod.h"
#ifndef LIBOPENSSL
#include <stdio.h>
void dummy_sip() {
printf("\n");
}
void dummy_sip() { printf("\n"); }
#else
#include "sasl.h"
#include "hydra-mod.h"
#include <stdint.h>
extern int hydra_data_ready_timed(int socket, long sec, long usec);
extern int32_t hydra_data_ready_timed(int32_t socket, long sec, long usec);
char external_ip_addr[17] = "";
char *get_iface_ip(unsigned long int ip);
int cseq;
char *get_iface_ip(uint64_t ip);
int32_t cseq;
extern char *HYDRA_EXIT;
#define SIP_MAX_BUF 1024
#define SIP_MAX_BUF 1024
void empty_register(char *buf, char *host, char *lhost, int port, int lport, char *user) {
void empty_register(char *buf, char *host, char *lhost, int32_t port, int32_t lport, char *user) {
memset(buf, 0, SIP_MAX_BUF);
snprintf(buf, SIP_MAX_BUF,
"REGISTER sip:%s SIP/2.0\r\n"
"Via: SIP/2.0/UDP %s:%i\r\n"
"From: <sip:%s@%s>\r\n"
"To: <sip:%s@%s>\r\n" "Call-ID: 1337@%s\r\n" "CSeq: %i REGISTER\r\n" "Content-Length: 0\r\n\r\n", host, lhost, lport, user, host, user, host, host, cseq);
"To: <sip:%s@%s>\r\n"
"Call-ID: 1337@%s\r\n"
"CSeq: %i REGISTER\r\n"
"Content-Length: 0\r\n\r\n",
host, lhost, lport, user, host, user, host, host, cseq);
}
int get_sip_code(char *buf) {
int code;
int32_t get_sip_code(char *buf) {
int32_t code;
char tmpbuf[SIP_MAX_BUF], word[SIP_MAX_BUF];
if (sscanf(buf, "%s %i %s", tmpbuf, &code, word) != 3)
if (sscanf(buf, "%256s %i %256s", tmpbuf, &code, word) != 3)
return -1;
return code;
}
int start_sip(int s, char *ip, char *lip, int port, int lport, unsigned char options, char *miscptr, FILE * fp) {
char *login, *pass, *host, buffer[SIP_MAX_BUF];
int i;
int32_t start_sip(int32_t s, char *ip, char *lip, int32_t port, int32_t lport, unsigned char options, char *miscptr, FILE *fp) {
char *login, *pass, *host, buffer[SIP_MAX_BUF], *result = NULL;
int32_t i;
char buf[SIP_MAX_BUF];
if (strlen(login = hydra_get_next_login()) == 0)
login = NULL;
return 3;
if (strlen(pass = hydra_get_next_password()) == 0)
pass = NULL;
@@ -67,15 +70,15 @@ int start_sip(int s, char *ip, char *lip, int port, int lport, unsigned char opt
return 3;
}
int has_sip_cred = 0;
int try = 0;
int32_t has_sip_cred = 0;
int32_t try = 0;
/* We have to check many times because server may begin to send "100 Trying"
* before "401 Unauthorized" */
while (try < 2 && !has_sip_cred) {
try++;
if (hydra_data_ready_timed(s, 3, 0) > 0) {
i = hydra_recv(s, (char *) buf, sizeof(buf) - 1);
i = hydra_recv(s, (char *)buf, sizeof(buf) - 1);
if (i > 0)
buf[i] = '\0';
if (strncmp(buf, "SIP/2.0 404", 11) == 0) {
@@ -84,21 +87,25 @@ int start_sip(int s, char *ip, char *lip, int port, int lport, unsigned char opt
}
if (strncmp(buf, "SIP/2.0 606", 11) == 0) {
char *ptr = NULL;
int i = 0;
int32_t i = 0;
// if we already tried to connect, exit
if (external_ip_addr[0]) {
hydra_report(stdout, "[ERROR] Get error code 606 : session is not acceptable by the server\n");
hydra_report(stdout, "[ERROR] Get error code 606 : session is not "
"acceptable by the server\n");
return 2;
}
if (verbose)
hydra_report(stdout, "[VERBOSE] Get error code 606 : session is not acceptable by the server,\n"
"maybe it's an addressing issue as you are using NAT, trying to reconnect\n" "using addr from the server reply\n");
/*
SIP/2.0 606 Not Acceptable
Via: SIP/2.0/UDP 192.168.0.21:46759;received=82.227.229.137
*/
hydra_report(stdout, "[VERBOSE] Get error code 606 : session is not "
"acceptable by the server,\n"
"maybe it's an addressing issue as you are "
"using NAT, trying to reconnect\n"
"using addr from the server reply\n");
/*
SIP/2.0 606 Not Acceptable
Via: SIP/2.0/UDP 192.168.0.21:46759;received=82.227.229.137
*/
#ifdef HAVE_PCRE
if (hydra_string_match(buf, "Via: SIP.*received=")) {
ptr = strstr(buf, "received=");
@@ -129,7 +136,9 @@ int start_sip(int s, char *ip, char *lip, int port, int lport, unsigned char opt
hydra_report(stderr, "[INFO] S: %s\n", buf);
char buffer2[512];
sasl_digest_md5(buffer2, login, pass, strstr(buf, "WWW-Authenticate: Digest") + strlen("WWW-Authenticate: Digest") + 1, host, "sip", NULL, 0, NULL);
result = sasl_digest_md5(buffer2, login, pass, strstr(buf, "WWW-Authenticate: Digest") + strlen("WWW-Authenticate: Digest") + 1, host, "sip", NULL, 0, NULL);
if (result == NULL)
return 3;
memset(buffer, 0, SIP_MAX_BUF);
snprintf(buffer, SIP_MAX_BUF,
@@ -137,7 +146,11 @@ int start_sip(int s, char *ip, char *lip, int port, int lport, unsigned char opt
"Via: SIP/2.0/UDP %s:%i\n"
"From: <sip:%s@%s>\n"
"To: <sip:%s@%s>\n"
"Call-ID: 1337@%s\n" "CSeq: %i REGISTER\n" "Authorization: Digest %s\n" "Content-Length: 0\n\n", host, lip, lport, login, host, login, host, host, cseq, buffer2);
"Call-ID: 1337@%s\n"
"CSeq: %i REGISTER\n"
"Authorization: Digest %s\n"
"Content-Length: 0\n\n",
host, lip, lport, login, host, login, host, host, cseq, buffer2);
cseq++;
if (debug)
@@ -146,14 +159,14 @@ int start_sip(int s, char *ip, char *lip, int port, int lport, unsigned char opt
return 3;
}
try = 0;
int has_resp = 0;
int sip_code = 0;
int32_t has_resp = 0;
int32_t sip_code = 0;
while (try < 2 && !has_resp) {
try++;
if (hydra_data_ready_timed(s, 5, 0) > 0) {
memset(buf, 0, sizeof(buf));
if ((i = hydra_recv(s, (char *) buf, sizeof(buf) - 1)) >= 0)
if ((i = hydra_recv(s, (char *)buf, sizeof(buf) - 1)) >= 0)
buf[i] = 0;
if (debug)
hydra_report(stderr, "[INFO] S: %s\n", buf);
@@ -176,24 +189,25 @@ int start_sip(int s, char *ip, char *lip, int port, int lport, unsigned char opt
return 1;
}
void service_sip(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int run = 1, next_run = 1, sock = -1;
int myport = PORT_SIP, mysslport = PORT_SIP_SSL;
void service_sip(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
int32_t run = 1, next_run = 1, sock = -1;
int32_t myport = PORT_SIP, mysslport = PORT_SIP_SSL;
char *lip = get_iface_ip((int) *(&ip[1]));
char *lip = get_iface_ip((int32_t) * (&ip[1]));
hydra_register_socket(sp);
// FIXME IPV6
if (ip[0] != 4) {
fprintf(stderr, "[ERROR] sip module is not ipv6 enabled yet, patches are appreciated.\n");
fprintf(stderr, "[ERROR] sip module is not ipv6 enabled yet, patches are "
"appreciated.\n");
hydra_child_exit(2);
}
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
run = 3;
int lport = 0;
int32_t lport = 0;
while (1) {
switch (run) {
@@ -218,7 +232,7 @@ void service_sip(char *ip, int sp, unsigned char options, char *miscptr, FILE *
if (sock < 0) {
if (verbose || debug)
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int) getpid());
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
free(lip);
hydra_child_exit(1);
}
@@ -246,8 +260,8 @@ void service_sip(char *ip, int sp, unsigned char options, char *miscptr, FILE *
}
}
char *get_iface_ip(unsigned long int ip) {
int sfd;
char *get_iface_ip(uint64_t ip) {
int32_t sfd;
sfd = socket(AF_INET, SOCK_DGRAM, 0);
@@ -257,15 +271,15 @@ char *get_iface_ip(unsigned long int ip) {
tparamet.sin_port = htons(2000);
tparamet.sin_addr.s_addr = ip;
if (connect(sfd, (const struct sockaddr *) &tparamet, sizeof(struct sockaddr_in))) {
if (connect(sfd, (const struct sockaddr *)&tparamet, sizeof(struct sockaddr_in))) {
perror("connect");
close(sfd);
return NULL;
}
struct sockaddr_in *local = malloc(sizeof(struct sockaddr_in));
int size = sizeof(struct sockaddr_in);
int32_t size = sizeof(struct sockaddr_in);
if (getsockname(sfd, (void *) local, (socklen_t *) & size)) {
if (getsockname(sfd, (void *)local, (socklen_t *)&size)) {
perror("getsockname");
close(sfd);
free(local);
@@ -275,7 +289,7 @@ char *get_iface_ip(unsigned long int ip) {
char buff[32];
if (!inet_ntop(AF_INET, (void *) &local->sin_addr, buff, 32)) {
if (!inet_ntop(AF_INET, (void *)&local->sin_addr, buff, 32)) {
perror("inet_ntop");
free(local);
return NULL;
@@ -289,13 +303,13 @@ char *get_iface_ip(unsigned long int ip) {
#endif
int service_sip_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int32_t service_sip_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
//
// fill if needed.
//
//
// return codes:
// 0 all OK
// -1 error, hydra will exit, so print a good error message here

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