Jump to content

Glyph

Active Members
  • Posts

    788
  • Joined

  • Last visited

Everything posted by Glyph

  1. What kind of web development are you looking to get into? There are some specific elements to the industry from what i've found so far. Right now i'm primarily focusing on back-end web development but the end-goal is to call myself what is known as a full-stack web developer. https://www.udacity.com/course/full-stack-web-developer-nanodegree--nd004 (I've been referred many times to udacity to start out) The great thing about web development is you don't actually need a degree in it to be employed. (as long as you have equivalent experience) Although a CS degree helps alot. I primarily focus on PHP. The new version of PHP (7.1 at time of writing) is a great improvement form earlier versions, and it's still a well used language despite what others may say. It has a future ahead of it. On the other end node.js has it's issues too. Let me say that OOP is your friend, frameworks like Laravel and Symfony2 are your friend, and good IDE's are your friend. The faster you can develop apps the more you can accomplish. If you're just doing it as a hobby I still encourage you to invest some time into learning at least one MVC framework (java/spring seems like it's becoming obsolete but big companies all over still use it, so keep that in mind; it just depends on your local economy and how "advanced" your local market is) The long run gain is worth it! Of course with good coding comes good proper design etc.. just remember to DRY, and KISS. If you get into databases, it's worth mentioning topics like ACID compliance and n'th order forms. and last but not least look up SOLID. There are more things like this to discover and I am no expert but alot of the engineering behind it is alot of fun. I hope you enjoy learning this stuff as much as I am. more links: https://en.wikipedia.org/wiki/Agile_software_development notes: node.js and javascript are still good to learn, just take a look at some web development job postings and figure out what you would like to do. Alot of them include some things you may not heard of like SCRUM or KANBAN. PHP is super messy without a framework! Mixing procedural code and OOP is crazy, but it happens alot. there are also some nitpicks with PHP like using WSS, it gets a bit funky in that area. (sometimes unavoidable however) If you have any questions feel free to PM me!
  2. Has anyone already worked on a WSS UDF yet? I'm interested in making a project involving WSS with the ASYNC autoit library like ratchetphp / Pawl in PHP. (using reactphp) ASYNC is a must, and obviously WSS. the problem with some libraries i've worked with in PHP are mainly issues with handshakes like improper peer name validation (for multi level certs) relevant links: https://tools.ietf.org/rfc/rfc6455.txt https://github.com/ratchetphp/Pawl /e i should note i'm not looking for hybrid workarounds, i want to do this in autoit alone. (no javascript)
  3. Yes. I don't really understand the stringregexp command at the moment, it's been a while since i've dove into autoit. (i'm tired, it doesn't help. ) I'll check it out tomorrow. But, in the mean time i've found this: $pf_line = "6.21.14.35" $pf_check = StringRegExp($pf_line, "(((25[0-5])|(2[0-4][0-9])|(1[0-9][0-9])|([1-9]?[0-9]))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9][0-9])|([1-9]?[0-9]))") Now, I don't completely understand what this does, but what I do notice is that if you add any character at the last octet it will return as true reguardless of what it is. (e.g. "1.2.3.4x") So, it's not what i'm looking for in this particular piece of code.
  4. Ah, very good. Thanks! Now I can work on making the code better. (1 regex instead of 2, etc.. ) I'll make sure to share it after i'm done. :]
  5. For some reason "isint" and "isnumber" will not work for me! (I may be using them incorrectly) #include <File.au3> Global $impfile = "Proxy1.txt", $expfile = "PFilter" & @YEAR & @MON & @MDAY & "-" & @HOUR & @MIN & @SEC & ".txt" ConsoleWrite("Pfilter(" & $impfile & ", " & $expfile & ")" & @CRLF) _pfilter($impfile, $expfile) Func _pfilter($pf_impfile = "", $pf_expfile = "") Local $pf_buffer = "" ;clear buffer ConsoleWrite("Welcome to Pfilter()" & @CRLF) If $pf_impfile = "" Then ConsoleWrite("!Missing import file." & @CRLF) Else $pf_file = FileOpen($pf_impfile, 0) If $pf_file = -1 Then ConsoleWrite("!Unable to open file." & @CRLF) Exit EndIf $pf_totallines = _FileCountLines($pf_impfile) ConsoleWrite("@Total lines: " & $pf_totallines & @CRLF) For $pf_ln = 1 To $pf_totallines Local $validproxy = False, $validport = False, $octets = 0, $prelim = 0;reset variables for next line $pf_line = FileReadLine($pf_file, $pf_ln) $pf_port = StringRegExp($pf_line, ":") ;check for ports If $pf_port = 0 Then $prelim = $prelim + 0 ConsoleWrite("!No port. (" & $pf_ln & ")" & @CRLF) ;no port! Else $prelim = $prelim + 1 EndIf $pf_octet = StringRegExp($pf_line, ".") ;check for octets If $pf_octet = 0 Then $prelim = $prelim + 0 ConsoleWrite("!Invalid octet length. (" & $pf_ln & ")" & @CRLF) ;not enough octets! Else $prelim = $prelim + 1 EndIf If $prelim = 2 Then ConsoleWrite("@Preliminary check passed. (" & $pf_ln & ")" & @CRLF) Else ConsoleWrite("!Preliminary check failed. (" & $pf_ln & ")" & @CRLF) EndIf ;so far the checks passed, let's continue filtering. $pf_splitport = StringSplit($pf_line, ":") If $pf_splitport[0] = 2 Then; so far so good. $pf_splitoctet = StringSplit($pf_splitport[1], ".") If $pf_splitoctet[0] = 4 Then ;check for 4 octets ConsoleWrite("@Found 4 octets. (" & $pf_ln & ")" & @CRLF);4 octets were found! If isnumber($pf_splitoctet[1]) = 1 Then $octets = $octets + 1 Else ConsoleWrite("!Found invalid octet(1): "&$pf_splitoctet[1]&"(" & $pf_ln & ")" & @CRLF) EndIf If isnumber($pf_splitoctet[2]) = 1 Then $octets = $octets + 1 Else ConsoleWrite("!Found invalid octet(2): "&$pf_splitoctet[2]&"(" & $pf_ln & ")" & @CRLF) EndIf If isnumber($pf_splitoctet[3]) = 1 Then $octets = $octets + 1 Else ConsoleWrite("!Found invalid octet(3): "&$pf_splitoctet[3]&"(" & $pf_ln & ")" & @CRLF) EndIf If isnumber($pf_splitoctet[4]) = 1 Then $octets = $octets + 1 Else ConsoleWrite("!Found invalid octet(4): "&$pf_splitoctet[4]&"(" & $pf_ln & ")" & @CRLF) EndIf If isnumber($pf_splitport[2]) = 1 Then $validport = True Else ConsoleWrite("!Found invalid port: "&$pf_splitport[2]&"(" & $pf_ln & ")" & @CRLF) EndIf If $octets = 4 And $validport = True Then $validproxy = True ConsoleWrite("@Validated Proxy: " & $pf_line & @CRLF) $pf_buffer = $pf_buffer & $pf_line & @CRLF Else $validproxy = False ConsoleWrite("!Invalid Proxy: " & $pf_line & @CRLF) EndIf EndIf Else ConsoleWrite("!Invalid proxy. (" & $pf_ln & ")" & @CRLF) EndIf Next FileWrite($pf_expfile, $pf_buffer) ;write the validated proxies ConsoleWrite("@Wrote valid proxies to: " & $pf_expfile & @CRLF) EndIf EndFunc ;==>_pfilter I'm not sure why it's saying "10" is not a number... I would greatly appreciate any help. This seems like a simple problem, I just can't figure it out right now... I've included the list that I am using. Proxy1.txt
  6. Global Const $SCKTCPPROTOCOL = 0 Global Const $SCKUDPPROTOCOL = 0x01 Global Const $SCKCLOSED = 0 Global Const $SCKOPEN = 0x01 Global Const $SCKLISTENING = 0x02 Global Const $SCKCONNECTIONPENDING = 0x03 Global Const $SCKRESOLVINGHOST = 0x04 Global Const $SCKHOSTRESOLVED = 0x05 Global Const $SCKCONNECTING = 0x06 Global Const $SCKCONNECTED = 0x07 Global Const $SCKCLOSING = 0x08 Global Const $SCKERROR = 0x09 Func ConnectTCP($sAddr, $iPort, $iTimeout) Local $oSocket, $timer $oSocket = ObjCreate("MSWinsock.Winsock") $oSocket.Protocol = $SCKTCPPROTOCOL ; set protocol to be tcp $timer = TimerInit() $oSocket.Connect($sAddr, $iPort) While 1 If $oSocket.State = $SCKERROR Then $oSocket = 0 Return -2 ;connection error (will give up for now) EndIf If $oSocket.State = $SCKCONNECTED Then $oSocket.Close $oSocket = 0 Return 0 ;Return $oSocket ; return object for connection EndIf If TimerDiff($timer) > $iTimeout Then $oSocket.Close $oSocket = 0 Return -3 ; connection timeout EndIf WEnd EndFunc ;==>Connect After running that I get this: I see MSWINSCK.OCX in my system32. (It has been unregistered and registered, still did nothing) Do I have to install some special MSWinsock thing? Am I missing something? I hope you can reply.
  7. That took me a minute to realize what you meant. ;_GUICtrlListView_AddItem($ProfilesView, GUICtrlRead($proname), 0) _GUICtrlListView_InsertItem($ProfilesView, GUICtrlRead($proname), 0) _GUICtrlListView_AddSubItem($ProfilesView, 0, GUICtrlRead($protocol),1) Works! I had to play around with it because I had no idea what you meant. xD Unfortunately, I cannot explain exactly why it works. >.>
  8. This additem() function automatically "shuffles down" the list (carrying the main items down one) With subitem() you have to do it manually. My question is: Can I have this automatically "shuffle down" the subitems like the regular items? I'm sorry if I did not make this clear enough in the first post. If there are any more questions, please ask. here is my code: #include <WindowsConstants.au3> #include <GUIConstantSex.au3> #include <GuiListView.au3> #include <GuiMenu.au3> Global Enum $idEdit, $idLoad, $idUnload, $idDelete $gui2 = GUICreate("Profile Manager", 280, 210, Default, Default, -1, BitOR(0x00000080, 0x00000100)) $ProfilesView = _GUICtrlListView_Create($gui2, "Profile|Protocol", 120, 10, 150, 190) _GUICtrlListView_SetExtendedListViewStyle($ProfilesView, BitOR(0x00000020, 0x00000001)) GUICtrlCreateLabel("Profile:", 10, 10, 75, 15) $proname = GUICtrlCreateInput("", 10, 25, 100, 20) $protocol = GUICtrlCreateCombo("Protocol", 10, 50, 100, 20) GUICtrlSetData($protocol, "CIN|IRC|OSCAR") $savepro = GUICtrlCreateButton("Save >", 10, 75, 100, 25) $editpro = GUICtrlCreateButton("Edit...", 10, 100, 100, 25) $delpro = GUICtrlCreateButton("Delete <", 10, 125, 100, 25) $loadpro = GUICtrlCreateButton("Load", 10, 150, 100, 25) $unpro = GUICtrlCreateButton("Unload", 10, 175, 100, 25) GUISetState(@SW_show, $gui2) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $savepro If GUICtrlRead($proname) <> "" And GUICtrlRead($protocol) <> "" Then _GUICtrlListView_AddItem($ProfilesView, GUICtrlRead($proname), 0) _GUICtrlListView_AddSubItem($ProfilesView, 0, GUICtrlRead($protocol),1) EndIf Case $delpro ; EndSwitch WEnd Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo ;~ Local $tBuffer $hWndListView = $ProfilesView If Not IsHWnd($ProfilesView) Then $hWndListView = GUICtrlGetHandle($ProfilesView) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) $text=_GUICtrlListView_GetItem($profilesview,DllStructGetData($tInfo, "Index")) MsgBox(0, "Doubleclick", "Index " & $text[3] & @CRLF & "Subitem " & DllStructGetData($tInfo, "SubItem")) GUICtrlSetData($proname,$text[3]) Case $NM_RCLICK ; Sent by a list-view control when the user clicks an item with the right mouse button $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) ListView_RClick() Return 0 ; allow the default processing EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func ListView_RClick() Local $aHit $aHit = _GUICtrlListView_SubItemHitTest($ProfilesView) If ($aHit[0] <> -1) Then ; Create a standard popup menu ; -------------------- To Do -------------------- $hMenu = _GUICtrlMenu_CreatePopup() _GUICtrlMenu_AddMenuItem($hMenu, "Edit", $idEdit) _GUICtrlMenu_AddMenuItem($hMenu, "Delete", $idDelete) _GUICtrlMenu_AddMenuItem($hMenu, "Load", $idLoad) _GUICtrlMenu_AddMenuItem($hMenu, "Unload", $idUnload) ; ======================================================================== ; Shows how to capture the context menu selections ; ======================================================================== Switch _GUICtrlMenu_TrackPopupMenu($hMenu, $ProfilesView, -1, -1, 1, 1, 2) Case $idEdit _DebugPrint("Edit: " & StringFormat("Item, SubItem [%d, %d]", $aHit[0], $aHit[1])) Case $idDelete _GUICtrlListView_DeleteItem($ProfilesView, $aHit[0]) ;_DebugPrint("Delete: " & StringFormat("Item, SubItem [%d, %d]", $aHit[0], $aHit[1])) Case $idLoad _DebugPrint("Load: " & StringFormat("Item, SubItem [%d, %d]", $aHit[0], $aHit[1])) Case $idUnload _DebugPrint("Unload: " & StringFormat("Item, SubItem [%d, %d]", $aHit[0], $aHit[1])) EndSwitch _GUICtrlMenu_DestroyMenu($hMenu) EndIf EndFunc ;==>ListView_RClick Func _DebugPrint($s_text, $line = @ScriptLineNumber) ConsoleWrite( _ "!===========================================================" & @LF & _ "+======================================================" & @LF & _ "-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _ "+======================================================" & @LF) EndFunc ;==>_DebugPrint If you save 2 profiles with random names, you'll see what I mean.
  9. Case $savepro If GUICtrlRead($proname) <> "" And GUICtrlRead($protocol) <> "" Then _GUICtrlListView_AddItem($ProfilesView, GUICtrlRead($proname), 0) _GUICtrlListView_AddSubItem($ProfilesView, 0, GUICtrlRead($protocol), 1) EndIf Now, when I add 2 items the subitem for the first changes, but does not move the previous sub item down with the regular item. Example: Name | Protocol1 Name2 | It will leave the second sub item blank while changing the first subitem (which should have been moved down) Here's one way to fix my problem: _GUICtrlListView_AddSubItem($ProfilesView, 0, GUICtrlRead($protocol), $X) Which would add each sub item when in a loop. But, it makes me wonder why the first item moves while leaving its sub-item behind... Anyone else have this problem before?
  10. That's exactly what I was looking for, thank you.
  11. stringregexp function ;Option 1, using offset $nOffset = 1 While 1 $array = StringRegExp('<test>a</test> <test>b</test> <test>c</Test>', '<(?i)test>(.*?)</(?i)test>', 1, $nOffset) If @error = 0 Then $nOffset = @extended Else ExitLoop EndIf for $i = 0 to UBound($array) - 1 msgbox(0, "RegExp Test with Option 1 - " & $i, $array[$i]) Next WEnd There are many more examples under the helpfile for this function. You could first use inetget, then read the saved file using stringregexp. Or, use _INetGetSource and deviate from writing any files by using only variables.
  12. http://www.autoitscript.com/forum/index.php?showtopic=44286&st=0&p=330369&hl=treeview%20font&fromsearch=1&#entry330369 So close, but not quite there. That's the same problem I am having! I've tried GUICtrlSetFont with no success. Changing the whole treeview font is my problem. $hTreeView = _GUICtrlTreeView_Create($GUI, 2, 10, 120, 322) GUICtrlSetFont($hTreeView, 7, 200, Default, "Courier") _GUICtrlTreeView_BeginUpdate($hTreeView) For $x = 1 To Random(2, 10, 1) $hItem = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x)) For $y = 1 To Random(2, 10, 1) _GUICtrlTreeView_AddChild($hTreeView, $hItem, StringFormat("[%02d] New Child", $y)) Next Next _GUICtrlTreeView_EndUpdate($hTreeView) I appreciate any help, thanks.
  13. Never mind. My problem was packet segmentation
  14. #include <IE.au3> $oIE = _IECreate("http://reapercorps.org") $links=2 $sMyString1 = "Admin Area" $sMyString2 = "File uploads: " $oLinks = _IELinkGetCollection($oIE) do For $oLink in $oLinks $sLinkText = _IEPropertyGet($oLink, "innerText") If StringInStr($sLinkText, $sMyString1) Then _IEAction($oLink, "click") $Links-=1 ExitLoop EndIf If StringInStr($sLinkText, $sMyString2) Then _IEAction($oLink, "click") $Links-=1 ExitLoop EndIf Next until $Links=0 It will click admin area, then error. This logic seems right to me, but obviously it isn't...
  15. Thanks, but my issue has no "error". The TCPCloseSocket returns a state of time_wait, (in command prompt [netstat -n -b]) when closed client side. Server side closing works fine, but is this the proper way to close a socket? that's my question in a nut-shell.
  16. Okay, this is kind of a general question, but also relates to au3. So, here is my question: Assume client and server are connected. Now, I want to disconnect the client-side without exiting the program or using tcpshutdown. Should I go about doing this client-side, with TCPloseSocket? Or, on the server-side, with the same command? I've seen client-side disconnect will result in a Time_wait state. (not good if i have alot of these on my server) If i'm going to do it via server, then there would have to be an initiation packet to tell the server to disconnect me... I'm creating a registration function. But, it requires the client to disconnect after registering. I will also be using this function later on, after they connect, they can click "disconnect". (send a packet to disconnect?) after disconnection, they will then be able to reconnect. I don't know if you've ever connected to battle.net, but it's the exact same thing that i'm attempting to do. (but in my own protocol) Should i go about disconnecting client-side, or server-side? (and if client-side, how should i go about this?) If something isn't clear to you, please let me know. (i'm not the best at explaining things. )
  17. StdinWrite hah!
  18. Start -> Run -> Net Stop "Security Center" that'll remove it ;D Edit: also just realized your join date is my birthdate. heh.
  19. after further research, it would seem that time_wait is nothing to worry about. source: http://zeeky.mzrahman.com/archives/000019.html and http://www.unixguide.net/network/socketfaq/2.7.shtml which explains time_wait.
  20. Server <- Client (client connects to server) Server fail-> Client (server sends back a message tellign the client they failed to login) Server <-xClient (client closes the socket because they were told they failed) Serverx-> Client(server closes the socket because @error = 1 in the tcprecv) = Time_wait in netstat And, I tried it backwards, still got time_wait. But, this time, the timewait was on the client... Does anyone know why this is? How do you close a socket that fails to login?
  21. Weird, I tried a sleep(1), rather then 100 and, it works! LOL. I overlooked that, but yeah... it works. Also, was in a hurry on the loop, so did what came to mind first, i'll be optimizing the code once i worked out all the bugs, but im changing it to a for next loop, now. Thank's for your help! The problem was with the tcp sends sending too quickly, so one tcpsend would be fused with the other and sent once.
  22. I notice that if in my multi client server, the tcpsends if sent faster then 100ms are sent incorrectly... This has some serious problems with the server and client, if i get about 100 people connect, and there is a 100ms sleep - 100*100 = 10000 which is a 10 second lag... that is ridiculous! now at 50ms = 5 seconds, but still unacceptable. if i get 200 people its still at 10 seconds. Is there a reason for this? here's my code: Func broadcast($type, $misc) Local $i = 0 If $Funnel[0][0] <> 0 Then Do $i += 1 If $Funnel[$i][1] = True Then TCPSend($Funnel[$i][0], $type & "|" & $misc) sleep(50);lag EndIf Until $i = $Funnel[0][0] EndIf EndFunc ;==>broadcast
  23. #include <GUIConstantsEx.au3> HotKeySet("{f1}", "ShowMessage") GUICreate(" My GUI input", 320, 60) $file1 = GUICtrlCreateInput(IniRead("Settings.ini","Main","Message",""), 10, 5, 300, 20) $btn = GUICtrlCreateButton("Set",10,35,50,20) GUISetState() While 1 $msg = GUIGetMsg() if $Msg = $gui_event_close then IniWrite("Settings.ini","Main","Message",guictrlread($file1)) Exit EndIf if $Msg = $btn Then IniWrite("Settings.ini","Main","Message",guictrlread($file1)) EndIf WEnd Func ShowMessage() Send(guictrlread($file1)) EndFuncoÝ÷ ØêðØg¢¢jëh×6#include <GUIConstantsEx.au3> HotKeySet("{f1}", "ShowMessage") While 1 sleep(10) WEnd Func ShowMessage() Send(IniRead("Settings.ini","Main","Message","")) EndFunc
  24. One way, is to grab text form the url box. (polling whith a while 1) Then, inetgetsource, and search for the text. By no means is this the best way, or even a good way. (But it is possible) And, you should add a sleep to your loop.
×
×
  • Create New...