-
Notifications
You must be signed in to change notification settings - Fork 115
/
easCheck.py
47 lines (37 loc) · 1.53 KB
/
easCheck.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import requests
import base64
import sys
import warnings
warnings.filterwarnings("ignore")
def test_options_https(ip,username,password):
try:
credential = base64.b64encode(username+":"+password)
url = 'https://' + ip + '/Microsoft-Server-ActiveSync'
headers = {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language': 'en-US,en;q=0.5',
'Accept-Encoding': 'gzip, deflate',
'Content-Type': 'application/vnd.ms-sync.wbxml',
'Authorization': 'Basic '+credential
}
r = requests.options(url, headers = headers, verify = False)
if r.status_code ==200:
print('[+] Valid: %s %s'%(username,password))
#print(r.headers)
else:
print('[!] Authentication failed')
except Exception as e:
print('[!]Error:%s'%e)
if __name__ == '__main__':
if len(sys.argv)!=4:
print('[!]Wrong parameter')
print('easCheck')
print('Use to check the valid credential of eas(Exchange Server ActiveSync)')
print('Usage:')
print('%s <host> <user> <password>'%(sys.argv[0]))
print('Eg.')
print('%s 192.168.1.1 user1 password1'%(sys.argv[0]))
sys.exit(0)
else:
test_options_https(sys.argv[1], sys.argv[2], sys.argv[3])