{"id":59323,"date":"2024-09-01T01:50:31","date_gmt":"2024-08-31T22:50:31","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/180924\/afp_server_info.rb.txt"},"modified":"2024-09-01T01:50:31","modified_gmt":"2024-08-31T22:50:31","slug":"apple-filing-protocol-info-enumerator","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/apple-filing-protocol-info-enumerator\/","title":{"rendered":"Apple Filing Protocol Info Enumerator"},"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>class MetasploitModule &lt; Msf::Auxiliary<br \/>include Msf::Auxiliary::Report<br \/>include Msf::Auxiliary::Scanner<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 Info Enumerator&#8217;,<br \/>&#8216;Description&#8217; =&gt; %q{<br \/>This module fetches AFP server information, including server name,<br \/>network address, supported AFP versions, signature, machine type,<br \/>and server flags.<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;Author&#8217; =&gt; [ &#8216;Gregory Man &lt;man.gregory[at]gmail.com&gt;&#8217; ],<br \/>&#8216;License&#8217; =&gt; MSF_LICENSE<br \/>))<br \/>end<\/p>\n<p>def run_host(ip)<br \/>print_status(&#8220;AFP #{ip} Scanning&#8230;&#8221;)<br \/>begin<br \/>connect<br \/>response = get_info<br \/>report(response)<br \/>rescue ::Timeout::Error<br \/>rescue ::Interrupt<br \/>raise $!<br \/>rescue ::Rex::ConnectionError, ::IOError, ::Errno::ECONNRESET, ::Errno::ENOPROTOOPT<br \/>rescue ::Exception<br \/>raise $!<br \/>print_error(&#8220;AFP #{rhost}:#{rport} #{$!.class} #{$!}&#8221;)<br \/>ensure<br \/>disconnect<br \/>end<br \/>end<\/p>\n<p>def report(response)<br \/>report_info = &#8220;AFP #{rhost}:#{rport} Server Name: #{response[:server_name]} \\n&#8221; +<br \/>&#8220;AFP #{rhost}:#{rport} Server Flags: \\n&#8221; +<br \/>format_flags_report(response[:server_flags]) +<br \/>&#8220;AFP #{rhost}:#{rport} Machine Type: #{response[:machine_type]} \\n&#8221; +<br \/>&#8220;AFP #{rhost}:#{rport} AFP Versions: #{response[:versions].join(&#8216;, &#8216;)} \\n&#8221; +<br \/>&#8220;AFP #{rhost}:#{rport} UAMs: #{response[:uams].join(&#8216;, &#8216;)}\\n&#8221; +<br \/>&#8220;AFP #{rhost}:#{rport} Server Signature: #{response[:signature]}\\n&#8221; +<br \/>&#8220;AFP #{rhost}:#{rport} Server Network Address: \\n&#8221; +<br \/>format_addresses_report(response[:network_addresses]) +<br \/>&#8220;AFP #{rhost}:#{rport} UTF8 Server Name: #{response[:utf8_server_name]}&#8221;<\/p>\n<p>lines = &#8220;AFP #{rhost}:#{rport}:#{rport} AFP:\\n#{report_info}&#8221;<\/p>\n<p>lines.split(\/\\n\/).each do |line|<br \/>print_status(line)<br \/>end<\/p>\n<p>report_note(:host =&gt; datastore[&#8216;RHOST&#8217;],<br \/>:proto =&gt; &#8216;tcp&#8217;,<br \/>:port =&gt; datastore[&#8216;RPORT&#8217;],<br \/>:type =&gt; &#8216;afp_server_info&#8217;,<br \/>:data =&gt; response)<\/p>\n<p>report_service(<br \/>:host =&gt; datastore[&#8216;RHOST&#8217;],<br \/>:port =&gt; datastore[&#8216;RPORT&#8217;],<br \/>:proto =&gt; &#8216;tcp&#8217;,<br \/>:name =&gt; &#8220;afp&#8221;,<br \/>:info =&gt; &#8220;AFP name: #{response[:utf8_server_name]}, Versions: #{response[:versions].join(&#8216;, &#8216;)}&#8221;<br \/>)<\/p>\n<p>end<\/p>\n<p>def format_flags_report(parsed_flags)<br \/>report = &#8221;<br \/>parsed_flags.each do |flag, val|<br \/>report &lt;&lt; &#8220;AFP #{rhost}:#{rport} * #{flag}: #{val.to_s} \\n&#8221;<br \/>end<br \/>return report<br \/>end<\/p>\n<p>def format_addresses_report(parsed_network_addresses)<br \/>report = &#8221;<br \/>parsed_network_addresses.each do |val|<br \/>report &lt;&lt; &#8220;AFP #{rhost}:#{rport} * #{val.to_s} \\n&#8221;<br \/>end<br \/>return report<br \/>end<br \/>end<\/p>\n","protected":false},"excerpt":{"rendered":"<p>### This module requires Metasploit: https:\/\/metasploit.com\/download# Current source: https:\/\/github.com\/rapid7\/metasploit-framework## class MetasploitModule &lt; Msf::Auxiliaryinclude Msf::Auxiliary::Reportinclude Msf::Auxiliary::Scannerinclude Msf::Exploit::Remote::AFP def initialize(info={})super(update_info(info,&#8216;Name&#8217; =&gt; &#8216;Apple Filing Protocol Info Enumerator&#8217;,&#8216;Description&#8217; =&gt; %q{This module fetches AFP server information, including server name,network address, supported AFP versions, signature, machine type,and server flags.},&#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;Author&#8217; =&gt; [ &#8216;Gregory Man &lt;man.gregory[at]gmail.com&gt;&#8217; ],&#8216;License&#8217; =&gt; MSF_LICENSE))end &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-59323","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59323","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=59323"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59323\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=59323"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=59323"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=59323"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}