News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Sending click buttons.

Started by Nilrem, May 05, 2005, 09:15:17 PM

Previous topic - Next topic

hutch--

I have not kept track of this topic all that well but this needs to be addressed.

Quote
Just because the code could be for malicious intentions doesn't mean I shouldn't be helped. Remember the word maybe. Anything could be turned into malicious code. In another thread I stated it was for a game on pogo.com, this is still the case, it could actually be useful for other stuff, actually most webpages require an authentication number to be inserted. I understand your concerns but I shouldn't be one of them. 8-)

This type of argument carries very little weight here. We require legal coding for postings and its not a matter of debate. If the task you are performing is a legal one, people wil help you but if its not, it will get the axe. When someone asks you the question about what an app is for, please extend them the courtesy of making it known.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Nilrem

I couldn't agree more with you Hutch. I have already stated however that it is for a game on www.pogo.com. 8-)

Nilrem

Ok, things are moving on quite swiftly. One more snag, can anyone spot an error with the below code? the .x and .y have been assigned values (and work fine without sending message but using setcursorpos).


invoke SendMessage, hwndname, WM_LBUTTONDOWN, click_crd.x, click_crd.y


hwndname is working because it works with setforegroundwindow.

mnemonic

Quote from: Nilrem on May 06, 2005, 03:17:40 PM
I couldn't agree more with you Hutch. I have already stated however that it is for a game on www.pogo.com. 8-)
Now it´s time for my 2 cent:
Do you really think that the creator of the game would want that someone uses automation to play one of his games?
If I coded a game I would not want somebody to do such a thing. It would be a waste of bandwith and traffic - that is just internet traffic pollution.

If you are not able to code such a simple thing it´s your personal pitty. Take it or leave it.
If you had asked for help with a legitim task I´d been glad to help you out.

So there is my decission: No help from my side.

Regards
Be kind. Everyone you meet is fighting a hard battle.--Plato
-------
How To Ask Questions The Smart Way

Rifleman

mnemonic,
We think alike.  It is also an exploit as it will lock the game server.  IMO, this is just wrong but I relented because my boss does not care so why should I?

More and more this board is starting to look like another board.  I thought we held to a higher standard, just a pipe dream, I guess!  Anyone want to pass the pipe?
Paul

Nilrem

Well, fair enough. However I must digress that this is as much about personal experience as anything else since there are better programs out there already that accomplish this task.

By the way it isn't an exploit Paul because I am also getting the pixel colour, if the pixel colour matches then the button is there, if it isn't (you have to wait 24 seconds between each game round), then no clicks are sent. Careful what you are saying as no-one likes slander and I am obviouslly not coding an exploit, if you think I am then just stay well away from this topic, like I said there are already programs out there that accomplish this task. I am simply trying to improve my coding skills my applying it to something practical - "I hear and I forget, I see and I remember, I do and I understand".

Now, back to the topic, anything wrong with this code?

invoke SendMessage, hwndname, WM_LBUTTONDOWN, click_crd.x, click_crd.y


Silly me:

invoke SendMessage, hwndname, WM_LBUTTONDOWN, click_crd.x, click_crd.y
invoke SendMessage, hwndname, WM_LBUTTONUP, click_crd.x, click_crd.y

However it isn't working.. hmm...

pbrennick

Nilrem,
I aint changing my mind and I aint staying away from your topics!  Nice try, I bet you would like that.

Paul

Mark Jones

Maybe after a person actually puts days, weeks, months of their life and soul into coding a real application, they'll appreciate programming more. Especially after someone cracks it and waves their broken baby around like a piece of fresh meat...

I am not going to help anyone with an inherently exploitable project, sorry. If someone has a problem with that, they can talk to my lawyer. :U
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

pbrennick

Hey Mark!

I did not realize we have the same lawyer!

Paul

sluggy

I am going to reply to this thread for two reasons:

- a perfectly legitimate use for this sort of thing is for automated testing of web pages

- some of the answers given so far are so close to being outright wrong that it annoys me.

The correct methodology to use here is to write a Browser Help Object, and use the IE DOM to access the control and its events. Technically you don't even need the BHO, i have seen (and used) scripts that attach themselves to the IE process and manipulate the DOM.
In my (not so humble) opinion, to do it any other way is both amateurish and an unreliable hack. IE is a complex beast, if possible one should use its APIs to do the job correctly.

mnemonic

Quote from: sluggy on May 06, 2005, 10:41:11 PM
I am going to reply to this thread for two reasons:

- a perfectly legitimate use for this sort of thing is for automated testing of web pages
If it would be one of your pages I would agree, but it is not, so what?!

Quote from: sluggy on May 06, 2005, 10:41:11 PM
- some of the answers given so far are so close to being outright wrong that it annoys me.
Indeed.

