webshell - confoo 2011 - sean coates

113
Webshell Smart, Scripted HTTP Sean Coates ConFoo March 2011 by Sean Coates and Evan Haas Wednesday, March 9, 2011

Upload: bachkoutou-toutou

Post on 08-May-2015

1.088 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: WebShell - confoo 2011 - sean coates

WebshellSmart, Scripted HTTP

Sean CoatesConFoo

March 2011

by Sean Coates and Evan Haas

Wednesday, March 9, 2011

Page 2: WebShell - confoo 2011 - sean coates

Assumptions

Wednesday, March 9, 2011

Page 3: WebShell - confoo 2011 - sean coates

Assumptions•You know what HTTP is

Wednesday, March 9, 2011

Page 4: WebShell - confoo 2011 - sean coates

Assumptions•You know what HTTP is•You have *some* understanding of how HTTP works•(verbs, status codes, requests, responses)

Wednesday, March 9, 2011

Page 5: WebShell - confoo 2011 - sean coates

Assumptions•You know what HTTP is•You have *some* understanding of how HTTP works•(verbs, status codes, requests, responses)•You have a cursory understanding of JS

Wednesday, March 9, 2011

Page 6: WebShell - confoo 2011 - sean coates

Assumptions•You know what HTTP is•You have *some* understanding of how HTTP works•(verbs, status codes, requests, responses)•You have a cursory understanding of JS•You care about any of this…

Wednesday, March 9, 2011

Page 7: WebShell - confoo 2011 - sean coates

What?

Wednesday, March 9, 2011

Page 8: WebShell - confoo 2011 - sean coates

What?•cURL replacement•REST(ish/ful/y)•Scriptable and interactive•Persistent

•node.js•(like http-console)

•https://github.com/fictivekin/webshell

Wednesday, March 9, 2011

Page 9: WebShell - confoo 2011 - sean coates

Why…

Wednesday, March 9, 2011

Page 10: WebShell - confoo 2011 - sean coates

Why……not cURL?

Wednesday, March 9, 2011

Page 11: WebShell - confoo 2011 - sean coates

Why……not cURL?$ curl -s http://twitter.com/users/coates.json | \ sed -e 's/^.*"name":"//' -e 's/".*$//'Sean Coates

Wednesday, March 9, 2011

Page 12: WebShell - confoo 2011 - sean coates

Why……not cURL?$ curl -s http://twitter.com/users/coates.json | \ sed -e 's/^.*"name":"//' -e 's/".*$//'Sean Coates

http://localhost > GET http://twitter.com/users/coates.jsonHTTP 200 http://twitter.com/users/coates.jsonhttp://twitter.com > $_.json.name'Sean Coates'

Webshell:

Wednesday, March 9, 2011

Page 13: WebShell - confoo 2011 - sean coates

Why…

Wednesday, March 9, 2011

Page 14: WebShell - confoo 2011 - sean coates

Why……JavaScript?

Wednesday, March 9, 2011

Page 15: WebShell - confoo 2011 - sean coates

Why……JavaScript?

Gimme Bar

Front-End

Back-End Extensions

Wednesday, March 9, 2011

Page 16: WebShell - confoo 2011 - sean coates

Why……JavaScript?

Gimme Bar

Front-End

Back-End Extensions

Wednesday, March 9, 2011

Page 17: WebShell - confoo 2011 - sean coates

Why…

Wednesday, March 9, 2011

Page 18: WebShell - confoo 2011 - sean coates

Why……node.js?

•good console “framework”•File operations •REPL + Readline•HTTP client

•non-blocking

Wednesday, March 9, 2011

Page 19: WebShell - confoo 2011 - sean coates

Wednesday, March 9, 2011

Page 20: WebShell - confoo 2011 - sean coates

ZZZzzzzzzzzzzzzzzzz…

Wednesday, March 9, 2011

Page 21: WebShell - confoo 2011 - sean coates

Simple HTTP requestshttp://localhost >

Wednesday, March 9, 2011

Page 22: WebShell - confoo 2011 - sean coates

Simple HTTP requestshttp://localhost > GET http://google.com/HTTP 301 http://google.com/http://google.com >

