Commit Graph

78 Commits

Author SHA1 Message Date
William Vu 6712458dbd Land #12758, attributes and immutable? methods 2020-01-16 14:01:29 -06:00
William Vu 441d6c3532 Add immutable? wrapper around attributes method 2020-01-16 13:25:09 -06:00
Brendan Coles d449a93b44 Add Msf::Post::File.attributes method 2019-12-25 07:34:44 +00:00
Brendan Coles f04cf4f544 Randomize Msf::Post::File _write_file_unix_shell test_str 2019-12-25 05:15:33 +00:00
William Vu 871b295111 Land #12614, post/multi/gather/ssh_creds fixes 2019-12-09 19:59:32 -06:00
Brendan Coles 121a9a52ac Remove Post API crypto methods for local files 2019-12-07 05:12:51 +00:00
MangyCoyote a7e7b9dbf2 post/multi/gather/ssh_creds should verify it has access to a file before reading it 2019-11-21 10:48:42 +01:00
Tim W 3cb9f2d709 remove pointless upload_binary function 2019-10-23 20:28:13 +08:00
Tim W bade8bfc48 add live compiling 2019-09-03 17:31:04 +08:00
Brendan Coles 47a13ea0e8 Modify Post read_file to check if file is readable 2019-02-01 19:44:18 +00:00
William Vu 06de16a36f Merge remote-tracking branch 'upstream/master' into pr/10119 2019-01-15 18:33:48 -06:00
Brendan Coles 2543d60465 Use 'to_s.strip' for Msf::Post::File.pwd output 2019-01-12 08:47:23 +00:00
William Vu bbfac2af1c Fix copypasta typo 2018-09-26 18:46:43 -05:00
William Vu 5444d7a1a5 Update chmod_x_file to chmod 2018-09-26 18:46:42 -05:00
Tim W 896dd13bbe && instead of and 2018-09-26 18:46:42 -05:00
Tim W 4adca52103 create chmod helper function 2018-09-26 18:46:42 -05:00
William Vu 3bc0a821d5 Prefer ye olde TeX-style quotes
This was @bcoles' initial commit. I agree. Looks good with the raise.
2018-09-20 22:54:17 -05:00
William Vu 95e2c388c4 Remove stray quote from raise in writable? method
Didn't break the string but looked funny.
2018-09-20 22:19:18 -05:00
Brendan Coles ea47b6de04 Add writable? method to Msf::Post::File - Fix #10644 2018-09-15 06:29:24 +00:00
AlbertoCoding 5b60a91b66 Style and code optimization changes 2018-07-12 13:54:47 +02:00
AlbertoCoding be1ea1549e Post-exploitation API improvements and pseudo_shell module added 2018-06-19 12:39:41 +02:00
Adam Cammack 5cafd8908e Always return empty file on EOF meterpreter read 2018-05-30 15:26:34 -05:00
William Vu 18b8fc2e0e Add Msf::Post::File#setuid? 2018-01-23 02:05:26 -06:00
William Vu d7c826b5e8 Add rm_rf to Post::File 2018-01-03 23:14:21 -06:00
Brent Cook f69b4a330e handle Ruby 2.4 Fixnum/Bignum -> Integer deprecations 2017-01-22 10:20:03 -06:00
OJ 0737d7ca12 Tidy code, remove regex and use comparison for platform checks 2016-10-29 13:41:20 +10:00
Brent Cook 194a84c793 Modify stdapi so it also uses exist? over exists? for ruby parity
Also add an alias for backward compatibility.
2016-04-23 17:31:22 -04:00
Brent Cook 57ab974737 File.exists? must die 2016-04-21 00:47:07 -04:00
Brent Cook f2edf21b9d fix MSF::Post::File::rename_file with meterpreter
Modify rename_file to fit the pattern of the other file methods.
Otherwise, calling this yields a backtrace in the logs and it fails.

Steps to verify:
rc script:
```
loadpath test/modules
use exploit/multi/handler
set lhost 172.28.128.1
set lport 8081
set payload windows/meterpreter/reverse_http
run -j
sleep 5
resource test/scripts/test-sessions.rc

Before:
```
[-] FAILED: should move files
[-] Exception: TypeError : true is not a symbol

