metasploit-framework
https://github.com/rapid7/metasploit-framework
Ruby
Metasploit Framework
Msf::Exploit::Remote::Postgres#postgres_upload_binary_data
Writes data to disk on the target server. This is accomplished in 5 steps: 1. Create a new object with "select lo_create(-1)" 2. Delete any resulting rows in pg_largeobject table. On 8.x and older, postgres inserts rows as a result of the call to lo_create. Deleting them here approximates the state on 9.x where no such insert happens. 3. Break the data into LOBLOCKSIZE-byte chunks. 4. Insert each of the chunks as a row in pg_largeobject 5. Select lo_export to write the file to disk
Edit
git clone [email protected]:rapid7/metasploit-framework.git
cd metasploit-framework
open lib/msf/core/exploit/postgres.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-Msf--Exploit--Remote--Postgres-postgres_upload_binary_data-for-pr
# Commit to gitgit add lib/msf/core/exploit/postgres.rbgit commit -m "better docs for Msf::Exploit::Remote::Postgres#postgres_upload_binary_data"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-Msf--Exploit--Remote--Postgres-postgres_upload_binary_data-for-pr
hub pull-request
# Celebrate!