OldCoder Posted March 24, 2011 Posted March 24, 2011 (edited) I've been looking for a way to do this for some time now that wasn't too hard on the system, and while _IsPressed() worked OK, I was worried about the drag it could have on some users' CPUs. I haven't done extensive testing of this, but it seems to work pretty good. Hope this is helpful. AnyKey()<snip>Cheers. Edited March 22, 2013 by Melba23 Code removed "Intelligence is the ability to adapt to change." - Stephen Hawking "...not the ability to exploit others." - OldCoder
iamtheky Posted March 25, 2011 Posted March 25, 2011 how is 2 = Return associated keyboard codes 3 = Return associated keyboard/mouse button codesnot considered a keylogger...I say this prematurely based off the description. ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__)
Ascend4nt Posted March 25, 2011 Posted March 25, 2011 Unfortunately, this API function is totally unreliable due to the way messages are received and pulled from the input buffer. Try Yashied's Hotkey UDF if _IsPressed() won't handle your needs. My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code)
OldCoder Posted March 25, 2011 Author Posted March 25, 2011 (edited) how is not considered a keylogger...I say this prematurely based off the description.I suppose if it was recording keys and not just testing for their switching it might be. Is there some kind of paranoia in these parts about keyloggers? A part of programing, in any language, is the ability to give a user the option to input information into one's program. Without this very fundamental acquisition of data, a very large hole is left in one's programing repertoire. Besides, what's the basic difference between what I have made and _IsPressed()?Unfortunately, this API function is totally unreliable due to the way messages are received and pulled from the input buffer.Try Yashied's Hotkey UDF if _IsPressed() won't handle your needs.Thanks for the advice. I, thus far, have had no problems with this function. It seems to perform well at relatively low CPU consumption.An application can call this function to retrieve the current status of all the virtual keys. The status changes as a thread removes keyboard messages from its message queue. The status does not change as keyboard messages are posted to the thread's message queue, nor does it change as keyboard messages are posted to or retrieved from message queues of other threads. (Exception: Threads that are connected through AttachThreadInput share the same keyboard state.)Of course I've mostly been using it to detect if any key has been pressed on the keyboard or mouse, not to record keys and steal people's passwords. So, it may not be fully tested, and I concede the point. Thanks. Edited March 25, 2011 by OldCoder "Intelligence is the ability to adapt to change." - Stephen Hawking "...not the ability to exploit others." - OldCoder
iamtheky Posted March 25, 2011 Posted March 25, 2011 sorry in retrospect that did appear more accusatory than the question sounded in my head. It certainly does not seem to log keys as they are pressed in any fashion that i can determine, but i also cant get option 0 to return anything but 1 (i was expecting mouse clicks to not do so). ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__)
4Eyes Posted April 8, 2011 Posted April 8, 2011 (edited) OldCoder, I can't get this code to work properly. It always returns 0. With a debugging ConsoleWrite I've found that $t = 0 and that forces a return in the error check code, ie 2nd line of the Func AnyKey(). Is it supposed to wait for a key before returning? Sorry, I don't get it at all. 4Eyes <snip> Edited March 22, 2013 by Melba23 Code removed
OldCoder Posted April 11, 2011 Author Posted April 11, 2011 (edited) OldCoder,I can't get this code to work properly. It always returns 0. With a debugging ConsoleWrite I've found that $t = 0 and that forces a return in the error check code, ie 2nd line of the Func AnyKey().Is it supposed to wait for a key before returning? Sorry, I don't get it at all.4Eyes<snip>Yeah, my bad. I had forgotten to make allotments for no GUI present. Here's an updated code that should work in most, if not all, situations.<snip>Hope that helps. Cheers. Edited March 22, 2013 by Melba23 Code removed "Intelligence is the ability to adapt to change." - Stephen Hawking "...not the ability to exploit others." - OldCoder
RobertKipling Posted March 21, 2013 Posted March 21, 2013 I played with this a bit; my compiler seems mad that the $current_win and $child_hWnd are "possibly used before declaration". Doesn't seem like a big deal, though...
spudw2k Posted March 21, 2013 Posted March 21, 2013 I played with this a bit; my compiler seems mad that the $current_win and $child_hWnd are "possibly used before declaration". Doesn't seem like a big deal, though...Robert,Keep in mind the last posting date was April 11, 2011 so there are bound to be version difference complications considering the age of the example(s). Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
FireFox Posted March 21, 2013 Posted March 21, 2013 (edited) <snip> Edited March 22, 2013 by Melba23 Code removed
Moderators Melba23 Posted March 22, 2013 Moderators Posted March 22, 2013 Hi, This is a keylogger, pure and simple. Thread locked and all code removed. Please read the announcement about keyloggers and remind yourselves what is considered to be one. FireFox's now removed script qualified 100% - please think before posting such things in future. I do not want to come over all heavy, but I will if people keep posting scripts like this. Be warned. 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