Wednesday, March 9, 2011

Page 23: WebShell - confoo 2011 - sean coates

Simple HTTP requestshttp://localhost > GET http://google.com/HTTP 301 http://google.com/http://google.com > $_

Wednesday, March 9, 2011

Page 24: WebShell - confoo 2011 - sean coates

Simple HTTP requestshttp://localhost > GET http://google.com/HTTP 301 http://google.com/http://google.com > $_.headers{ location: 'http://www.google.com/', 'content-type': 'text/html; charset=UTF-8', date: 'Sat, 06 Nov 2010 17:38:56 GMT', expires: 'Mon, 06 Dec 2010 17:38:56 GMT', 'cache-control': 'public, max-age=2592000', server: 'gws', 'content-length': '219', 'x-xss-protection': '1; mode=block', connection: 'close'}http://google.com >

Wednesday, March 9, 2011

Page 25: WebShell - confoo 2011 - sean coates

Simple HTTP requestshttp://localhost > GET http://google.com/HTTP 301 http://google.com/http://google.com > $_.headers{ location: 'http://www.google.com/', 'content-type': 'text/html; charset=UTF-8', date: 'Sat, 06 Nov 2010 17:38:56 GMT', expires: 'Mon, 06 Dec 2010 17:38:56 GMT', 'cache-control': 'public, max-age=2592000', server: 'gws', 'content-length': '219', 'x-xss-protection': '1; mode=block', connection: 'close'}http://google.com >

Wednesday, March 9, 2011

Page 26: WebShell - confoo 2011 - sean coates

Simple HTTP requestshttp://google.com > $_.headers.location'http://www.google.com/'http://google.com >

Wednesday, March 9, 2011

Page 27: WebShell - confoo 2011 - sean coates

Simple HTTP requestshttp://google.com > $_.headers.location'http://www.google.com/'http://google.com > $_.follow()

Wednesday, March 9, 2011

Page 28: WebShell - confoo 2011 - sean coates

Simple HTTP requestshttp://google.com > $_.headers.location'http://www.google.com/'http://google.com > $_.follow()HTTP 302 http://www.google.com/http://www.google.com > $_.headers.location'http://www.google.ca/'http://www.google.com >

Wednesday, March 9, 2011

Page 29: WebShell - confoo 2011 - sean coates

Simple HTTP requestshttp://google.com > $_.headers.location'http://www.google.com/'http://google.com > $_.follow()HTTP 302 http://www.google.com/http://www.google.com > $_.headers.location'http://www.google.ca/'http://www.google.com > $_.follow()HTTP 200 http://www.google.ca/http://www.google.ca >

Wednesday, March 9, 2011

Page 30: WebShell - confoo 2011 - sean coates

Simple HTTP requestshttp://google.com > $_.headers.location'http://www.google.com/'http://google.com > $_.follow()HTTP 302 http://www.google.com/http://www.google.com > $_.headers.location'http://www.google.ca/'http://www.google.com > $_.follow()HTTP 200 http://www.google.ca/http://www.google.ca > $_.raw.substring(0, 50)'<!doctype html><html><head><meta http-equiv="conte'

Wednesday, March 9, 2011

Page 31: WebShell - confoo 2011 - sean coates

Relative Requests (sort of)

http://localhost >

Wednesday, March 9, 2011

Page 32: WebShell - confoo 2011 - sean coates

Relative Requests (sort of)

http://localhost > GET http://files.seancoates.com/testjson.phpHTTP 404 http://files.seancoates.com/testjson.phphttp://files.seancoates.com >

Wednesday, March 9, 2011

Page 33: WebShell - confoo 2011 - sean coates

Relative Requests (sort of)

http://localhost > GET http://files.seancoates.com/testjson.phpHTTP 404 http://files.seancoates.com/testjson.phphttp://files.seancoates.com >

Wednesday, March 9, 2011

Page 34: WebShell - confoo 2011 - sean coates

Relative Requests (sort of)

http://localhost > GET http://files.seancoates.com/testjson.phpHTTP 404 http://files.seancoates.com/testjson.phphttp://files.seancoates.com > // oopshttp://files.seancoates.com >

