Cisco IOS: Disable Telnet access… or enable SSH

Telnet access is enabled by default on some IOS releases. See this article for why this is bad.

If you don’t need Telnet access, you should disable it. The commands are as follows:

  1. line vty 0 4
  2. transport input none

If you do need remote terminal access, you should switch Telnet to SSH where possible. Be sure to set a secure password.

  1. ip domain-name your.domain.com
  2. crypto key generate rsa
  3. username yourusername secret supersecretpassword
  4. line vty 0 4
  5. transport input ssh
  6. login local

The crypto key generate rsa command will ask you “How many bits in the modulus”. It is recommended to use at least 2048.

Injecting jQuery into a web site

This is really useful if you need to hack around with a site that doesn’t use jQuery. In my case, the web interface of a crappy Chinese IP camera which did its recording scheduling by making you click every 15 minute block in the week that you want to record.

Full credit should be given to http://www.learningjquery.com/2009/04/better-stronger-safer-jquerify-bookmarklet.

Code which you can put into your browser’s debugging console is as follows:

  1. (function getScript(url){
  2. var script=document.createElement('script');
  3. script.src=url;
  4.  
  5. var head=document.getElementsByTagName('head')[0],
  6. done=false;
  7.  
  8. // Attach handlers for all browsers
  9. script.onload=script.onreadystatechange = function() {
  10. if ( !done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete') ) {
  11. done=true;
  12.  
  13. script.onload = script.onreadystatechange = null;
  14. head.removeChild(script);
  15. }
  16. };
  17.  
  18. head.appendChild(script);
  19. })('http://code.jquery.com/jquery.min.js');