<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 30, 2013 at 11:27 AM,  <span dir="ltr"><<a href="mailto:tromeo@mdlogix.com" target="_blank">tromeo@mdlogix.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Please help me to debug<br>
<br>
-------<br>
shmid = shmget(SHM_KEY, SHM_SIZE, 0o666)<br>
                                                                   ^<br>
SyntaxError: invalid syntax<br>
<br></blockquote><div>If you google 0o666 python you see that if some version of python need 0666<br><br></div><div>It was unclear to me whether this changed after 2.6.  Does anyone else have experience with this?<br></div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
----<br>
here is the code<br>
Ref: <a href="http://www.welivesecurity.com/2013/04/26/linuxcdorked-new-apache-backdoor-in-the-wild-serves-blackhole/" target="_blank">http://www.welivesecurity.com/2013/04/26/linuxcdorked-new-apache-backdoor-in-the-wild-serves-blackhole/</a><br>

<br>
---<br>
#!/usr/bin/env python<br>
# -*- coding: utf-8 -*-<br>
#<br>
# This script dumps the content of a shared memory block<br>
# used by Linux/Cdorked.A into a file named httpd_cdorked_config.bin<br>
# when the machine is infected.<br>
#<br>
# Some of the data is encrypted. If your server is infected and you<br>
# would like to help, please send the httpd_cdorked_config.bin<br>
# to our lab for analysis. Thanks!<br>
#<br>
# Marc-Etienne M.Léveillé <<a href="mailto:leveille@eset.com">leveille@eset.com</a>><br>
#<br>
<br>
from ctypes import *<br>
<br>
SHM_SIZE = 6118512<br>
SHM_KEY = 63599<br>
<br>
OUTFILE="httpd_cdorked_config.bin"<br>
<br>
try:<br>
  rt = CDLL('librt.so')<br>
except:<br>
  rt = CDLL('librt.so.1')<br>
<br>
shmget = rt.shmget<br>
shmget.argtypes = [c_int, c_size_t, c_int]<br>
shmget.restype = c_int<br>
shmat = rt.shmat<br>
shmat.argtypes = [c_int, POINTER(c_void_p), c_int]<br>
shmat.restype = c_void_p<br>
<br>
shmid = shmget(SHM_KEY, SHM_SIZE, 0o666)<br>
if shmid < 0:<br>
  print "System not infected"<br>
else:<br>
  addr = shmat(shmid, None, 0)<br>
<br>
  f = file(OUTFILE, 'wb')<br>
  f.write(string_at(addr,SHM_SIZE))<br>
  f.close()<br>
<br>
  print "Dumped %d bytes in %s" % (SHM_SIZE, OUTFILE)<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr"><div>Joel Goldstick<br></div><a href="http://joelgoldstick.com" target="_blank">http://joelgoldstick.com</a><br></div>
</div></div>