Wednesday, March 9, 2011

Page 35: WebShell - confoo 2011 - sean coates

Relative Requests (sort of)

http://localhost > GET http://files.seancoates.com/testjson.phpHTTP 404 http://files.seancoates.com/testjson.phphttp://files.seancoates.com > // oopshttp://files.seancoates.com > GET /test_json.phpHTTP 200 http://files.seancoates.com/test_json.phphttp://files.seancoates.com >

Wednesday, March 9, 2011

Page 36: WebShell - confoo 2011 - sean coates

Relative Requests (sort of)

http://localhost > GET http://files.seancoates.com/testjson.phpHTTP 404 http://files.seancoates.com/testjson.phphttp://files.seancoates.com > // oopshttp://files.seancoates.com > GET /test_json.phpHTTP 200 http://files.seancoates.com/test_json.phphttp://files.seancoates.com > $_.json{ one: 1, two: 2, three: 3 }

Wednesday, March 9, 2011

Page 37: WebShell - confoo 2011 - sean coates

JSON Processinghttp://localhost >

Wednesday, March 9, 2011

Page 38: WebShell - confoo 2011 - sean coates

JSON Processinghttp://localhost > GET http://twitter.com/users/coates.jsonHTTP 200 http://twitter.com/users/coates.jsonhttp://twitter.com >

Wednesday, March 9, 2011

Page 39: WebShell - confoo 2011 - sean coates

JSON Processinghttp://localhost > GET http://twitter.com/users/coates.jsonHTTP 200 http://twitter.com/users/coates.jsonhttp://twitter.com > $_.json.name'Sean Coates'

Wednesday, March 9, 2011

Page 40: WebShell - confoo 2011 - sean coates

JSON Processinghttp://localhost > GET http://twitter.com/users/coates.jsonHTTP 200 http://twitter.com/users/coates.jsonhttp://twitter.com > $_.json.name'Sean Coates'http://twitter.com > $_.headers['content-type']'application/json; charset=utf-8'

Wednesday, March 9, 2011

Page 41: WebShell - confoo 2011 - sean coates

JSON Processinghttp://localhost > GET http://twitter.com/users/coates.jsonHTTP 200 http://twitter.com/users/coates.jsonhttp://twitter.com > $_.json.name'Sean Coates'http://twitter.com > $_.headers['content-type']'application/json; charset=utf-8'

Wednesday, March 9, 2011

Page 42: WebShell - confoo 2011 - sean coates

Contextssarcasm:~/src/webshell (master)$

Wednesday, March 9, 2011

Page 43: WebShell - confoo 2011 - sean coates

Contextssarcasm:~/src/webshell (master)$ node shell.js Loaded context: _previoushttp://localhost >

Wednesday, March 9, 2011

Page 44: WebShell - confoo 2011 - sean coates

Contextssarcasm:~/src/webshell (master)$ node shell.js Loaded context: _previoushttp://localhost >

Wednesday, March 9, 2011

Page 45: WebShell - confoo 2011 - sean coates

Contextssarcasm:~/src/webshell (master)$ node shell.js Loaded context: _previoushttp://localhost > GET http://twitter.com/users/coates.jsonHTTP 200 http://twitter.com/users/coates.jsonhttp://twitter.com >

Wednesday, March 9, 2011

Page 46: WebShell - confoo 2011 - sean coates

Contextssarcasm:~/src/webshell (master)$ node shell.js Loaded context: _previoushttp://localhost > GET http://twitter.com/users/coates.jsonHTTP 200 http://twitter.com/users/coates.jsonhttp://twitter.com > $_.saveContext("twitter-coates")Saved context: twitter-coateshttp://twitter.com > ^DSaved context: _previous

Wednesday, March 9, 2011

Page 47: WebShell - confoo 2011 - sean coates

Contexts

Time passes.You use Webshellfor other things…

Wednesday, March 9, 2011

Page 48: WebShell - confoo 2011 - sean coates

Contextssarcasm:~/src/webshell (master)$

Wednesday, March 9, 2011

Page 49: WebShell - confoo 2011 - sean coates

Contextssarcasm:~/src/webshell (master)$ node shell.js Loaded context: _previoushttp://localhost > $_.json //emptyhttp://localhost >

