![]() |
|
[C#] Put dynamically generated image with no ID into picturebox from webbrowser? - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [C#] Put dynamically generated image with no ID into picturebox from webbrowser? (/showthread.php?tid=5447316) Pages: Pages
1
2
|
Put dynamically generated image with no ID into picturebox from webbrowser? - Lord - Oct 28, 2016 I am working on something and it involves captchas. The captcha has no ID and is obviously dynamically generated. I have been able to get the src from the tag with this: Code foreach (HtmlElement El in GeneratorBrowser.Document.GetElementsByTagName("img"))That sadly doesn't work since when I go to the src link in my browser it responds with a 404 page. I have also tried this Code IHTMLDocument2 doc = (IHTMLDocument2)GeneratorBrowser.Document.DomDocument;![]() Anyone know how I could do this? * - SL x TnT - Oct 28, 2016 What's the website? With that, it won't be too hard to figure it out. * - Lord - Oct 28, 2016 (Oct 28, 2016 07:50 PM)SL x TnT Wrote: What's the website? With that, it won't be too hard to figure it out. I'd rather not put the website out there. But I know for a fact directly trying to go to the image link won't work at all. Here's a snippet for the captcha Code <div class="col-xs-9">* - SL x TnT - Oct 28, 2016 (Oct 28, 2016 07:56 PM)That One Random Wrote: I'd rather not put the website out there. Either a) That captcha is valid for 1 request. b) You're missing something. Without the website to test on, it'll purely be guesswork. * - Lord - Oct 28, 2016 (Oct 28, 2016 08:34 PM)SL x TnT Wrote: Either Maybe I am missing something. https://signup.live.com * - mrkoolaid - Oct 28, 2016 normally when I am working with images and the red x of death hits the box it means one of my images isn't actually an image. maybe the bytes weren't all there or out of order or maybe the stream is closing before reading to the end. also might i suggest, if your breaking a captcha there may be an easier way around it orrrr switch to a client based language or some kind of browser plugin (xul, etc) * - SL x TnT - Oct 28, 2016 (Oct 28, 2016 09:03 PM)That One Random Wrote: Maybe I am missing something. Clicking "new" captcha calls a URL. That returns some JS that's executed. In that JS you have Code G: {That url is good for 1 request. Won't be useful for a browser though. Use Code Clipboard.GetImage();or get rid of the using statement. Issue 1: Captcha is only valid for a single request. Issue 2: You're disposing of your image. My VS threw an exception. Dispose of it later. I took a closer look. Line 32 of their source: Code var $Config= ...That contains the URL for the JS that calls the image. Get that source, pull the image url, grab the image that way. Everything in the POST data can be found in the source except the "CipherValue." Figure that out, and you can ditch the webbrowser. * - Lord - Oct 28, 2016 (Oct 28, 2016 10:04 PM)SL x TnT Wrote: Clicking "new" captcha calls a URL. That returns some JS that's executed. Holy shit I love you. I can't believe I was overlooking such a small thing. Changed my code to Code IHTMLDocument2 doc = (IHTMLDocument2)GeneratorBrowser.Document.DomDocument;* - Ninja - Oct 29, 2016 You shouldn't use the Clipboard method really, as what if the user is working on something and has the program running in the background and he copies something important and then your program copies a captcha image. * - Lord - Oct 29, 2016 (Oct 29, 2016 09:31 AM)Ninja Wrote: You shouldn't use the Clipboard method really, as what if the user is working on something and has the program running in the background and he copies something important and then your program copies a captcha image. Do you have another way? I already added a "clipboard backup" type thing. It'll restore it to whatever it was before hand. * - Ninja - Oct 29, 2016 (Oct 29, 2016 02:47 PM)That One Random Wrote: Do you have another way? Im sure there is another way. Try Googling it. * - Lord - Oct 29, 2016 (Oct 29, 2016 06:46 PM)Ninja Wrote: Im sure there is another way. Try Googling it. I have been googling. Haven't been able to find anything that works aside from this. Been trying for quite a while now. * - SL x TnT - Oct 29, 2016 (Oct 29, 2016 06:46 PM)Ninja Wrote: Im sure there is another way. Try Googling it. It's not really a question that can be solved on Google. The correct answer is to not use a webbrowser. Second correct answer is to get the image url and request it (not possible in this case). Third is screenshot. Fourth is copy. - Somehow block the image request. Request it yourself. - Take the cookies from the browser, request a new captcha, grab image. Modify other values to point to new captcha. - - I'm not even sure this will even work. - Take a screenshot of the captcha. <- Might be the best possible solution. They all have their issues. * - Lord - Oct 29, 2016 (Oct 29, 2016 07:06 PM)SL x TnT Wrote: It's not really a question that can be solved on Google. The correct answer is to not use a webbrowser. Second correct answer is to get the image url and request it (not possible in this case). Third is screenshot. Fourth is copy. Personally I think with the route I plan on taking what I am doing right now is fine. I have it setting the clipboard back so there's no problem with someone losing their old clipboard contents. * - SL x TnT - Oct 29, 2016 (Oct 29, 2016 07:16 PM)That One Random Wrote: Personally I think with the route I plan on taking what I am doing right now is fine. It does come out to a race condition. There's a possibility that someone might copy something new or paste during the time between the copy and restore. That's why a screenshot might be the best solution in this case. It'll just take a little bit of work. |