hello, im novice in this sphere so i need help
at first sorry for my english.
question - ’ What is the name of the config file that has been created after 2020-03-03 and is smaller than 28k but larger than 25k?’
my answer - ’ find -iname ‘*.conf’ -size +25k -size -28k -newermt 2020-03-03 ’
console output -
find: ‘./dovecot/private’: Permission denied
find: ‘./ssl/private’: Permission denied
find: ‘./polkit-1/localauthority’: Permission denied
I’m pretty new to this, how come you use 2>/dev/null instead of just >/dev/null, I saw that it doesn’t work when I tested it myself. What does the 2 do :?
Its a “file descriptor” number relating to the standard outputs. At a high level there are three outputs:
0 - Standard Input / stdin
1 - Standard Output / stdout
2 - Standard Error / stderr
Using 2>/dev/null pipes any error messages to dev null but shows everything else. If you don’t use the 2, the >/dev/null pipes all output to dev null, which means nothing is returned to the screen.
Found the anwser myself → Forgot the k by the -size flag → find / -type f -name *.conf -size +25k -size -28k -newermt 2020-03-03 -exec ls -al {} ; 2>/dev/null
Hello. I am having a similar problem.
I am firstly unclear if this is to be run on the pwnbox or the target as I get different results for each, however, neither result is correct.
the command I am running is:
find / -type f -name *.config -newermt 2020-03-03 -size +25k -size -28k 2>/dev/null
On the target machine I get nothing back, on the pwnbox I get one file back but when I submit that it is wrong. I should mention I have submitted the file name and the full path for the pwnbox result and both are not accepted.
Disregard please. My session timed out and when I reconnected it worked. This was on the target machine in case anyone else ever has that question.
Tried several renditions listed here and on the section page. I could execute wide parameters, but when I tried to enter the commands listed above, no results would be shown, just a new empty command line
The solution was adding, “2>/dev/null” at the end.
This is a STDERR redirection to the 'null device ', which we will come back to in the next section. This redirection ensures that no errors are displayed in the terminal. This redirection must not be an option of the ‘find’ command.
It appears that you are encountering “Permission denied” errors while running the find command. This is likely because you don’t have the necessary permissions to search certain directories. To avoid these errors and focus your search on files that you do have permission to access, you can modify your command like this:
Replace /path/to/search with the actual directory where you want to search for config files. This will help you avoid searching in directories where you don’t have permission and should provide the desired results.
+25 and -25 vs +25k -25k is a problem i see off the bat. I know this is old, I’m just posting because I spotted it and hope someone stumbling across this thread as I did can benefit.