Wednesday, March 9, 2011

Page 50: WebShell - confoo 2011 - sean coates

Contextssarcasm:~/src/webshell (master)$ node shell.js Loaded context: _previoushttp://localhost > $_.json //emptyhttp://localhost > $_.loadContext("twitter-coates")Loaded context: twitter-coateshttp://twitter.com >

Wednesday, March 9, 2011

Page 51: WebShell - confoo 2011 - sean coates

Contextssarcasm:~/src/webshell (master)$ node shell.js Loaded context: _previoushttp://localhost > $_.json //emptyhttp://localhost > $_.loadContext("twitter-coates")Loaded context: twitter-coateshttp://twitter.com > $_.json.name'Sean Coates'

Wednesday, March 9, 2011

Page 52: WebShell - confoo 2011 - sean coates

HTTP Authhttp://twitter.com >

Wednesday, March 9, 2011

Page 54: WebShell - confoo 2011 - sean coates

HTTP Auth (sorry for the line breaks)

http://twitter.com > GET http://coates:[email protected]/users/coates.jsonHTTP 401 http://coates:***@twitter.com/users/coates.jsonhttp://coates:***@twitter.com >

Wednesday, March 9, 2011

Page 58: WebShell - confoo 2011 - sean coates

HTTP Auth (sorry for the line breaks)

http://twitter.com > GET http://coates:[email protected]/users/coates.jsonHTTP 401 http://coates:***@twitter.com/users/coates.jsonhttp://coates:***@twitter.com > GET http://coates:[email protected]/users/coates.jsonHTTP 200 http://coates:***@twitter.com/users/coates.jsonhttp://coates:***@twitter.com > GET http://twitter.com/statuses/replies.jsonHTTP 200 http://coates:***@twitter.com/statuses/replies.jsonhttp://coates:***@twitter.com > $_.json[0].in_reply_to_screen_name'coates'

Wednesday, March 9, 2011

Page 59: WebShell - confoo 2011 - sean coates

Cookieshttp://localhost >

Wednesday, March 9, 2011

Page 60: WebShell - confoo 2011 - sean coates

Cookies (unless $_.useCookies is set to false)

http://localhost >

Wednesday, March 9, 2011

Page 61: WebShell - confoo 2011 - sean coates

Cookies (unless $_.useCookies is set to false)

http://localhost > GET http://files.seancoates.com/cookiecounter.phpHTTP 200 http://files.seancoates.com/cookiecounter.phphttp://files.seancoates.com >

Wednesday, March 9, 2011

Page 62: WebShell - confoo 2011 - sean coates

Cookies (unless $_.useCookies is set to false)

http://localhost > GET http://files.seancoates.com/cookiecounter.phpHTTP 200 http://files.seancoates.com/cookiecounter.phphttp://files.seancoates.com > $_.raw'You have visited this page 1 times.'http://files.seancoates.com >

Wednesday, March 9, 2011

Page 63: WebShell - confoo 2011 - sean coates

Cookies (unless $_.useCookies is set to false)

http://localhost > GET http://files.seancoates.com/cookiecounter.phpHTTP 200 http://files.seancoates.com/cookiecounter.phphttp://files.seancoates.com > $_.raw'You have visited this page 1 times.'http://files.seancoates.com > GET http://files.seancoates.com/cookiecounter.phpHTTP 200 http://files.seancoates.com/cookiecounter.phphttp://files.seancoates.com > $_.raw'You have visited this page 2 times.'http://files.seancoates.com >

Wednesday, March 9, 2011

Page 64: WebShell - confoo 2011 - sean coates

Cookies (unless $_.useCookies is set to false)

