z0mgItsJohn Posted April 2, 2010 Posted April 2, 2010 (edited) It's a multi-client TCP chat room with a lot of features.ServerIP, Port, Set Pw sets the password for the admin.$Max = Max amount of users that can be connected at a time.ClientIP, Port, Username.* A username can only be in use by one person. (Case-insensitive.)Normal commands.pm username,messageAllows you to sent a private message to a specific user..statsTells you who's online..clearClears the history..saveSaves the chat history..disconnect or .exitCloses the chat window, disconnects you from the server, and re-opens the Connection Settings.Admin commands.admin password, .admin lol123Logs you in as an admin. (Only one admin can be logged in at a time.).logoutLogs you out of the admin position. .kick username, .kick JohnKicks the desired user. .ip username, .ip JohnGives you the IP of the desired user..ban username, .ban JohnKicks and IP bans the user..unban ip address, .unban 127.0.0.1Removes the IP from the blocked list..logsOpens the logs from the server. (Tells you who you've banned / un-banned, and their IP.)Red = Command, Blue = ParameterDownload Link : http://www.mediafire.com/?a9fegzx2qn0t38c *Includes compiled versions (32 and 64 bit) and the source.Hope this helps some!- John Edited September 24, 2012 by z0mgItsJohn armoros, Skitty and Chance 3 Latest Projects :- New & Improved TCP Chat
z0mgItsJohn Posted April 2, 2010 Author Posted April 2, 2010 Oh crap.. I added this to the wrong section /face palm, can a mod or someone please move this to the example section, sorry. Latest Projects :- New & Improved TCP Chat
AdmiralAlkex Posted April 2, 2010 Posted April 2, 2010 If you want something moved you better do something else than shouting in the air, like reporting the OP. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
darkjohn20 Posted April 2, 2010 Posted April 2, 2010 (edited) Nice work. I like it! Is it free to modify and all? I will give credit if so. Admiral, he is the OP. You want him to report himself? Edited April 2, 2010 by darkjohn20
AdmiralAlkex Posted April 3, 2010 Posted April 3, 2010 Admiral, he is the OP. You want him to report himself?Yes, it's the only guaranteed way to move it quickly. Sure you could PM a mod but you never know when they are online. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
WeMartiansAreFriendly Posted April 3, 2010 Posted April 3, 2010 The simplicity of your code surprised me. Easy to understand and adopt unlike other "tcp chat" things that have been floating round.. Cheers. Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()
z0mgItsJohn Posted April 3, 2010 Author Posted April 3, 2010 Thanks for the positive feed back! =] Feel free to modify it in anyway, shape, or form just try and give me some credit and re-post you're modified code here so other people can learn from it. Latest Projects :- New & Improved TCP Chat
z0mgItsJohn Posted April 3, 2010 Author Posted April 3, 2010 Small Server Addition* The ability to send private messages..pm username,messageAlso, I forgot to mention another command .stats, which tells you the amount of users online and a list of their names.Server.au3 [updated*]expandcollapse popup#Include <ButtonConstants.Au3> #Include <EditConstants.Au3> #Include <GUIConstantsEx.Au3> #Include <StaticConstants.Au3> #Include <WindowsConstants.Au3> #Include <File.Au3> #Include <String.Au3> #NoTrayIcon Opt ('GUIOnEventMode', 1) Global $Max = 10, $Socket[$Max + 1], $User[$Max + 1], $Server = -1, $Admin = -1, $Admin_Pw = 'password', $Connected = 0 For $A = 1 To $Max $Socket[$A] = -1 $User[$A] = -1 Next $GUI = GUICreate ('Server Settings', 180, 100, -1, -1, -1, 128) GUISetOnEvent ($GUI_EVENT_CLOSE, '_Exit') GUICtrlCreateGroup ('', 5, 0, 170, 94) $IP = GUICtrlCreateInput (@IpAddress1, 12, 13, 100, 21, 1) $Port = GUICtrlCreateInput (50, 117, 13, 50, 21, 1) $Start = GUICtrlCreateButton ('Start', 12, 39, 46, 20, $WS_GROUP) GUICtrlSetOnEvent ($Start, '_Start') $Stop = GUICtrlCreateButton ('Stop', 63, 39, 49, 20, $WS_GROUP) GUICtrlSetState ($Stop, $GUI_DISABLE) GUICtrlSetOnEvent ($Stop, '_Stop') $Pw = GUICtrlCreateInput ($Admin_Pw, 12, 65, 100, 21, BitOr (1, $ES_PASSWORD)) $Set = GUICtrlCreateButton ('Set Pw', 118, 66, 49, 20, $WS_GROUP) GUICtrlSetOnEvent ($Set, '_Set') GUISetState (@SW_SHOW) WinSetOnTop ($GUI, '', 1) While 1 If $Server <> -1 Then If $Connected < $Max Then $Accept = TcpAccept ($Server) If $Accept <> -1 Then If _IsBanned (_SocketGetIP ($Accept)) = 0 Then $Open = _Open () $Timer = TimerInit () Do Sleep (15) $Recv = TcpRecv ($Accept, 1000000) Until $Recv <> '' Or TimerDiff ($Timer) >= 500 If $Recv <> '' Then If _Check ($Recv) = 1 Then $User[$Open] = $Recv $Socket[$Open] = $Accept $Connected = $Connected + 1 _SendAll ('[%Time] ' & $User[$Open] & ' has connected.') Else TcpSend ($Accept, 'Error:Username.Exists;') Sleep (250) TcpCloseSocket ($Accept) EndIf Else TcpCloseSocket ($Accept) EndIf Else TcpSend ($Accept, 'Error:IP.Banned;') Sleep (250) TcpCloseSocket ($Accept) EndIf EndIf ElseIf $Connected = $Max Then $Accept = TcpAccept ($Server) If $Accept <> -1 Then $Timer = TimerInit () Do Sleep (15) $Recv = TcpRecv ($Accept, 1000000) Until $Recv <> '' Or TimerDiff ($Timer) >= 500 Sleep (250) TcpSend ($Accept, 'Error:Max.Connections;') TcpCloseSocket ($Accept) EndIf EndIf For $A = 1 To $Max If $Socket[$A] <> -1 And $User[$A] <> -1 Then $Recv = TcpRecv ($Socket[$A], 1000000) If @Error Then _Disconnect ($A) If $Recv <> '' Then If StringLeft ($Recv, 6) = '.admin' Then If $Admin <> -1 Then TcpSend ($Socket[$A], '[%Time] Server : An admin is already logged in.') Else If StringTrimLeft ($Recv, 7) == $Admin_Pw Then $Admin = $User[$A] _SendAll ('[%Time] ' & $User[$A] & ' is now an admin.') Else TcpSend ($Socket[$A], '[%Time] Server : Incorrect admin password.') EndIf EndIf ElseIf StringLeft ($Recv, 7) = '.logout' Then If $User[$A] == $Admin Then $Admin = -1 _SendAll ('[%Time] ' & $User[$A] & ' is no longer an admin.') Else TcpSend ($Socket[$A], '[%Time] Server : You do not have this power.') EndIf ElseIf StringLeft ($Recv, 5) = '.kick' Then If $User[$A] == $Admin Then $Who = StringTrimLeft ($Recv, 6) If $Who = $Admin Then TcpSend ($Socket[$A], '[%Time] Server : You cannot kick an admin.') ElseIf _UserGetSocket ($Who) <> -1 Then _Disconnect (_UserGetSocket ($Who)) Else TcpSend ($Socket[$A], '[%Time] Server : User does not exist.') EndIf Else TcpSend ($Socket[$A], '[%Time] Server : You do not have this power.') EndIf ElseIf StringLeft ($Recv, 6) = '.stats' Then $Stats = @CRLF & 'Total Online : ' & $Connected & @CRLF For $B = 1 To $Max If $Socket[$B] <> -1 And $User[$B] <> -1 Then $Stats = $Stats & '[' & $B& '] ' & $User[$B] & @CRLF EndIf Next TcpSend ($Socket[$A], $Stats) ElseIf StringLeft ($Recv, 3) = '.ip' Then If $User[$A] == $Admin Then $Who = StringTrimLeft ($Recv, 4) $wID = _UserGetSocket ($Who) If $wID <> -1 Then TcpSend ($Socket[$A], '[%Time] Server : ' & $Who & "'s IP : " & _SocketGetIP ($Socket[$wID])) Else TcpSend ($Socket[$A], '[%Time] Server : User does not exist.') EndIf Else TcpSend ($Socket[$A], '[%Time] Server : You do not have this power.') EndIf ElseIf StringLeft ($Recv, 4) = '.ban' Then If $User[$A] == $Admin Then $Who = StringTrimLeft ($Recv, 5) $wID = _UserGetSocket ($Who) If $Who = $Admin Then TcpSend ($Socket[$A], '[%Time] Server : You cannot ban an admin.') ElseIf $wID <> -1 Then $IP = _SocketGetIP ($Socket[$wID]) FileWriteLine ('Banned.txt', $IP) For $B = 1 To $Max If $Socket[$B] <> -1 And $User[$B] <> -1 Then If _SocketGetIP ($Socket[$B]) = $IP Then _Disconnect ($B) EndIf Next _SendAll ('[%Time] IP : ' & $IP & ' has been banned.') Sleep (500) TcpSend ($Socket[$A], '.log Ban Added : Username : ' & $Who & ', IP : ' & $IP) Else TcpSend ($Socket[$A], '[%Time] Server : User does not exist.') EndIf Else TcpSend ($Socket[$A], '[%Time] Server : You do not have this power.') EndIf ElseIf StringLeft ($Recv, 6) = '.unban' Then If $User[$A] == $Admin Then $IP = StringTrimLeft ($Recv, 7) If _IsBanned ($IP) = 1 Then _Remove ($IP) _SendAll ('[%Time] IP ' & $IP & ' is un-banned.') Sleep (500) TcpSend ($Socket[$A], '.log Ban Removed : ' & $IP) Else TcpSend ($Socket[$A], '[%Time] Server : ' & $IP & ' is not banned.') EndIf Else TcpSend ($Socket[$A], '[%Time] Server : You do not have this power.') EndIf ElseIf StringLeft ($Recv, 3) = '.pm' Then $Data = StringSplit (StringTrimLeft ($Recv, 4), ',') If @Error <> 1 Then $Who = $Data[1] $wID = _UserGetSocket ($Who) $Msg = $Data[2] If $Who = $User[$A] Then TcpSend ($Socket[$A], '[%Time] Server : You cannot message your self.') Else If $wID <> -1 Then TcpSend ($Socket[$A], '[%Time] [PM] ' & $User[$A] & ' says : ' & $Msg) TcpSend ($Socket[$wID], '[%Time] [PM] ' & $User[$A] & ' says : ' & $Msg) Else TcpSend ($Socket[$A], '[%Time] Server : User does not exist.') EndIf EndIf Else TcpSend ($Socket[$A], '[%Time] Server : Syntax Error.') EndIf Else _SendAll ('[%Time] ' & $User[$A] & ' says : ' & $Recv) EndIf EndIf EndIf Next EndIf Sleep (15) WEnd Func _IsBanned ($Data) For $A = 1 To _FileCountLines ('Banned.txt') If FileReadLine ('Banned.txt', $A) = $Data Then Return 1 Next Return 0 EndFunc Func _Remove ($IP) $Count = _FileCountLines ('Banned.txt') If $Count = 1 And FileReadLine ('Banned.txt', 1) = $IP Then FileDelete ('Banned.txt') ElseIf $Count > 0 Then For $A = 1 To $Count $Line = FileReadLine ('Banned.txt', $A) If $Line <> $IP Then FileWriteLine ('Banned_Temp.txt', $Line) Next EndIf FileCopy ('Banned_Temp.txt','Banned.txt', 1) FileDelete ('Banned_Temp.txt') EndFunc Func _SocketGetIP ($Data) Local $Struct, $Return $Struct = DllStructCreate ('short;ushort;uint;char[8]') $Return = DllCall ('Ws2_32.dll','int','getpeername','int', $Data, 'ptr', DllStructGetPtr ($Struct), 'int*', DllStructGetSize($Struct)) If @Error Or $Return[0] <> 0 Then Return 0 $Return = DllCall ('Ws2_32.dll','str','inet_ntoa','int', DllStructGetData ($Struct, 3)) If @Error Then Return 0 $Struct = 0 Return $Return[0] EndFunc Func _UserGetSocket ($Data) For $A = 1 To $Max If $User[$A] = $Data Then Return $A Next Return -1 EndFunc Func _Check ($Data) For $A = 1 To $Max If $User[$A] = $Data Then Return 0 Next Return 1 EndFunc Func _Disconnect ($ID) _SendAll ('[%Time] ' & $User[$ID] & ' has disconnected.') If $User[$ID] = $Admin Then $Admin = -1 TcpCloseSocket ($Socket[$ID]) $Socket[$ID] = -1 $User[$ID] = -1 $Connected = $Connected - 1 EndFunc Func _SendAll ($Msg) For $A = 1 To $Max If $Socket[$A] <> -1 And $User[$A] <> -1 Then TcpSend ($Socket[$A], $Msg) EndIf Next EndFunc Func _Open () For $A = 1 To $Max If $Socket[$A] = -1 And $User[$A] = -1 Then Return $A Next EndFunc Func _Start () If GUICtrlRead ($IP) == '' Or GUICtrlRead ($Port) == '' Then Return @Error TcpStartUp () $Server = TcpListen (GUICtrlRead ($IP), GUICtrlRead ($Port)) If $Server = -1 Or @Error Then WinSetOnTop ($GUI, '', 0) Sleep (100) MsgBox (16, 'Fatal Error','Unable to start the server, change your settings and try again.') WinSetOnTop ($GUI, '', 1) TcpCloseSocket ($Server) _Reset () Else GUICtrlSetState ($IP, $GUI_DISABLE) GUICtrlSetState ($Port, $GUI_DISABLE) GUICtrlSetState ($Start, $GUI_DISABLE) GUICtrlSetState ($Stop, $GUI_ENABLE) EndIf EndFunc Func _Stop () TcpCloseSocket ($Server) $Server = -1 $Connected = 0 $Admin = -1 _Reset () EndFunc Func _Set () $Admin_Pw = GUICtrlRead ($Pw) EndFunc Func _Reset () For $A = 1 To $Max If $Socket[$A] <> -1 Or $User[$A] <> -1 Then TcpCloseSocket ($Socket[$A]) $Socket[$A] = -1 $User[$A] = -1 EndIf Next TcpShutDown () GUICtrlSetState ($IP, $GUI_ENABLE) GUICtrlSetState ($Port, $GUI_ENABLE) GUICtrlSetState ($Start, $GUI_ENABLE) GUICtrlSetState ($Stop, $GUI_DISABLE) EndFunc Func _Exit () Exit EndFunc Latest Projects :- New & Improved TCP Chat
Yuraj Posted April 3, 2010 Posted April 3, 2010 (edited) I like it! Edited April 3, 2010 by Yuraj ShellExecute("http://www.yuraj.ucoz.com")ProcessClose(@AutoItPID)
true Posted April 14, 2010 Posted April 14, 2010 Hi I modified your code so that all network traffic is encrypted, added user management (user, pass, admin adds the user) and a couple more commands.Also all options are now saved to a .ini file.Read the readme.txt.Download link.I would much appreciate some feedback.greets true
z0mgItsJohn Posted July 4, 2010 Author Posted July 4, 2010 Umm you forgot to include AES.au3 in the download. But from what I can tell nice job on the modifications. Maybe sometime in the future I will go all out and make a 1337 chat room, or maybe even a messenger? Latest Projects :- New & Improved TCP Chat
semedboy Posted July 4, 2010 Posted July 4, 2010 Nice job, thanks for sharing 0x5748415420444F20594F552057414E543F
chorao157 Posted July 4, 2010 Posted July 4, 2010 Work with me here and type it in spain a person like a msn?
qwert Posted August 14, 2010 Posted August 14, 2010 Hi I modified your code so that all network traffic is encrypted ...I've been trying to compile your version with encryption, but there is a missing function _AesDecrypt().I've downloaded the available AES.au3, but it only has _AesEncrypt()Can you (or anyone) direct me to a source for the decryption side of the equation?Thanks in advance for any help.
true Posted August 23, 2010 Posted August 23, 2010 (edited) Hi .Sorry was away from the computer for some time. Also completely overlooked the AES.au3 issue.Anyway you can download my version of AES.au3 from here.Have fun greetz true Edited August 23, 2010 by true
DarkAngel Posted November 28, 2010 Posted November 28, 2010 Nice stuff .. I modified some parts and added a nice kewl GUI . But .. I have a problem .. what if the client side connection is being handled through proxies ? I was trying it out with a friend and they use separate proxy servers in each wing of their dorms . The connection never happened . i cant figure out how to handle the connection between the server and the proxy . worth mentioning : i have no control over the proxy other than knowing its IP and Port no . It would be great if some1 shows me the way . I am totally lost
Damein Posted December 2, 2010 Posted December 2, 2010 I can't seem to get this to work.. I click start and it just sticks there, I never get connection settings or anything. Little help? Most recent sig. I made Quick Launcher W/ Profiles Topic Movie Database Topic & Website |Â LiveStreamer Pro Website |Â YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic
gianfun Posted December 6, 2010 Posted December 6, 2010 I can't seem to get this to work..I click start and it just sticks there, I never get connection settings or anything.Little help?Heya!First, you gotta start the server. Take note of your ip and port number (the two edit boxes on the first line)Then, you have to start the client. If you are going to use this only inside your lan, then the ip on the client can be the same as in the server (i.e. 192.168.0.100)However, if you are going to talk to someone over the internet, send them the client.exe and then tell them to put in your ip into the ip slot. You can see your ip, for example, in www.omeuip.com.brAlso, make sure to tell them what port to use. Default is 50, but if you change it, the others must know it too My own pocket emo http://www.mindistortion.net/pocketemo/?da...1-7-2-0-0-1-0-0LOL[quote name='beerman' post='399180' date='Sep 6 2007, 08:45 AM']I have learned, never think inside the box. The moment you have a bright idea, and stand up to quickly exclaiming, "Eureka, I have it!". You will knock yourself out, from bashing your head on the inside of the box as you stand... So in conclusion it is always safer to think outside the box. :)[/quote]
pyrofool Posted December 8, 2010 Posted December 8, 2010 I modified trues version a bit to add the ability to change font/background color and also added some emoticons. expandcollapse popup;~ This is the client. ;~ version 1.5 ;~ by true ;~ based on : New & Improved TCP Chat by John2010zz (http://www.autoitscript.com/forum/index.php?showtopic=112507) ;~ and Advanced Encryption Standard (AES/Rijndael) UDF by Ward (http://www.autoitscript.com/forum/index.php?showtopic=78745&hl=aesau3&st=0) ;~ heavily modified by true for Silikon Junkeez (http://sj.hopto.org) ;~ many thanks to both of them ;~ i also used _ArrayAdd2 function by vampirevn01 (http://www.autoitscript.com/forum/index.php?showtopic=72040) #Include <ButtonConstants.Au3> #Include <EditConstants.Au3> #Include <GUIConstantsEx.Au3> #Include <StaticConstants.Au3> #Include <WindowsConstants.Au3> #Include <GUIEdit.Au3> #Include <Misc.Au3> #Include <AES.Au3> #include <iNet.au3> #NoTrayIcon Opt ('GUIOnEventMode', 1) TcpStartUp () ; ######################## some vars Global $Server = -1, $Logs, $version = "1.5", $serveradress , $FontColor , $BgColor $Key = Binary(IniRead ('Settings.ini','Settings','Key','0x00000000000000000000000000000000')) $red = "0xFF0019" $black = "0x000000" $blue = "0x0000FF" $yellow = "0xFFF70F" $green = "0x27C400" $white = "0xFFFFFF" $custom = "" ;######################### end vars ;######################### some GUI ;this is the settings window $FontColor = IniRead ('Settings.ini','Settings','FontColor','black') $BgColor = IniRead ('Settings.ini','Settings','BgColor','white') $Settings = GUICreate ('Settings', 180, 180, -1, -1, -1) GUISetOnEvent ($GUI_EVENT_CLOSE, '_Exit') GUICtrlCreateGroup ('', 5, 0, 170, 95) GUICtrlCreateGroup ('', 5, 95, 170, 62) GUICtrlCreateLabel("Background",12,110,60,20) GUICtrlCreateLabel("Font",120,110,30,20) $IP = GUICtrlCreateInput (IniRead ('Settings.ini','Settings','IP', '172.0.0'), 12, 13, 100, 21, 1) $Port = GUICtrlCreateInput (IniRead ('Settings.ini','Settings','Port', 5555), 117, 13, 50, 21, 1) $User = GUICtrlCreateInput (IniRead ('Settings.ini','Settings','User','User'), 12, 39, 156, 21, 1) $bgcolordrop = GUICtrlCreateCombo($BgColor,12,130,70,10) GUICtrlSetData($bgcolordrop,"red|black|yellow|green|blue|white") $fontcolordrop = GUICtrlCreateCombo($FontColor,100,130,70,10) GUICtrlSetData($fontcolordrop,"red|black|yellow|green|blue|white") $Pass = GUICtrlCreateInput (IniRead ('Settings.ini','Settings','Pass','Password'), 12, 66, 156, 21, BitOR(1, $ES_PASSWORD)) $Connect = GUICtrlCreateButton ('Connect', 45, 158, 100, 20, $WS_GROUP) GUICtrlSetOnEvent ($Connect, '_Start') ;~ $Exit = GUICtrlCreateButton ('Exit', 117,145, 50, 20, $WS_GROUP) ;~ GUICtrlSetOnEvent ($Exit, '_Exit') GUISetState (@SW_SHOW) WinSetOnTop ($Settings, '', 1) ;this is the main GUI $GUI = GUICreate ('Chat Client' & " version " & $version, 375, 345, -1, -1, -1) GUISetOnEvent ($GUI_EVENT_CLOSE, '_Toggle') $History = GUICtrlCreateEdit ('', 0, 1, 375, 243, 2103360 + $ES_MULTILINE) GUICtrlSetFont ($History, 10, -1, -1, 'Lucida Sans Unicode') $Send = GUICtrlCreateEdit ('', 0, 275, 375, 70, 2101248) GUICtrlSetFont ($Send, 10, -1, -1, 'Lucida Sans Unicode') $smiley = GUICtrlCreateButton(":-)",2,245,20,25) $smiley1 = GUICtrlCreateButton(";-)",23,245,20,25) $smiley2 = GUICtrlCreateButton(":-0",43,245,20,25) $smiley3 = GUICtrlCreateButton("8-)",63,245,20,25) GUICtrlSetOnEvent($smiley,'_smiley') GUICtrlSetOnEvent($smiley1,'_smiley1') GUICtrlSetOnEvent($smiley2,'_smiley2') GUICtrlSetOnEvent($smiley3,'_smiley3') GUISetState (@SW_HIDE) ;######################### end GUI ;######################### some Main While 1 Sleep (15) If $Server <> -1 Then $Recv2 = TcpRecv ($Server, 1000000, 1) If @Error Then GUISetState (@SW_HIDE, $GUI) Sleep (100) MsgBox (48, 'Server Notice','You have been disconnected from the server.') _Disconnect () EndIf $Decrypted = _AesDecrypt($Key, $Recv2) $Recv = BinaryToString($Decrypted) If $Recv = 'Error:Username.Exists;' Then GUISetState (@SW_HIDE, $GUI) Sleep (100) MsgBox (48, 'Server Notice','Your username is already in use, please change it and try again.') _Disconnect () ElseIf $Recv = 'Error:Max.Connections;' Then GUISetState (@SW_HIDE, $GUI) Sleep (100) MsgBox (48, 'Server Notice','Max amount of connections reached, try again later.') _Disconnect () ElseIf $Recv = 'Error:Wrong.Username.Or.Password;' Then GUISetState (@SW_HIDE, $GUI) Sleep (100) MsgBox (48, 'Server Notice','Wrong username or password.') _Disconnect () ElseIf $Recv = 'Error:IP.Banned;' Then GUISetState (@SW_HIDE, $GUI) Sleep (100) MsgBox (48, 'Server Notice','Your IP address has been banned.') _Disconnect () ElseIf StringLeft ($Recv, 4) = '.log' Then FileWriteLine ('Logged.txt', StringTrimLeft ($Recv, 5)) ElseIf $Recv <> '' Then _Log (StringReplace ($Recv, '%Time', @HOUR & ':' & @MIN)) EndIf If _IsPressed ('0D') And GUICtrlRead ($Send) <> '' And ControlGetFocus ($GUI) = 'Edit2' Then $Read = StringReplace (GUICtrlRead ($Send), @CRLF, '') $Read = StringReplace ($Read, @CR, '') $Read = StringReplace ($Read, @LF, '') If $Read = '.clear' Then GUICtrlSetData ($History, '') ElseIf $Read = '.logs' Then _Logs () ElseIf $Read = '.save' Then FileWrite (@MDAY & '-' & @MON & '-' & @YEAR & '_' & @HOUR & '-' & @MIN & '-' & @SEC & '_Logs.txt', GUICtrlRead ($History)) ElseIf $Read = '.disconnect' Or $Read = '.exit' Then _Disconnect () Else If $Read <> "" Then $Encrypted = _AesEncrypt($Key, $Read) TcpSend ($Server, $Encrypted) EndIf EndIf GUICtrlSetData ($Send, '') EndIf EndIf WEnd ;######################### end Main ;######################### some Functions Func _Logs () $Logs = GUICreate ('Admin Logs', 375, 203, -1, -1, -1, 128) GUISetOnEvent ($GUI_EVENT_CLOSE, '_Delete') $Edit = GUICtrlCreateEdit ('', 0, 1, 375, 203, 2103360 + $ES_MULTILINE) GUICtrlSetFont ($Edit, 10, -1, -1, 'Lucida Sans Unicode') GUICtrlSetBkColor ($Edit, 0x83B4FC) GUICtrlSetColor ($Edit, 0xFFFFFF) GUISetState (@SW_SHOW) GUICtrlSetData ($Edit, FileRead ('Logged.txt')) WinSetOnTop ($Logs, '', 1) EndFunc Func _Delete () GUIDelete ($Logs) EndFunc Func _Disconnect () GUICtrlSetData ($History, '') TcpCloseSocket ($Server) $Server = -1 GUISetState (@SW_HIDE, $GUI) GUISetState (@SW_SHOW, $Settings) WinSetOnTop ($Settings, '', 1) EndFunc Func _Toggle () GUICtrlSetData ($History, '') TcpCloseSocket ($Server) $Server = -1 GUISetState (@SW_HIDE, $GUI) GUISetState (@SW_SHOW, $Settings) WinSetOnTop ($Settings, '', 1) EndFunc Func _Log ($Data) GUICtrlSetData ($History, GUICtrlRead ($History) & $Data & @CRLF) _GUICtrlEdit_LineScroll ($History, 0, _GUICtrlEdit_GetLineCount ($History) - 1) EndFunc Func _Start () If GUICtrlRead ($User) == '' Or GUICtrlRead ($IP) == '' Or GUICtrlRead ($Port) == '' Then Return @Error If StringIsDigit(StringLeft ((GUICtrlRead ($IP)), 1 )) Then $serveradress = (GUICtrlRead ($IP)) Else $serveradress = _TCPIpToName (GUICtrlRead ($IP)) EndIf $Server = TcpConnect ($serveradress, GUICtrlRead ($Port)) If $Server = -1 Or @Error Then WinSetOnTop ($Settings, '', 0) Sleep (100) MsgBox (16, 'Fatal Error','Unable to connect to the server, change your settings and try again.') WinSetOnTop ($Settings, '', 1) Return @Error EndIf Sleep (150) $Encrypted = _AesEncrypt($Key, GUICtrlRead ($User) & "|" & GUICtrlRead ($Pass)) TcpSend ($Server, $Encrypted) GUISetState (@SW_HIDE, $Settings) WinSetOnTop ($Settings, '', 0) getcolors () GUISetState (@SW_SHOW, $GUI) EndFunc Func _Exit () IniWrite ('Settings.ini','Settings','IP', GUICtrlRead ($IP)) IniWrite ('Settings.ini','Settings','Port', GUICtrlRead ($Port)) IniWrite ('Settings.ini','Settings','User', GUICtrlRead ($User)) IniWrite ('Settings.ini','Settings','Pass', GUICtrlRead ($Pass)) IniWrite ('Settings.ini','Settings','Key', $Key) IniWrite ('Settings.ini','Settings','FontColor', GUICtrlRead($fontcolordrop)) IniWrite ('Settings.ini','Settings','BgColor',GUICtrlRead($bgcolordrop)) Exit EndFunc Func getcolors () $FontColor = GUICtrlRead($fontcolordrop) If $FontColor = "red" Then $FontColor = $red ElseIf $FontColor = "blue" Then $FontColor = $blue ElseIf $FontColor = "yellow" Then $FontColor = $yellow ElseIf $FontColor = "green" Then $FontColor = $green ElseIf $FontColor = "white" Then $FontColor = $white else $FontColor = $black EndIf $BgColor = GUICtrlRead($bgcolordrop) If $BgColor = "red" Then $BgColor = $red ElseIf $BgColor = "blue" Then $BgColor = $blue ElseIf $BgColor = "yellow" Then $BgColor = $yellow ElseIf $BgColor = "green" Then $BgColor = $green ElseIf $BgColor = "black" Then $BgColor = $black else $BgColor = $white EndIf GUICtrlSetBkColor ($History, $BgColor) ;recieve baground color GUICtrlSetColor ($History, $FontColor) ;recieve font color GUICtrlSetColor ($Send, $FontColor) ;send font color GUICtrlSetBkColor ($Send, $BgColor) ;send background color EndFunc Func _smiley () GUICtrlSetState($Send,$GUI_FOCUS) Send(":-)") EndFunc Func _smiley1 () GUICtrlSetState($Send,$GUI_FOCUS) Send(";-)") EndFunc Func _smiley2 () GUICtrlSetState($Send,$GUI_FOCUS) Send(":-0") EndFunc Func _smiley3 () GUICtrlSetState($Send,$GUI_FOCUS) Send("8-)") EndFunc ;######################### end Functions Probably not the cleanest way to add those features but it works
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now