-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Zoom.Quiet
committed
May 19, 2012
1 parent
9d7a328
commit 1414805
Showing
15 changed files
with
444 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#120215 appended sync http get support | ||
fetch = require('fetch').fetchUrl | ||
#120211 appended base web dev support | ||
crypto = require('crypto') | ||
|
||
http = require('http') | ||
#io = require('socket.io') | ||
|
||
express = require("express") | ||
app = module.exports = express.createServer() | ||
app.configure -> | ||
app.use express.bodyParser() | ||
app.use express.methodOverride() | ||
#app.use express.logger() | ||
app.use app.router | ||
app.configure "production", -> | ||
app.use express.errorHandler() | ||
|
||
app.get "/", (req, res) -> | ||
res.send '''Hollo there! | ||
this is URIsaOK v12.02.16, usage as: | ||
$ curl --data "uri=http://douban.com" http://urisaok.no.de/chk | ||
doc: https://github.com/ZoomQuiet/urisaok | ||
''' | ||
PHISHTYPE = (code) -> | ||
switch code.toString() | ||
when "-1" then 'UNKNOW' | ||
when "0" then 'GOOD' | ||
when "1" then 'PHISH' | ||
when "2" then 'MAYBE PHISH' | ||
|
||
APPKEY = "k-60666" | ||
SECRET = "99fc9fdbc6761f7d898ad25762407373" | ||
ASKHOST = "http://open.pc120.com" | ||
ASKTYPE = "/phish/?" | ||
|
||
checkForValidUrl = (uri) -> | ||
crtURI = Buffer(uri).toString('base64') | ||
timestamp = Date.parse(new Date())/1000+".512" | ||
signbase = ASKTYPE+"appkey="+APPKEY+"&q="+crtURI+"×tamp="+ timestamp | ||
#console.log signbase | ||
#console.log signbase+SECRET | ||
sign = crypto.createHash('md5').update(signbase+SECRET).digest("hex") | ||
#ASKHOST+signbase+"&sign="+sign | ||
signbase+"&sign="+sign | ||
|
||
app.post '/chk', (req, res) -> | ||
askurl = checkForValidUrl(req.body.uri) | ||
answer = '' | ||
fetch ASKHOST+askurl , (error, meta, body) -> | ||
if error | ||
console.log "ERROR", error.message || error | ||
else | ||
console.log meta | ||
console.log body.toString() | ||
answer = JSON.parse(body) #body.toString() | ||
console.log PHISHTYPE(answer.phish) | ||
res.send "/cnk KSC::\t"+PHISHTYPE(answer.phish) | ||
#res.send "/cnk KSC::\t"+answer.phish | ||
#res.send "\n\t..."+answer | ||
|
||
app.listen 8001 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.