http://localhost > GET http://files.seancoates.com/cookiecounter.phpHTTP 200 http://files.seancoates.com/cookiecounter.phphttp://files.seancoates.com > $_.raw'You have visited this page 1 times.'http://files.seancoates.com > GET http://files.seancoates.com/cookiecounter.phpHTTP 200 http://files.seancoates.com/cookiecounter.phphttp://files.seancoates.com > $_.raw'You have visited this page 2 times.'http://files.seancoates.com > GET http://files.seancoates.com/cookiecounter.phpHTTP 200 http://files.seancoates.com/cookiecounter.phphttp://files.seancoates.com > GET http://files.seancoates.com/cookiecounter.phpHTTP 200 http://files.seancoates.com/cookiecounter.phphttp://files.seancoates.com > GET http://files.seancoates.com/cookiecounter.phpHTTP 200 http://files.seancoates.com/cookiecounter.phphttp://files.seancoates.com > $_.raw'You have visited this page 5 times.'

Wednesday, March 9, 2011

Page 65: WebShell - confoo 2011 - sean coates

HTTP Verbshttp://localhost >

Wednesday, March 9, 2011

Page 66: WebShell - confoo 2011 - sean coates

HTTP Verbshttp://localhost > GET http://localhost/json.php?one=1&two=2HTTP 200 http://localhost/json.phphttp://localhost > $_.json.get{ one: '1', two: '2' }http://localhost > $_.json.server.REQUEST_METHOD'GET'http://localhost >

Wednesday, March 9, 2011

Page 67: WebShell - confoo 2011 - sean coates

HTTP Verbshttp://localhost > GET http://localhost/json.php?one=1&two=2HTTP 200 http://localhost/json.phphttp://localhost > $_.json.get{ one: '1', two: '2' }http://localhost > $_.json.server.REQUEST_METHOD'GET'http://localhost > $_.requestData = {three:3, four:4}{ three: 3, four: 4 }http://localhost >

Wednesday, March 9, 2011

Page 68: WebShell - confoo 2011 - sean coates

HTTP Verbshttp://localhost > GET http://localhost/json.php?one=1&two=2HTTP 200 http://localhost/json.phphttp://localhost > $_.json.get{ one: '1', two: '2' }http://localhost > $_.json.server.REQUEST_METHOD'GET'http://localhost > $_.requestData = {three:3, four:4}{ three: 3, four: 4 }http://localhost > POST http://localhost/json.php?one=1&two=2HTTP 200 http://localhost/json.phphttp://localhost > $_.json.post{ three: '3', four: '4' }

Wednesday, March 9, 2011

Page 69: WebShell - confoo 2011 - sean coates

HTTP Verbshttp://localhost > GET http://localhost/json.php?one=1&two=2HTTP 200 http://localhost/json.phphttp://localhost > $_.json.get{ one: '1', two: '2' }http://localhost > $_.json.server.REQUEST_METHOD'GET'http://localhost > $_.requestData = {three:3, four:4}{ three: 3, four: 4 }http://localhost > POST http://localhost/json.php?one=1&two=2HTTP 200 http://localhost/json.phphttp://localhost > $_.json.post{ three: '3', four: '4' }

Wednesday, March 9, 2011

Page 70: WebShell - confoo 2011 - sean coates

HTTP Verbshttp://localhost > GET http://localhost/json.php?one=1&two=2HTTP 200 http://localhost/json.phphttp://localhost > $_.json.get{ one: '1', two: '2' }http://localhost > $_.json.server.REQUEST_METHOD'GET'http://localhost > $_.requestData = {three:3, four:4}{ three: 3, four: 4 }http://localhost > POST http://localhost/json.php?one=1&two=2HTTP 200 http://localhost/json.phphttp://localhost > $_.json.post{ three: '3', four: '4' }

$_.postToRequestData$_.fileToRequestData

Wednesday, March 9, 2011

Page 71: WebShell - confoo 2011 - sean coates

HTTP Verbshttp://localhost > result = $_.get('http://fictivekin.com')

Wednesday, March 9, 2011

Page 72: WebShell - confoo 2011 - sean coates

HTTP Verbshttp://localhost > result = $_.get('http://fictivekin.com')GET http://fictivekin.comHTTP 200 http://fictivekin.com/http://www.fictivekin.com >

Wednesday, March 9, 2011

Page 73: WebShell - confoo 2011 - sean coates

HTTP Verbshttp://localhost > result = $_.get('http://fictivekin.com')GET http://fictivekin.comin.comHTTP 200 http://fictivekin.com/http://www.google.com > result2 = $_.get('http://www.google.ca')GET http://www.google.caHTTP 200 http://www.google.ca/http://www.google.ca >

