I saw some guy had a file (I guess a batch file). On clicking of the batch file he was able to log in to multiple sites. (Perhaps it was done using VB.)
I looked for such a script on Google but didn't find anything useful.
I know a bit of C++ and UNIX (also some HTML and JavaScript). I don't know if it can be done on a windows machine using these languages, but even if it could be done I think it would be difficult compared to VB or C## or some other high level languages.
I learned how to open multiple sites using basic windows batch commands enclosed in a batch file like:
start http://www.gmail.com
start http://stackoverflow.com
But still I can't figure out how actually clicking on the batch file would help me to log in to the sites without even typing the username and password.
Do I need to start learning Visual Basic, .NET, or windows batch programming to do this?
One more thing: can I also use it to log in to remote desktops?
From the term "automatic login" I suppose security (password protection) is not of key importance here.
The guidelines for solution could be to use a JavaScript bookmark (idea borrowed form a nice game published on M&M's DK site).
The idea is to create a javascript file and store it locally. It should do the login data entering depending on current site address. Just an example using jQuery:
// dont forget to include jQuery code
// preferably with .noConflict() in order not to break the site scripts
if (window.location.indexOf("mail.google.com") > -1) {
// Lets login to Gmail
jQuery("#Email").val("youremail#gmail.com");
jQuery("#Passwd").val("superSecretPassowrd");
jQuery("#gaia_loginform").submit();
}
Now save this as say login.js
Then create a bookmark (in any browser) with this (as an) url:
javascript:document.write("<script type='text/javascript' src='file:///path/to/login.js'></script>");
Now when you go to Gmail and click this bookmark you will get automatically logged in by your script.
Multiply the code blocks in your script, to add more sites in the similar manner. You could even combine it with window.open(...) functionality to open more sites, but that may get the script inclusion more complicated.
Note: This only illustrates an idea and needs lots of further work, it's not a complete solution.
The code below does just that. The below is a working example to log into a game. I made a similar file to log in into Yahoo and a kurzweilai.net forum.
Just copy the login form from any webpage's source code. Add value= "your user name" and value = "your password". Normally the -input- elements in the source code do not have the value attribute, and sometime, you will see something like that: value=""
Save the file as a html on a local machine double click it, or make a bat/cmd file to launch and close them as required.
<!doctype html>
<!-- saved from url=(0014)about:internet -->
<html>
<title>Ikariam Autologin</title>
</head>
<body>
<form id="loginForm" name="loginForm" method="post" action="http://s666.en.ikariam.com/index.php?action=loginAvatar&function=login">
<select name="uni_url" id="logServer" class="validate[required]">
<option class="" value="s666.en.ikariam.com" fbUrl="" cookieName="" >
Test_en
</option>
</select>
<input id="loginName" name="name" type="text" value="PlayersName" class="" />
<input id="loginPassword" name="password" type="password" value="examplepassword" class="" />
<input type="hidden" id="loginKid" name="kid" value=""/>
</form>
<script>document.loginForm.submit();</script>
</body></html>
Note that -script- is just -script-. I found there is no need to specify that is is JavaScript. It works anyway. I also found out that a bare-bones version that contains just two input filds: userName and password also work. But I left a hidded input field etc. just in case. Yahoo mail has a lot of hidden fields. Some are to do with password encryption, and it counts login attempts.
Security warnings and other staff, like Mark of the Web to make it work smoothly in IE are explained here:
http://happy-snail.webs.com/autologinintogames.htm
I used #qwertyjones's answer to automate logging into Oracle Agile with a public password.
I saved the login page as index.html, edited all the href= and action= fields to have the full URL to the Agile server.
The key <form> line needed to change from
<form autocomplete="off" name="MainForm" method="POST"
action="j_security_check"
onsubmit="return false;" target="_top">
to
<form autocomplete="off" name="MainForm" method="POST"
action="http://my.company.com:7001/Agile/default/j_security_check"
onsubmit="return false;" target="_top">
I also added this snippet to the end of the <body>
<script>
function checkCookiesEnabled(){ return true; }
document.MainForm.j_username.value = "joeuser";
document.MainForm.j_password.value = "abcdef";
submitLoginForm();
</script>
I had to disable the cookie check by redefining the function that did the check, because I was hosting this from XAMPP and I didn't want to deal with it. The submitLoginForm() call was inspired by inspecting the keyPressEvent() function.
You can use Autohotkey, download it from: http://ahkscript.org/download/
After the installation, if you want to open Gmail website when you press Alt+g, you can do something like this:
!g::
Run www.gmail.com
return
Further reference: Hotkeys (Mouse, Joystick and Keyboard Shortcuts)
Well, its true that we can use Vb Script for what you intended to do.
We can open an application through the code like Internet Explorer. We can navigate to site you intend for. Later we can check the element names of Text Boxes which require username and password; can set then and then Login. It works fine all of using code.
No manual interaction with the website. And eventually you will end up signing in by just double clicking the file.
To get you started :
Set objIE = CreateObject("InternetExplorer.Application")
Call objIE.Navigate("https://gmail.com")
This will open an instance of internet explore and navigate to gmail.
Rest you can learn and apply.
Related
Hello when i Submit a Form Sometimes i got a Google captcha verification failed.
is there a way to not have this error or Skip Recaptcha or make it alway's True ?
Html :
<input type="hidden" name="g-recaptcha-response" id="g-recaptcha-response" value="03AOLTBLR2tBWnlAhqZlqeMmv3PY_T-cezG63SPaDcC_VcWMBkSt60VvSkHjogTxtAoRhRiPoEglg6whL8vIzUkXEYVKd3Blcyw1TQjMMQmYTbL9u0bwmcJ2utefrU3aMU8hx8Z9MMYOAWPwELIM7RRLybXVVr0T10UeYoBAg-xQffwyTqFo9t_JvcfSHeFkqfoAAodv35I4dBdTP-qtte9BQXR_WLT5F0y53dY0IHU1l3N8wjWYQUkr2ybQcH0gs0C_j4xi4lHbkGU8gJXc-XHBxkIeR56_IsCZ-nUzlTdzCLE968JoCUBI-IXA1DSavS_mBPBONUmfrxFn5guR5gQA2Zfbw0RQLCWe1mRM5j8J7WcL77VHwH6tBWUUPjCXDLAwRFsIhB66OWGG1x2nWE8p5xtt21Gsw93wcsDL3e5qNWQurOd9oHS6_UTeE3_FcFID7Ijld6kXIVCNA97o0oKVOwiGNOiwPdv6wvQZZnAiYb-QX2B2TzuWbvYHf22gBj2t_HK2ozhsXy4ujmoY0XOSlmCsbemu5Y0A">
this is the Form Id html :
<form name="agxthird" id="agxthird" action="" method="post" autocomplete="off">
is there a way to Aviod this on Jquery or Js
If you are the developer, you can add in a flag to - for example - load the recaptcha unless there is a testing parameter in the URL or something like that. Although this is not advised if this code is in production.
Also, try a different browser and ensure you aren't using any automation/controlling software like Puppeteer.
Otherwise there's not much you can do.
I am trying to automatize some SAP Job monitoring with Python. I want to create a script that should do the following:
Connect and login the SAP environment -> Open SM37 transaction -> Send job parameters (name-user-from-to) -> Read the output and store it into a database.
I don't know about any module or library that allow me to do that. So I checked the WEBGUI is already enabled. I am able to open the environment through a Browser. A browsing module should allows me to do everything I need.
Tried with Mechanize and RoboBrowser. It works but the WEBGUI runs a lot of javascript for renderize and those modules doesn't handle javascript.
There is one more shot: Selenium.
I was able to connect and login to the environment. But when trying to select an element from new page (main menu), Selenium cannot locate the element.
Printing the sourcecode I realized that the Main Menu site is rendered with javascript. The sourcecode doesn't contains the element at all, only the title ("Welcome "). That means the login was successfull.
I read a lot of posts asking for this, and everybody reccommend to use WebDriverWait with some explicit conditions.
Tried this, didn't work:
driver.get("http://mysapserver.domain:8000/sap/bc/gui/sap/its/webgui?sap-client=300&sap-language=ES")
wait = WebDriverWait(driver, 30)
element = wait.until(EC.presence_of_element_located((By.ID, 'ToolbarOkCode')))
EDIT:
There are two sourcecodes: SC-1 is the one that Selenium reads. SC-2 is the one that appears once the javascript renders the site (the one from "Inspect Element").
The full SC-1 is this:
https://pastebin.com/5xURA0Dc
The SC-2 for the element itself is the following:
<input id="ToolbarOkCode" ct="I" lsdata="{0:'ToolbarOkCode',1:'Comando',4:200,13:'150px',23:true}" lsevents="{Change:[{ClientAction:'none'},{type:'TOOLBARINPUTFIELD'}],Enter:[{ClientAction:'submit',PrepareScript:'return\x20its.XControlSubmit\x28\x29\x3b',ResponseData:'delta',TransportMethod:'partial'},{Submit:'X',type:'TOOLBARINPUTFIELD'}]}" type="text" maxlength="200" tabindex="0" ti="0" title="Comando" class="urEdf2TxtRadius urEdf2TxtEnbl urEdfVAlign" value="" autocomplete="on" autocorrect="off" name="ToolbarOkCode" style="width:150px;">
Still can't locate the element. How can I solve it?
Thanks in advance.
The solution was to go into the iframe that containts the renderized html (with the control).
driver2.get("http://mysapserver.domain:8000/sap/bc/gui/sap/its/webgui?sap-client=300&sap-language=ES")
iframe = driver2.find_elements_by_tag_name('iframe')[0]
driver2.switch_to_default_content()
driver2.switch_to_frame(iframe)
driver2.find_element_by_id("ToolbarOkCode").send_keys("SM37")
driver2.find_element_by_id("ToolbarOkCode").send_keys(Keys.ENTER)
I'm trying to send invoke email when button is clicked and its working fine but extra window is getting opened during the process and i'm unable to close it even though I have tried close method. I have tried in IE 10 and IE 11 and its not working.
Below is the code
<html>
<head>
<script type='text/javascript'>
function sendMail(){
var wi = window.open('mailto:someone#example.com?subject=' + encodeURIComponent(document.getElementById("metric").value));
wi.close();
}
</script>
</head>
<body>
<h4>Send e-mail to committee with below subject:</h4>
<form action="javascript:sendMail()" method="post" enctype="text/plain">
<select id="metric">
<option value="test1">test1</option>
<option value="test2">test2</option>
</select>
<br><br>
<input type="submit" value="Send">
<p></p>
</form>
</body>
</html>
I'm going to go ahead and say this isn't how you'd go about it.
A mailto: link opens the user's default email client. If you remove the attempt to close the window in your script, you'll see this happen. But to do anything useful, you'd have to fill out the mail along with sender etc.
So the user will need to trigger the actual send in their email client.
What you would typically do is send the request to the server, and have the server use the SMTP service (pretty much all of them have it now) to put together and send the email out. It's simple to do, how exactly it works depends on what server you are going to be hosting your solution on.
To my knowledge there is no pure javascript/server-less way to do this. If you think about it, this makes sense; what would prevent somebody from putting a script in a webpage that sends out a thousand emails based on something you collected from the webpage?
I was wondering how I would get the name of the current user in JavaScript as part of an HTML document.
In Java, one would type System.getProperty("user.name"); to achieve this. What is the alternative to this in JavaScript?
JavaScript runs in the context of the current HTML document, so it won't be able to determine anything about a current user unless it's in the current page or you do AJAX calls to a server-side script to get more information.
JavaScript will not be able to determine your Windows user name.
There is no fully compatible alternative in JavaScript as it posses an unsafe security issue to allow client-side code to become aware of the logged in user.
That said, the following code would allow you to get the logged in username, but it will only work on Windows, and only within Internet Explorer, as it makes use of ActiveX. Also Internet Explorer will most likely display a popup alerting you to the potential security problems associated with using this code, which won't exactly help usability.
<!doctype html>
<html>
<head>
<title>Windows Username</title>
</head>
<body>
<script type="text/javascript">
var WinNetwork = new ActiveXObject("WScript.Network");
alert(WinNetwork.UserName);
</script>
</body>
</html>
As Surreal Dreams suggested you could use AJAX to call a server-side method that serves back the username, or render the HTML with a hidden input with a value of the logged in user, for e.g.
(ASP.NET MVC 3 syntax)
<input id="username" type="hidden" value="#User.Identity.Name" />
If the script is running on Microsoft Windows in an HTA or similar, you can do this:
var wshshell=new ActiveXObject("wscript.shell");
var username=wshshell.ExpandEnvironmentStrings("%username%");
Otherwise, as others have pointed out, you're out of luck. This is considered to be private information and is not provided by the browser to the javascript engine.
I think is not possible to do that. It would be a huge security risk if a browser access to that kind of personal information
Working for me on IE:
<script type="text/javascript">
var WinNetwork = new ActiveXObject("WScript.Network");
document.write(WinNetwork.UserName);
</script>
...but ActiveX controls needs to be on in security settings.
I have a site which is running in 3 web servers and it is accessed via load balanced URL. The site has a code to display web server name something like this <!-- Machine Name= WEBSERVER1 --> (in case the site is accessed from web server1), in case of web server2 it would be <!-- Machine Name= WEBSERVER2--> I can find where the site is running by doing view source and searching for machine name text. However i was wondering if i could create a bookmarklet which when clicked would give me the machine name.
Does anyone know if that is even possible?
Thanks.
In your server-side code add something like :
<script>
var SERVER_NAME="server1";
</script>
and in the browser : javascript:alert(SERVER_NAME);
This bookmarklet should work.
javascript:alert(document.getElementsByTagName('html')[0].innerHTML.match(/Machine Name= (.*?)-->/)[1])