log file:
[01/27/2015 13:17:23] [d(0)] core: Call stack:
/home/bcook/projects/metasploit-framework/lib/msf/core/post/file.rb:357:in
`rename_file'
/home/bcook/projects/metasploit-framework/test/modules/post/test/file.rb:115:in
`block in test_file'
/home/bcook/projects/metasploit-framework/test/lib/module_test.rb:26:in
`call'
/home/bcook/projects/metasploit-framework/test/lib/module_test.rb:26:in
`it'
...
```

After, passing sessions instead:
```
post/test/file
SESSION => 1
Setup: changing working directory to %TEMP%
[*] Running against session 1
[*] Session type is meterpreter and platform is x86/win32
[+] should test for file existence
[+] should test for directory existence
[+] should create text files
[+] should read the text we just wrote
[+] should append text files
[+] should delete text files
[+] should move files
[+] should write binary data
[+] should read the binary data we just wrote
[+] should delete binary files
[+] should append binary data
[*] Passed: 11; Failed: 0
```
2015-01-27 13:19:33 -06:00
Brent Cook 05279ef02a consistently use double-quoted paths
allow for variable expansion if needed
2015-01-08 16:10:28 -06:00
Meatballs dd5c638ab0 Merge remote-tracking branch 'upstream/master' into extapi_service_post 2015-01-05 22:18:44 +00:00
Spencer McIntyre 698ca2639b Do not delete files that do not exist in rm_f 2014-12-17 09:18:06 -05:00
jvazquez-r7 cc8b37d619 Make directory mandatory 2014-11-17 12:15:33 -06:00
jvazquez-r7 15b7435c34 Make it YARD compliant documentation 2014-11-17 12:03:37 -06:00
Jon Hart cd32f00ebc Add dir doc 2014-11-17 09:15:08 -08:00
Jon Hart 98db8b5ad9 When not a meterpreter session, split dir/ls output to match meterpreter entries output 2014-11-17 09:10:03 -08:00
Jon Hart 5f1a1f8ed3 Use dir for Windows only, ls for the rest 2014-11-17 09:01:14 -08:00
Jon Hart 6519b0e2cb Add dir and ls to Msf::Post::File 2014-11-17 09:01:14 -08:00
James Lee 4c557a1401 Add Post::Windows::Services#each_service
Also cleans up some style issues and adds yardoc comments for some stuff
in Post::File

Note that windows/local/service_permissions is still using
`service_list` because it now builds a Rex::Table, which has to have
all the data up front, anyway.
2014-02-18 18:24:23 -06:00
James Lee 684c45a5ff Merge remote-tracking branch 'upstream/pr/2766' into merge-2766 2014-02-18 17:36:13 -06:00
Meatballs 4a0f37dc21 Save lost changes 2014-02-10 23:24:26 +00:00
Meatballs 08493f2670 Merge remote-tracking branch 'upstream/master' into upgrade_psh
Conflicts:
	lib/msf/core/post/file.rb
2014-02-03 18:02:09 +00:00
sinn3r 0d02f6d589 Add support for win shells for file? 2014-02-02 23:37:26 -06:00
Meatballs 95eb758642 Initial commit 2014-02-02 19:04:38 +00:00
Meatballs d71e67e5f4 Rename file should return some indication of success 2013-12-15 03:28:28 +00:00
Tab Assassin 7e5e0f7fc8 Retab lib 2013-08-30 16:28:33 -05:00
James Lee 31ad7b50a9 Fix write_file on FreeBSD
[SeeRM #8083]
2013-06-25 17:19:00 -05:00
James Lee cd86a69090 Have Post::File use shiny new session.fs.file.mv
Also adds a quick and dirty test. Verified working on Linux shell, Linux
meterpreter, and Windows x86 and x64 meterpreter.
2013-04-05 01:24:24 -05:00
James Lee 16a0ab1933 Fix comment link and some whitespace 2013-02-07 18:37:11 -06:00
sinn3r 40b2c04c36 Add a redmine link 2012-10-05 00:53:23 -05:00