Blinky Posted October 14, 2013 Posted October 14, 2013 (edited) Hi! I've been working on a TCP multiclient chat and at some poin in the development it started to be detected as a virus. i don't realy know what to do to make it work. Please help if you know what's hapening. here is the code for the client sorry if it's a mess but in my defence i wrote it in 2 days so i'm glad it works i'll keep the server on for those who want to test it expandcollapse popup#NoTrayIcon #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <Sound.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> #include <GuiEdit.au3> #include <GuiTab.au3> Global $sound=_SoundOpen(@WindowsDir&"/media/notify.wav") Global $flash=0, $Loginname, $ulist, $DBLCLKindex Global $ipn="no.better-than.tv", $selvar=-8 Global $cw[15][5], $privartestartnamestatus, $privartestartname Global $xg=500, $yg=500, $hiw=100, $tabslist[20][7] GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") TCPStartup() $lg=GUICreate("Log IN",170,70) GUICtrlCreateLabel("Name",10,10,50,20) $ni=GUICtrlCreateInput("",60,10,100,20) $lbut=GUICtrlCreateButton("Login",10,40,150,20,$BS_DEFPUSHBUTTON) GUISetState() While 1 $ms=GUIGetMsg() If $ms=$lbut Then $ip=TCPNameToIP($ipn) $Loginname=GUICtrlRead($ni) $iMainSocket = TCPConnect($ip, 34567) If @error Then MsgBox(0x20, "CWI", "Unable to connect to server") Exit EndIf TCPSend($iMainSocket,"Login####"&$Loginname) GUIDelete($lg) ExitLoop EndIf if $ms=$GUI_EVENT_CLOSE Then TCPShutdown() Exit EndIf WEnd $gui=GUICreate("CWI",$xg,$yg) $file_menu=GUICtrlCreateMenu("File") $file_update_menu=GUICtrlCreateMenuItem("Update",$file_menu) $file_exit_menu=GUICtrlCreateMenuItem("Exit",$file_menu) $tabs=GUICtrlCreateTab(1,0,$xg,$yg-20) $maintab=GUICtrlCreateTabItem("Cwi-Chat") $edit=GUICtrlCreateEdit("",10,30,$xg-115,$yg-140,$ES_READONLY + $WS_VSCROLL,$WS_EX_STATICEDGE) GUICtrlSetState(-1, $GUI_SHOW) _GUICtrlEdit_SetMargins($Edit, BitOR($EC_LEFTMARGIN, $EC_RIGHTMARGIN), 10, 10) GUICtrlSetFont(-1,10,600) GUICtrlSetColor(-1,0x2222ff) $ulist=GUICtrlCreateListView("Online Users",$xg-100,30,90,$yg-140) GUICtrlSetState(-1, $GUI_SHOW) $cm=GUICtrlCreateContextMenu($ulist) GUICtrlSetState(-1, $GUI_SHOW) $openprivate=GUICtrlCreateMenuItem("Private Msg",$cm) GUICtrlSetState(-1, $GUI_SHOW) $inp=GUICtrlCreateInput("",10,$yg-100,$xg-115,70) GUICtrlSetState(-1, $GUI_SHOW) $sbut=GUICtrlCreateButton("SEND",$xg-95,$yg-100,85,70,$BS_DEFPUSHBUTTON) GUICtrlSetState(-1, $GUI_SHOW) GUISetState() edit_append($edit,"Connected to server",0) While 1 $msg=GUIGetMsg() $sNewData = TCPRecv($iMainSocket, 2048) If @error Then edit_append($edit,"Disconected from server; will exit in 10 s",0) Sleep(10000) Exit ElseIf $sNewData Then $split_new_data = StringSplit($sNewData, "####",1) $request=$split_new_data[1] Switch $request Case "Sys" edit_append($edit,$split_new_data[2], 0) Case "Chat" edit_append($edit,$split_new_data[2], 1) If Not WinActive("[TITLE:CWI]") Then _SoundPlay($sound,0) $flash = 1 EndIf Case "Upgrade" upgrade($split_new_data[2]) Case "Userlist" $o_users=StringSplit($split_new_data[2], ",",1) $list=StringReplace($split_new_data[2],",","|") _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($ulist)) For $z=1 to $o_users[0] GUICtrlCreateListViewItem($o_users[$z],$ulist) Next $lval=1 Case "Privat" $getPrivat=StringSplit($split_new_data[2], "@@@",1) While 1 For $x=0 To 19 If $tabslist[$x][1]=$getPrivat[1] Then edit_append($tabslist[$x][2],$getPrivat[1] & " > " & $getPrivat[2]) $search="TRUE" ExitLoop EndIf $search="FALSE" Next If $search="FALSE" Then Tabs_op("+",$getPrivat[1],0) EndIf If $search="TRUE" Then ExitLoop WEnd Case "User" $get_op=StringSplit($split_new_data[2],"@@@",1) If $get_op[2] = 0 Then For $x=0 To 19 If $tabslist[$x][1]=$get_op[1] Then edit_append($tabslist[$x][2],"User Offline") status_set($x,0) ExitLoop EndIf Next edit_append($edit,$get_op[3]&$get_op[1], 0) EndIf If $get_op[2] = 1 Then For $x=0 To 19 If $tabslist[$x][1]=$get_op[1] Then edit_append($tabslist[$x][2],"User Online",0) status_set($x,1) ExitLoop EndIf Next edit_append($edit,$get_op[3]&$get_op[1], 0) EndIf EndSwitch EndIf if $msg=$GUI_EVENT_CLOSE Then TCPSend($iMainSocket,"Logout####Droped") Sleep(200) TCPShutdown() Exit EndIf if $msg=$sbut Then $data=GUICtrlRead($inp) TCPSend($iMainSocket,"Chat####"&$data) If @error Then MsgBox(0,"","ERROR") GUICtrlSetData($inp,"") EndIf if $msg=$file_update_menu Then TCPSend($iMainSocket,"Upgrade####list") if $msg=$openprivate And $Loginname<>$privartestartnamestatus then Tabs_op("+",$privartestartnamestatus) For $x=0 To 19 If $msg=$tabslist[$x][5] And $tabslist[$x][0]<>-1 Then $data=GUICtrlRead($tabslist[$x][3]) TCPSend($iMainSocket,"Privat####"&$tabslist[$x][1]&"@@@"&$data) If @error Then MsgBox(0,"","ERROR") GUICtrlSetData($tabslist[$x][3],"") edit_append($tabslist[$x][2],$Loginname & " > " & $data) EndIf If $msg=$tabslist[$x][6] And $tabslist[$x][0]<>-1 Then Tabs_op("-",$tabslist[$x][1]) Next If WinActive("[TITLE:CWI]") Then $winactive=1 $flash=0 Else $winactive=0 EndIf If $flash=1 and $winactive=0 Then WinFlash("[TITLE:CWI]","",2,300) EndIf $selectedtab=_GUICtrlTab_GetCurSel($tabs) If $selvar<>$selectedtab Then ;~ MsgBox(0,"",$selectedtab) $selvar=$selectedtab $selectedtext=_GUICtrlTab_GetItemText($tabs,$selectedtab) If $selectedtext="Cwi-Chat" Then GUICtrlSetState($sbut,$GUI_FOCUS) Else GUICtrlSetState($sbut,$GUI_NOFOCUS) EndIf For $x=0 to 19 If $tabslist[$x][0]<>-1 Then ContinueLoop If $selectedtext=$tabslist[$x][1] Then GUICtrlSetState($tabslist[$x][5],$GUI_FOCUS) Else GUICtrlSetState($tabslist[$x][5],$GUI_NOFOCUS) EndIf Next EndIf Sleep(10) WEnd Func edit_append($edithndl, $bla , $prefixstamp = 1 , $stamp="") $Timestamp = String(@hour & ":" & @MIN & " > ") If $prefixstamp= 2 then _GUICtrlEdit_AppendText($edithndl,$stamp & $bla &@CRLF) If $prefixstamp= 1 then _GUICtrlEdit_AppendText($edithndl,$Timestamp & $bla&@CRLF) If $prefixstamp= 0 then _GUICtrlEdit_AppendText($edithndl,$bla&@CRLF) EndFunc Func upgrade($itms) If FileExists("update.exe") Then $file=FileOpen("Update.txt",2) FileWriteLine($file,$itms) FileClose($file) TCPSend($iMainSocket,"Logout####for update") Sleep(200) TCPCloseSocket($iMainSocket) TCPShutdown() Run("Update.exe") Exit EndIf EndFunc Func Tabs_op($op,$tabname="test",$param1=1) If $op="+" Then If _GUICtrlTab_FindTab($tabs,$tabname)<>-1 And $param1=1 Then _GUICtrlTab_ActivateTab($tabs,_GUICtrlTab_FindTab($tabs,$tabname)) Else For $ct1 = 0 To 19 If $tabslist[$ct1][0]<>-1 Then ContinueLoop $tabslist[$ct1][0]=GUICtrlCreateTabItem($tabname) $tabslist[$ct1][6]=GUICtrlCreateButton ( "X",$xg-20,30,15,15 ) GUICtrlSetBkColor(-1,0xFF0000) GUICtrlSetColor(-1,0xFFFFFF) $tabslist[$ct1][1]=$tabname $tabslist[$ct1][2]=GUICtrlCreateEdit("",10,30,$xg-115,$yg-140,$ES_READONLY + $WS_VSCROLL,$WS_EX_STATICEDGE) $tabslist[$ct1][3]=GUICtrlCreateInput("",10,$yg-100,$xg-115,70) $tabslist[$ct1][4]=GUICtrlCreateLabel("STATUS",$xg-95,($yg-90)/2,70,70) GUICtrlSetColor(-1,0xFF00FF) $tabslist[$ct1][5]=GUICtrlCreateButton("SEND",$xg-95,$yg-100,85,70,$BS_DEFPUSHBUTTON) GUICtrlCreateTabItem("") status_set($ct1,1) ExitLoop Next EndIf EndIf If $op="-" Then For $x=0 To 19 If $tabslist[$x][1]<>$tabname Or $tabslist[$x][0]=-1 Then ContinueLoop GUICtrlDelete($tabslist[$x][2]) GUICtrlDelete($tabslist[$x][3]) GUICtrlDelete($tabslist[$x][4]) GUICtrlDelete($tabslist[$x][5]) GUICtrlDelete($tabslist[$x][0]) GUICtrlDelete($tabslist[$x][6]) $tabslist[$x][0]=-1 $tabslist[$x][1]="" Next EndIf EndFunc Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo $hWndListView = $ulist If Not IsHWnd($ulist) Then $hWndListView = GUICtrlGetHandle($ulist) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $NM_DBLCLK $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) $DBLCLKindex=DllStructGetData($tInfo, "Index") $privartestartname=_GUICtrlListView_GetItemText($hWndListView, $DBLCLKindex) If $Loginname<>$privartestartname Then Tabs_op("+",$privartestartname) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc Func status_set($labelHnd,$param1=-1) If $param1=1 Then GUICtrlSetData($tabslist[$labelHnd][4],"User"&@CRLF&"ONLINE") GUICtrlSetColor($tabslist[$labelHnd][4],0x00FF00) GUICtrlSetState($tabslist[$labelHnd][3],$GUI_ENABLE) GUICtrlSetState($tabslist[$labelHnd][5],$GUI_ENABLE) EndIf If $param1=0 Then GUICtrlSetData($tabslist[$labelHnd][4],"User"&@CRLF&"OFFLINE") GUICtrlSetColor($tabslist[$labelHnd][4],0xFF0000) GUICtrlSetState($tabslist[$labelHnd][3],$GUI_DISABLE) GUICtrlSetState($tabslist[$labelHnd][5],$GUI_DISABLE) EndIf EndFunc thx Edited October 14, 2013 by Blinky
czardas Posted October 14, 2013 Posted October 14, 2013 Best thing you can do is report the file to your Antivirus company / provider as a false positive. operator64 ArrayWorkshop
water Posted October 15, 2013 Posted October 15, 2013 Please search the forum for this subject. There are a lot of threads on this issue. There is even a pinned in the General help & Support thread: title="Are my AutoIt EXEs really infected? - started 17 October 2006 - 05:22 PM"> Are my AutoIt EXEs really infected? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Moderators Melba23 Posted October 15, 2013 Moderators Posted October 15, 2013 Hi,I see that dratted bird is out again. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Recommended Posts