Quote from: sluggy on May 06, 2005, 10:41:11 PM
The correct methodology to use here is to write a Browser Help Object, and use the IE DOM to access the control and its events. Technically you don't even need the BHO, i have seen (and used) scripts that attach themselves to the IE process and manipulate the DOM.
In my (not so humble) opinion, to do it any other way is both amateurish and an unreliable hack. IE is a complex beast, if possible one should use its APIs to do the job correctly.
This is just a mask you`d put on to hide your purposes.

Regards, Jens

EDIT:
I´d like seeing this thread going to the scrap heap. Thx.
I won´t do anybodys homework nor be anybodys hacking buddy.
Be kind. Everyone you meet is fighting a hard battle.--Plato
-------
How To Ask Questions The Smart Way

sluggy

#26
Quote from: mnemonic on May 07, 2005, 04:21:10 AMEDIT:
I´d like seeing this thread going to the scrap heap. Thx.
I won´t do anybodys homework nor be anybodys hacking buddy.
This thread is not going to the scrap heap. Programmatically manipulating a web page is not hacking, especially if all you are doing is trying to is things like trigger a button press, as if you were sitting at the console yourself. If i serve a web page, and someone wants to programmatically click a link or button on that page, then good luck to them.

Like many things, the ideas discussed here could be used for illegal purposes, which we in no way condone. A car can easily be used  illegally, yet it is still legal to teach people to drive, and billions of people do drive. Let's not over react, and try to use some common sense here. The task that Nilrem is trying to achieve is not easy, i would rather that he was taught the right way to do it than the wrong way.



pbrennick


mnemonic

Quote from: sluggy on May 07, 2005, 05:28:27 AM
Quote from: mnemonic on May 07, 2005, 04:21:10 AMEDIT:
I´d like seeing this thread going to the scrap heap. Thx.
I won´t do anybodys homework nor be anybodys hacking buddy.
This thread is not going to the scrap heap. Programmatically manipulating a web page is not hacking, especially if all you are doing is trying to is things like trigger a button press, as if you were sitting at the console yourself. If i serve a web page, and someone wants to programmatically click a link or button on that page, then good luck to them.

Like many things, the ideas discussed here could be used for illegal purposes, which we in no way condone. A car can easily be used  illegally, yet it is still legal to teach people to drive, and billions of people do drive. Let's not over react, and try to use some common sense here. The task that Nilrem is trying to achieve is not easy, i would rather that he was taught the right way to do it than the wrong way.
You´re right.
Please ignore my previous post.
Drinking and posting is something that is no good... sometimes I should just pull the power plug of my machine so I can´t access it anymore...

EDIT:
Pitty me... I forgot to say I´m sorry... so: Sorry :wink
Be kind. Everyone you meet is fighting a hard battle.--Plato
-------
How To Ask Questions The Smart Way

Nilrem

It's all good mnemonic. 8-)
Sluggy I appreciate you trying to help me, but if this road I am taking actually works then why is it wrong? The method maybe sloppy and inefficient but before going off and learning DOM that you speak off I would like to keep it simple, then once this code is working begin improvements (utilising DOM for example).

Here is my newest code, it doesn't click though unfortunately.


DlgProc proc hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
LOCAL pt:POINTS
mov eax,uMsg
.if eax==WM_INITDIALOG
mov eax, 464 ; put 465 in loword
shl eax, 16     ; shift it into hiword
mov ax, 273   ; now put 273 in loword
mov position, eax ; put resultant value into variable.
.elseif eax==WM_COMMAND
mov eax,wParam
.if (eax==1001) ; GETPOS Button.
mov beenclicked, 1
invoke SetCapture,hWin
.elseif (eax==1002) ; START Button.
;invoke SetCapture, hWin
invoke SetForegroundWindow, hwndname
invoke SendMessage, hwndname, WM_SYSCOMMAND, SC_RESTORE, 0
invoke SetWindowPos, hwndname, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE
;invoke MessageBox, hWin, ustr$(click_crd.x), ustr$(click_crd.y), MB_OK, 465, 273
;invoke GetPixel, hwndname, 465, 273
;mov Pixel, eax
;invoke SetCursorPos, click_crd.x, click_crd.y
;invoke MessageBox, hWin, ustr$(Pixel), NULL, MB_OK
;invoke Sleep, 500
invoke SetCursorPos, 273, 464
invoke Sleep, 500
invoke SendMessage, hwndname, WM_LBUTTONDOWN, MK_LBUTTON, position
invoke Sleep, 500
invoke SendMessage, hwndname, WM_LBUTTONUP, MK_LBUTTON, position
;invoke MessageBox, hWin, ustr$(click_crd.x), ustr$(click_crd.y), MB_OK
;invoke ReleaseCapture
.endif
.elseif (eax==WM_LBUTTONDOWN)
cmp beenclicked,1
jnz @f
invoke Sleep, 500
invoke GetForegroundWindow
mov hwndname, eax
.if (eax==NULL)
invoke MessageBox,NULL,NULL,NULL,MB_OK
.endif
;invoke GetDC, hwndname
;mov hdcontext, eax
;invoke GetPixel, hdcontext, click_crd.x, click_crd.y
;invoke SetCursorPos, click_crd.x, click_crd.y
;invoke GetPixel, hdcontext, 259, 464
;mov Pixel, eax
;invoke GetCursorPos, ADDR click_crd
;invoke SetCursorPos, 259, 464
invoke ReleaseCapture
mov beenclicked, 0
@@:
.elseif (eax==WM_RBUTTONDOWN)
cmp beenclicked, 1
jnz @f
invoke GetCursorPos, ADDR click_crd
invoke MessageBox, hWin, ustr$(click_crd.x), ustr$(click_crd.y), MB_OK
mov beenclicked, 1
@@:
.elseif eax==WM_CLOSE
;invoke ReleaseCapture
invoke EndDialog,hWin,0
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret

DlgProc endp