Jump to content

SkinnyWhiteGuy

Active Members
  • Posts

    413
  • Joined

  • Last visited

About SkinnyWhiteGuy

  • Birthday 10/15/1984

Profile Information

  • Member Title
    Feed the bunny!
  • Location
    Mississippi
  • Interests
    Programming, Scripting, Gaming, and all things Computers

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

SkinnyWhiteGuy's Achievements

Universalist

Universalist (7/7)

3

Reputation

  1. I spent some time looking on the forums for this, but didn't see where any one else was doing it. Is there a way, with this, to create COM Objects that respond to events? I was hoping to use trancexx's earlier example of how to create your own com server to make a plugin for a program, and just register for events that come from it so it can scan/do what it needs, and send back events when something interesting occurs, but I can't find any examples or hints as to how to do so with COM events (using ObjEvent() ).
  2. I was digging around some of my old code, and found this. Cleaned it up a little, and ensured it worked again. I used Call on these, so with one HMAC function, you could use different hashing algorithms. Course, you'll have to modify the BlockSize for some hashing functions, but that's easily made an optional parameter and passed in for the larger block sizes of some hashing functions. It's also just as easy to remove the calls for the actual hash functions, if that's what you want. #include <Crypt.au3> Func sha1($message) Return _Crypt_HashData($message, $CALG_SHA1) EndFunc Func md5($message) Return _Crypt_HashData($message, $CALG_MD5) EndFunc Func hmac($key, $message, $hash="md5") Local $blocksize = 64 Local $a_opad[$blocksize], $a_ipad[$blocksize] Local Const $oconst = 0x5C, $iconst = 0x36 Local $opad = Binary(''), $ipad = Binary('') $key = Binary($key) If BinaryLen($key) > $blocksize Then $key = Call($hash, $key) For $i = 1 To BinaryLen($key) $a_ipad[$i-1] = Number(BinaryMid($key, $i, 1)) $a_opad[$i-1] = Number(BinaryMid($key, $i, 1)) Next For $i = 0 To $blocksize - 1 $a_opad[$i] = BitXOR($a_opad[$i], $oconst) $a_ipad[$i] = BitXOR($a_ipad[$i], $iconst) Next For $i = 0 To $blocksize - 1 $ipad &= Binary('0x' & Hex($a_ipad[$i],2)) $opad &= Binary('0x' & Hex($a_opad[$i],2)) Next Return Call($hash, $opad & Call($hash, $ipad & Binary($message))) EndFunc ConsoleWrite(hmac("key", "the", "sha1") & @CRLF) Edit: Firefox ate my post, had to fix...
  3. I normally just lurk for long periods of time, but I saw this topic, and decided to post here. I looked into what it would take to properly implement SSL/TLS in Autoit. You have working sockets that would do for the connecting, the hard part comes in with the encryption. SSL and TLS encrypt all communication, so you'll need to implement or use someone's encryption algorithms right before sending/after receiving anything over the sockets. Having translated some different encryption algorithms myself, I can tell you it's not that easy. Another thing you'll have to fight with is compression, which is ZLib if I recall correctly, the deflate algorithm specifically. I keep trying to talk myself into converting it into pure AutoIt code, but I always decide I have better uses of my time. Best solution you might find is DLL's with some of these needed functions already implemented in them, so you get their raw speed. You'll still have to handle managing keys, sessions, and all that, but it's the only solution currently available. If you really want to try to tackle doing all this, here's the route I took to see what all it would take. SSL and TLS are usually used with the OpenSSL project, and is a very nice project to browse through the source of it. Of course, not everyone reads C code that well, and even less so translates it into a scripting language. So, the best thing to do is find another scripted solution, and see if that could be used. In my searches, the only one that didn't just call the OpenSSL installed on most systems were some Javascript implementations of SSL/TLS. Googling for "Javascript SSL" is the fastest way to find several of the attempts at doing this, and they give information on how they did it, as well as share more source to browse and build an AutoIt clone from as well. They do use a lot of libraries from others, some of which there are no AutoIt counterparts, which means you'd need to either build those libraries as well, or at least enough of them for your purposes. As for the helpfulness of this forum, as I started off with, I lurk far more than I post, and search even more than that. I've been around for a number of years, and haven't found many situations where the code I'm writing is complex enough where no one has ever asked, even in part, about what I am attempting to do. I may have had to change my search terms a few times, and look for other things related to what I'm looking for, and I've also had to follow links to external places for other things as well. I will have to say that, if one searches hard enough, you'll likely find at least parts of what you need here on this forum, long before you ever have to ask a question. Very few other places can boast such a thing, so I would say this forum is extremely helpful, even before asking a question. Whether new people provide answers or not shouldn't matter, as the forum shouldn't be just the people who currently happen to be reading the forum at this time. Hopefully this is useful to not only you, but any one else who tries to work out SSL/TLS within AutoIt.
  4. Reread the DllCall help entry, the result variable you have doesn't work the way you are using it.
  5. That is actually pretty easy. Just need to send back a string with the numbers delimited by 0xA7. The wiki referenced above has 3 different scripts that show how to do it, I just didn't do it yet.
  6. Look at some of the recent news for it. 3D printers recreating minecraft worlds, Lego is going to research creating a Minecraft line, etc...
  7. Since I'm helping some with this, I'll try to see if I can explain what I think is the goal: You could have a virtual house like your own, that you could do things in, and have them happen in your real house as well. Flip a switch on a wall in minecraft, the lights come on in your house. That type of thing. Of course, this project on its own can not do all of that. There will need to be other parts, where AutoIt calls Arduino or other things that do the actual light controls, or other things. I just liked the idea of the server part of it myself, and that's where I like to play most of the time any way. Someone else might be better with the 2nd part of this setup.
  8. I had some time, and some time to think: Local $bData = Binary("0x00000001") Local $sType = "int" ConsoleWrite(LittleEndian($bData, $sType) & @CRLF) ConsoleWrite(BigEndian($bData, $sType) & @CRLF) Func LittleEndian(ByRef $byte_stream, $type) Local $temp = DllStructCreate($type), $output = DllStructCreate("byte[" & DllStructGetSize($temp) & "]", DllStructGetPtr($temp)) DllStructSetData($output, 1, BinaryMid($byte_stream, 1, DllStructGetSize($temp))) ;~ $byte_stream = BinaryMid($byte_stream, 1 + DllStructGetSize($temp)) Return DllStructGetData($temp, 1) EndFunc Func BigEndian(ByRef $byte_stream, $type) Local $temp = DllStructCreate($type), $output = DllStructCreate("byte[" & DllStructGetSize($temp) & "]", DllStructGetPtr($temp)) For $i = DllStructGetSize($temp) To 1 Step -1 DllStructSetData($output, 1, BinaryMid($byte_stream, $i, 1), DllStructGetSize($temp) - $i + 1) Next ;~ $byte_stream = BinaryMid($byte_stream, 1 + DllStructGetSize($temp)) Return DllStructGetData($temp, 1) EndFunc Obviously, uncomment the lines in the functions to give it back the stream forwarding option the other one had.
  9. I play Minecraft too, I might have to try out your script and see what it's doing. Try it and see what it returns, if the numbers/data doesn't look right, I might can help get it flipped back around.
  10. Found a copy of that function on my laptop: Local $bData = Binary("0x00000001") ConsoleWrite(LoadState($bData, "int") & @CRLF) Func LoadState(ByRef $byte_stream, $type) If $type = "string" Then Local $size = LoadState($byte_stream, "int") Return LoadState($data, "char[" & $size - 1 & "]") EndIf Local $temp = DllStructCreate($type), $output = DllStructCreate("byte[" & DllStructGetSize($temp) & "]", DllStructGetPtr($temp)) DllStructSetData($output, 1, BinaryMid($byte_stream, 1, DllStructGetSize($temp))) $byte_stream = BinaryMid($byte_stream, 1 + DllStructGetSize($temp)) Return DllStructGetData($temp, 1) EndFunc This version was made to take the data off the Binary Stream coming in, so you could call it multiple times to pull out different values. Just as a note: this will pull values from the Binary data as Little Endian order (which from my Wikipedia searching is what Windows stores things as). If you need it as Big Endian, you will have to do some massaging of the data.
  11. I played a lot with the Binary functions with the Encryption stuff I did. If I recall, it was making sure both parts of the concatenation were Binary, so something like this: Local $bFirst = "0x01020304" Local $bSecond = "0x05060708" ConsoleWrite(Binary($bFirst) & Binary($bSecond) & @CRLF) @JRSmile, yes, you can do that. While using DLLStructCreate(), just use it's pointer option to point to the other struct's pointer, like this: Local $tBinary1 = DllStructCreate("byte[4]") Local $tInt1 = DllstructCreate("int", DllStructGetPtr($tBinary1)) Local $iNumber = DllStructGetData($tInt1, 1) I think I remember writing a func that I could pass arbitrary Binary data into, and a type, and it took care of creating structs, getting pointers, and just returned the data I was looking for. If no one else thinks of it before I can get home and find it, I'll try to post it here.
  12. Or just remove the ExitLoop call at the bottom, and put the MsgBox printing there. It'd pause on each error, and show it. As suggested further up, adding the name of the device to the output on each loop would be handy as well. I'm fixing it up for my purposes right now.
  13. Only because I ran into this just the other day myself, I can tell you the answer. The errors are complaining that those 4 variables were already declared somewhere else, in some other include. The official includes (I believe SecurityConstants.au3) was updated to include these variables where it didn't before. You should be able to go in Services.au3 and comment them out/delete them and solve your problem. There's another one that was named different from the AutoIt version and this file's version. I forget which one it is, but it was used only one other time in Services.au3.
  14. I like the new looks of it. The extra white space is a little much, but I can see how it can work. Looking at the source for the 3.3.6.1 help files, those extra line breaks were there already. It looks like they were needed with the old style, but not as much now.
  15. Local $objWMIService = $objWMILocator.ConnectServer($host, "rootcimv2", $usr, $pass, "", "", "&H80") This might need to be: Local $objWMIService = $objWMILocator.ConnectServer($host, "rootcimv2", $usr, $pass, Default, Default, 128) &H80 is the way VBScript does Hex Numbers, so for AutoIt, it would be 0x80, which is the same number as 128. I've used it with success along with ConnectServer.
×
×
  • Create New...