Wednesday, March 9, 2011

Page 74: WebShell - confoo 2011 - sean coates

HTTP Verbshttp://localhost > result = $_.get('http://fictivekin.com')GET http://fictivekin.comin.comHTTP 200 http://fictivekin.com/http://www.google.com > result2 = $_.get('http://www.google.ca')GET http://www.google.caHTTP 200 http://www.google.ca/http://www.google.ca > result.headers['content-type']'text/html'http://www.google.ca > result2.headers['content-type']'text/html; charset=ISO-8859-1'

Wednesday, March 9, 2011

Page 75: WebShell - confoo 2011 - sean coates

HTTP Verbshttp://localhost > result = $_.get('http://fictivekin.com')GET http://fictivekin.comHTTP 200 http://fictivekin.com/http://www.google.com > result2 = $_.get('http://www.google.ca')GET http://www.google.caHTTP 200 http://www.google.ca/http://www.google.ca > result.headers['content-type']'text/html'http://www.google.ca > result2.headers['content-type']'text/html; charset=ISO-8859-1'

Wednesday, March 9, 2011

Page 76: WebShell - confoo 2011 - sean coates

HTTP Headers (inspect)http://localhost >

Wednesday, March 9, 2011

Page 77: WebShell - confoo 2011 - sean coates

HTTP Headershttp://localhost > GET http://localhostHTTP 200 http://localhost/http://localhost >

Wednesday, March 9, 2011

Page 78: WebShell - confoo 2011 - sean coates

HTTP Headershttp://localhost > GET http://localhostHTTP 200 http://localhost/http://localhost > $_.requestHeaders{ host: 'localhost', 'user-agent': 'Webshell/0.1-dev node.js/v0.2.1', accept: 'application/json, */*', 'content-type': 'application/x-www-form-urlencoded'}http://localhost >

Wednesday, March 9, 2011

Page 79: WebShell - confoo 2011 - sean coates

HTTP Headershttp://localhost > GET http://localhostHTTP 200 http://localhost/http://localhost > $_.requestHeaders{ host: 'localhost', 'user-agent': 'Webshell/0.1-dev node.js/v0.2.1', accept: 'application/json, */*', 'content-type': 'application/x-www-form-urlencoded'}http://localhost > $_.headers{ date: 'Sat, 06 Nov 2010 21:14:02 GMT', server: 'Apache/2.2.15 (Unix) PHP/5.3.3-dev mod_ssl/2.2.15 OpenSSL/0.9.8l', 'content-length': '3617', connection: 'close', 'content-type': 'text/html;charset=ISO-8859-1'}

Wednesday, March 9, 2011

Page 80: WebShell - confoo 2011 - sean coates

HTTP Headers (set)http://localhost >

Wednesday, March 9, 2011

Page 81: WebShell - confoo 2011 - sean coates

HTTP Headershttp://localhost > GET http://localhost:5984/HTTP 200 http://localhost:5984/http://localhost:5984 > $_.json{ couchdb: 'Welcome', version: '1.0.1' }http://localhost:5984 > $_.json.version'1.0.1'http://localhost:5984 >

Wednesday, March 9, 2011

Page 82: WebShell - confoo 2011 - sean coates

HTTP Headershttp://localhost > GET http://localhost:5984/HTTP 200 http://localhost:5984/http://localhost:5984 > $_.json{ couchdb: 'Welcome', version: '1.0.1' }http://localhost:5984 > $_.json.version'1.0.1'http://localhost:5984 > $_.headers['content-type']'application/json'http://localhost:5984 > $_.requestHeaders.accept'application/json, */*'http://localhost:5984 >

Wednesday, March 9, 2011

Page 83: WebShell - confoo 2011 - sean coates

HTTP Headershttp://localhost > GET http://localhost:5984/HTTP 200 http://localhost:5984/http://localhost:5984 > $_.json{ couchdb: 'Welcome', version: '1.0.1' }http://localhost:5984 > $_.json.version'1.0.1'http://localhost:5984 > $_.headers['content-type']'application/json'http://localhost:5984 > $_.requestHeaders.accept'application/json, */*'http://localhost:5984 > $_.requestHeaders.accept = '*/*' // not json explicitly'*/*'http://localhost:5984 > GET http://localhost:5984/HTTP 200 http://localhost:5984/http://localhost:5984 >

