forked from pskclub/Auto-authen-KMITL
-
Notifications
You must be signed in to change notification settings - Fork 1
/
kmitl_auth.pl
executable file
·105 lines (96 loc) · 2.45 KB
/
kmitl_auth.pl
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
use LWP::UserAgent;
use HTTP::Cookies;
use Term::ReadKey;
use Data::Dumper;
$username="";
$password="";
$isLogin=0;
$message="";
%ssl_opts=(
verify_hostname => 0,
SSL_verify_mode => 0x00,
);
$cookie_jar=HTTP::Cookies->new(autosave=>1, hide_cookie2=>1);
$agent=LWP::UserAgent->new(
agent => 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0',
ssl_opts => {%ssl_opts},
timeout => 1,
max_redirect => 0,
cookie_jar => $cookie_jar
);
while(1) {
$time=localtime;
$checkConnection=checkConnection();
if($checkConnection==1) {
print "[$time] Connection OK...\n";
}else {
system("cls");
print " ____ __ __ ____ ____ _ ____ ____ ___ _ _____ \n";
print "| __ ) \\ \\ / / / ___|/ ___| / \\ / ___| |___ \\ / _ \\ / ||___ | \n";
print "| _ \\ \\ V / | | \\___ \\ / _ \\ | | _ __) || | | || | / / \n";
print "| |_) | | | | |___ ___) | / ___ \\ | |_| | / __/ | |_| || | / / \n";
print "|____/ |_| \\____||____/ /_/ \\_\\ \\____| |_____| \\___/ |_| /_/ \n";
print "\n";
print "Version fill input. Script By Ohm CSAG 2016. Modified by Komphet.me\n";
print "\n";
print "\n";
print "[$time] Connection Reset!!!\n";
if($message!=""){
print $message;
$message="";
}
if(login()==0){
sleep 10;
next;
};
}
sleep 60;
}
sub login {
if($username=="" || $username==""){
print "Username: ";
chomp ($username=<>);
print "Password: ";
ReadMode( "noecho");
chomp ($password=<>);
ReadMode ("original") ;
print "\nChecking...\n";
}
$content=$agent->post('https://10.252.23.2:8445/PortalServer/Webauth/webAuthAction!login.action',[
'userName' => $username,
'password' => $password,
'validCode' => '',
'authLan' => 'en',
'hasValidateNextUpdatePassword' => 'true',
'browserFlag' => 'en',
'ClientIp' => ''
]);
if($content->is_success){
$check=$agent->get('http://188.166.177.132/check/');
if($check->is_success){
if($check->as_string=~/Hello planet!\n/){
print " You are Loged in!\n\n";
return 1;
} else {
$username="";
$password="";
$message="Username or Password is incorect!\n\n";
print " Username or Password is incorect!\n\n";
return 0;
}
}
} else {
print " Connection Error!\n\n";
return 0;
}
}
sub checkConnection {
$check=$agent->get('http://188.166.177.132/check/');
if($check->is_success){
if($check->as_string=~/Hello planet!\n/){
return 1;
} else {
return 0;
}
}
}