NoEnv Persistent SingleInstance force Include CRMPUDF ahk global chatL

 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
#NoEnv
#Persistent
#SingleInstance, force
#Include, CRMPUDF.ahk
global chatLog := A_MyDocuments "\GTA San Andreas User Files\CR-MP\GenerationC\chatlog.txt" ; путь к чатлогу
SetTimer, start, 50
Return
start()
{
FileRead, textChatLog, % chatLog
for k, v in StrSplit(textChatLog, "`n")
{
if (RegExMatch(v, "\[\d+:\d+:\d+\]\s+Nik\s+\[(?<Nick>[A-z_]+)\]\s+(R-IP|Register-IP)\s\[(?<Reg>[0-9.]+)\]\s+(L-IP|Last-IP)\s\[(?<Last>[0-9.]+)\]|\s+IP\s+\[(?<IP>[0-9.]+)\]", out_))
{
saveCRMP(textChatLog)
result := getIpReg(out_Reg, (!out_IP ? out_Last : out_IP))
text := "R-IP:`t{00FF00}" out_Reg "`n" (!out_IP ? "L-IP:`t{00FF00}" out_Last : "IP:`t{00FF00}" out_IP) "`nСтрана:`nR-IP:`t{00FF00}" result[1] "`n" (!out_IP ? "L-IP:`t{00FF00}" result[2] : "IP:`t{00FF00}" result[2]) "`nГород:`nR-IP:`t{00FF00}" result[3] "`n" (!out_IP ? "L-IP:`t{00FF00}" result[4] : "IP:`t{00FF00}" result[4]) "`nПровайдер:`nR-IP:`t{00FF00}" result[6] "`n" (!out_IP ? "L-IP:`t{00FF00}" result[7] : "IP:`t{00FF00}" result[7]) "`nРастояние между IP:`t{00FF00}" result[5] "{FFFFFF}км."
showDialog(2, "{FF0000}CheckIP Nick: " out_Nick, text, "/*_*\")
}
}
}
saveCRMP(chatlog)
{
static logschat := A_MyDocuments "\GTA San Andreas User Files\CR-MP\GenerationC\ChatLogs\"
static chat := A_MyDocuments "\GTA San Andreas User Files\CR-MP\GenerationC\chatlog.txt"
FileCreateDir , % logschat A_MM "-" A_YYYY
FileAppend , % chatlog, % logschat A_MM "-" A_YYYY "\" A_DD "." A_MM "." A_YYYY ".txt"
FileDelete , % chat
}
getIpReg(ip1, ip2)
{
tempArray := []
WinHTTP := ComObjCreate("WinHTTP.WinHttpRequest.5.1")
WinHTTP.Open("POST", "https://2ip.ua/ru/services/information-service/site-distance", 0)
WinHTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; rv:65.0) Gecko/20100101 Firefox/65.0")
WinHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
WinHTTP.SetRequestHeader("Pragma", "no-cache")
WinHTTP.SetRequestHeader("Cache-Control", "no-cache, no-store")
WinHTTP.SetRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT")
WinHTTP.Send("a=act&ip=" ip1 "&ip2=" ip2)
Result := WinHTTP.ResponseText
for k, v in tempArray := StrSplit(Result, "`n")
{
if (RegExMatch(v, "\s+<td>Cтрана:</td>"))
{
RegExMatch(tempArray[A_Index + 1], "\s+<td>(?<Count1>\W+)<\/td>", out_)
RegExMatch(tempArray[A_Index + 2], "\s+<td>(?<Count2>\W+)<\/td>", out_)
}
if (RegExMatch(v, "\s+<td>Город:<\/td>"))
{
RegExMatch(tempArray[A_Index + 1], "\s+<td>(?<City1>\W+)<\/td>", out_)
RegExMatch(tempArray[A_Index + 2], "\s+<td>(?<City2>\W+)<\/td>", out_)
}
if (RegExMatch(v, "\s+<td>Километров<\/td>"))
{
RegExMatch(tempArray[A_Index + 1], "\s+<td>(?<km>\w+)\.\w+<\/td>", out_)
}
if (RegExMatch(v, "\s+<td>Имя провайдера:<\/td>"))
{
RegExMatch(tempArray[A_Index + 1], "\s+<td>(?<Prov1>\W+)<\/td>", out_)
RegExMatch(tempArray[A_Index + 2], "\s+<td>(?<Prov2>\W+)<\/td>", out_)
}
}
Return [out_Count1, out_Count2, out_City1, out_City2, out_km, out_Prov1, out_Prov2]
}