Wednesday, March 9, 2011

Page 84: WebShell - confoo 2011 - sean coates

HTTP Headershttp://localhost > GET http://localhost:5984/HTTP 200 http://localhost:5984/http://localhost:5984 > $_.json{ couchdb: 'Welcome', version: '1.0.1' }http://localhost:5984 > $_.json.version'1.0.1'http://localhost:5984 > $_.headers['content-type']'application/json'http://localhost:5984 > $_.requestHeaders.accept'application/json, */*'http://localhost:5984 > $_.requestHeaders.accept = '*/*' // not json explicitly'*/*'http://localhost:5984 > GET http://localhost:5984/HTTP 200 http://localhost:5984/http://localhost:5984 > $_.headers['content-type']'text/plain;charset=utf-8'http://localhost:5984 > $_.jsonhttp://localhost:5984 > // no JSON )-:

Wednesday, March 9, 2011

Page 85: WebShell - confoo 2011 - sean coates

Toolbox + Callbackshttp://localhost > $_.toolbox

Wednesday, March 9, 2011

Page 86: WebShell - confoo 2011 - sean coates

Toolbox + Callbackshttp://localhost > $_.toolbox.lastTweet = function (username) {... $_.get('http://twitter.com/statuses/user_timeline' + username + '.json',... function () { if ($_.status == 200) {... console.log("Last tweet: " + $_.json[0].text)... }});... }[Function]

Wednesday, March 9, 2011

Page 87: WebShell - confoo 2011 - sean coates

Toolbox + Callbackshttp://twitter.com > $_.toolbox.lastTweet('coates')HTTP 200 http://twitter.com/statuses/user_timeline/coates.jsonLast tweet: Doing a bunch of work on Webshell. Fixed some bugs, added relative URLs, and re-writing the docs. http://github.com/fictivekin/webshellhttp://twitter.com >

Wednesday, March 9, 2011

Page 88: WebShell - confoo 2011 - sean coates

Toolbox + Callbackshttp://twitter.com > $_.toolbox.lastTweet('coates')HTTP 200 http://twitter.com/statuses/user_timeline/coates.jsonLast tweet: Doing a bunch of work on Webshell. Fixed some bugs, added relative URLs, and re-writing the docs. http://github.com/fictivekin/webshellhttp://twitter.com > $_.toolbox.lastTweet('sirevanhaas')HTTP 200 http://twitter.com/statuses/user_timeline/sirevanhaas.jsonLast tweet: If only Firefox extensions were as simple as Chrome/Safari extensionshttp://twitter.com >

Wednesday, March 9, 2011

Page 89: WebShell - confoo 2011 - sean coates

Toolbox + Callbackshttp://twitter.com > $_.toolbox.lastTweet('coates')HTTP 200 http://twitter.com/statuses/user_timeline/coates.jsonLast tweet: Doing a bunch of work on Webshell. Fixed some bugs, added relative URLs, and re-writing the docs. http://github.com/fictivekin/webshellhttp://twitter.com > $_.toolbox.lastTweet('sirevanhaas')HTTP 200 http://twitter.com/statuses/user_timeline/sirevanhaas.jsonLast tweet: If only Firefox extensions were as simple as Chrome/Safari extensionshttp://twitter.com > $_.toolbox.lastTweet('userwhodoesntexist')HTTP 404 http://twitter.com/statuses/user_timeline/userwhodoesntexist.jsonhttp://twitter.com >

Wednesday, March 9, 2011

Page 91: WebShell - confoo 2011 - sean coates

HTML & DOMwebshell> GET http://fictivekin.com

Wednesday, March 9, 2011

Page 92: WebShell - confoo 2011 - sean coates

HTML & DOMwebshell> GET http://fictivekin.comHTTP 200 http://fictivekin.comwebshell>

Wednesday, March 9, 2011

Page 93: WebShell - confoo 2011 - sean coates

