Hi

here is my code:

$av_obj_MAS = Masscan::Scanner->new(); # host given by the command line option $av_obj_MAS->add_host($av_loc_IP); # set the ports given by the command line options $av_obj_MAS->ports(\@av_arr_PORTS); $av_obj_MAS->sudo(1); $av_obj_MAS->verbose(1); # now scan $av_tmp_SCAN = $av_obj_MAS->scan; # if result is available if ($av_tmp_SCAN) { # get result from module - this then seems to be an object $av_obj_SCANRESULT = $av_obj_MAS->scan_results; # # # now I need to fetch the part of scan_results from this object # $av_obj_RESULT = %$av_obj_SCANRESULT{scan_results}; # since the scan_result is an array of values, I need to put it in +to an array @av_arr_SCANRESULT = @{%$av_obj_SCANRESULT{scan_results}}; } # now to process this array of results # this should contain the e.g. the ip-address of the computer scanned +and an array of ports found in what status ever foreach $av_tmp_STRING ( @av_arr_SCANRESULT ) { # print simply the ip-address print %$av_tmp_STRING{ip} . "\n"; # now I need to put the array of ports scanned and reported as an +result into an array @av_arr_RESULTPORTS = @{%$av_tmp_STRING{ports}}; # this array may have several entries for each port scanned # now to process the array and print the results foreach $av_tmp_STRING ( @av_arr_RESULTPORTS ) { print "Port: " . %$av_tmp_STRING{port} . "\n"; print "Status: " . %$av_tmp_STRING{status} . "\n"; } }

I am sure there is a lot of optimization and shortening of commands possible - but one step after another

probably it will help also others struggling with this issue - if some

Regards Kallewirsch

In reply to Re^4: processing a module result by averlon
in thread processing a module result by averlon

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.