HTML & DOMwebshell> GET http://fictivekin.comHTTP 200 http://fictivekin.comwebshell> $_.document.getElementsByClassName('message').length

Wednesday, March 9, 2011

Page 94: WebShell - confoo 2011 - sean coates

HTML & DOMwebshell> GET http://fictivekin.comHTTP 200 http://fictivekin.comwebshell> $_.document.getElementsByClassName('message').length8webshell>

Wednesday, March 9, 2011

Page 95: WebShell - confoo 2011 - sean coates

HTML & DOMwebshell> GET http://fictivekin.comHTTP 200 http://fictivekin.comwebshell> $_.document.getElementsByClassName('message').length8webshell> $_.document.getElementById('faq').innerHTML

Wednesday, March 9, 2011

Page 96: WebShell - confoo 2011 - sean coates

HTML & DOMwebshell> GET http://fictivekin.comHTTP 200 http://fictivekin.comwebshell> $_.document.getElementsByClassName('message').length8webshell> $_.document.getElementById('faq').innerHTML'\n <a href=\'\'>FAQ</a>\n <h2>Frequently Asked Questions</h2>\n'

Wednesday, March 9, 2011

Page 97: WebShell - confoo 2011 - sean coates

HTML & DOM

Wednesday, March 9, 2011

Page 98: WebShell - confoo 2011 - sean coates

HTML & DOM•Needs envjs and libxmljs•NOT stable•See the envjs branch on Github

Wednesday, March 9, 2011

Page 99: WebShell - confoo 2011 - sean coates

jQuerywebshell> GET http://fictivekin.com

Wednesday, March 9, 2011

Page 100: WebShell - confoo 2011 - sean coates

jQuerywebshell> GET http://fictivekin.comHTTP 200 http://fictivekin.comwebshell>

Wednesday, March 9, 2011

Page 101: WebShell - confoo 2011 - sean coates

jQuerywebshell> GET http://fictivekin.comHTTP 200 http://fictivekin.comwebshell> $('img').length

Wednesday, March 9, 2011

Page 102: WebShell - confoo 2011 - sean coates

jQuerywebshell> GET http://fictivekin.comHTTP 200 http://fictivekin.comwebshell> $('img').length4

Wednesday, March 9, 2011

Page 103: WebShell - confoo 2011 - sean coates

jQuerywebshell> GET http://fictivekin.comHTTP 200 http://fictivekin.comwebshell> $('img').length4webshell> $('img').each(function() { sys.puts($(this).attr('src'));})

Wednesday, March 9, 2011

Page 104: WebShell - confoo 2011 - sean coates

jQuerywebshell> GET http://fictivekin.comHTTP 200 http://fictivekin.comwebshell> $('img').length4webshell> $('img').each(function() { console.log($(this).attr('src'));})images/fk2_no.pngimages/dot1.pngimages/dot2.pngimages/dot3.png

Wednesday, March 9, 2011

Page 105: WebShell - confoo 2011 - sean coates

jQuery

Wednesday, March 9, 2011

Page 106: WebShell - confoo 2011 - sean coates

jQuery•Needs envjs and libxmljs•NOT stable•See the envjs branch on Github

Wednesday, March 9, 2011

Page 107: WebShell - confoo 2011 - sean coates

Concurrency

Wednesday, March 9, 2011

Page 108: WebShell - confoo 2011 - sean coates

Concurrency•Node == powerful (story time)•$_.requestConcurrency•Still a little flaky

Wednesday, March 9, 2011

Page 109: WebShell - confoo 2011 - sean coates

Future?

Wednesday, March 9, 2011

Page 110: WebShell - confoo 2011 - sean coates

Future?•Broken on new versions of Node )-:•First things are to get that in order, and do some cleanup

•More distant future:•Mongo?•Import browser cookies•Improve readline/UI

Wednesday, March 9, 2011

Page 111: WebShell - confoo 2011 - sean coates

New name?

Wednesday, March 9, 2011

Page 112: WebShell - confoo 2011 - sean coates

New name?•Looking for a new name•Too much noise on “web shell”•We look like a security exploit )-:

Wednesday, March 9, 2011