-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
12 changed files
with
279 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# EditorConfig helps developers define and maintain consistent | ||
# coding styles between different editors and IDEs | ||
# editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
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 @@ | ||
v4 |
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 @@ | ||
v4 |
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,6 @@ | ||
language: node_js | ||
node_js: | ||
- "0.12.0" | ||
- "4.0.0" | ||
notifications: | ||
email: false |
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 |
---|---|---|
@@ -1,2 +1,20 @@ | ||
# hubot-hesidohackeado | ||
Un script hubot para consultar https://hesidohackeado.com/ | ||
|
||
[![npm version](https://img.shields.io/npm/v/hubot-hesidohackeado.svg?style=flat-square)](https://www.npmjs.com/package/hubot-hesidohackeado) | ||
[![npm downloads](https://img.shields.io/npm/dm/hubot-hesidohackeado.svg?style=flat-square)](https://www.npmjs.com/package/hubot-hesidohackeado) | ||
[![Build Status](https://img.shields.io/travis/lgaticaq/hubot-hesidohackeado.svg?style=flat-square)](https://travis-ci.org/lgaticaq/hubot-hesidohackeado) | ||
[![dependency Status](https://img.shields.io/david/lgaticaq/hubot-hesidohackeado.svg?style=flat-square)](https://david-dm.org/lgaticaq/hubot-hesidohackeado#info=dependencies) | ||
[![devDependency Status](https://img.shields.io/david/dev/lgaticaq/hubot-hesidohackeado.svg?style=flat-square)](https://david-dm.org/lgaticaq/hubot-hesidohackeado#info=devDependencies) | ||
[![Join the chat at https://gitter.im/lgaticaq/hubot-hesidohackeado](https://img.shields.io/badge/gitter-join%20chat%20%E2%86%92-brightgreen.svg?style=flat-square)](https://gitter.im/lgaticaq/hubot-hesidohackeado?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | ||
|
||
Un script hubot para consultar https://hesidohackeado.com | ||
|
||
## Instalación | ||
```bash | ||
npm i -S hubot-hesidohackeado | ||
``` | ||
|
||
agregar `["hubot-hesidohackeado"]` en `external-scripts.json`. | ||
|
||
## Ejemplos | ||
`hubot hesidohackeado <email> -> Hay 1 registro para <email> ...` |
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,12 @@ | ||
fs = require "fs" | ||
path = require "path" | ||
|
||
module.exports = (robot, scripts) -> | ||
scriptsPath = path.resolve(__dirname, "src") | ||
fs.exists scriptsPath, (exists) -> | ||
if exists | ||
for script in fs.readdirSync(scriptsPath) | ||
if scripts? and "*" not in scripts | ||
robot.loadFile(scriptsPath, script) if script in scripts | ||
else | ||
robot.loadFile(scriptsPath, script) |
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,38 @@ | ||
{ | ||
"name": "hubot-hesidohackeado", | ||
"version": "0.0.1", | ||
"description": "Un script hubot para consultar https://hesidohackeado.com", | ||
"main": "index.coffee", | ||
"scripts": { | ||
"test": "mocha --compilers coffee:coffee-script/register" | ||
}, | ||
"engines": { | ||
"node": ">=0.12" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/lgaticaq/hubot-hesidohackeado.git" | ||
}, | ||
"keywords": [ | ||
"hubot", | ||
"hubot-scripts", | ||
"hesidohackeado" | ||
], | ||
"author": "Leonardo Gatica <lgatica@protonmail.com> (https://about.me/lgatica)", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/lgaticaq/hubot-hesidohackeado/issues" | ||
}, | ||
"homepage": "https://github.com/lgaticaq/hubot-hesidohackeado#readme", | ||
"dependencies": { | ||
"filesize": "^3.1.3", | ||
"moment": "^2.10.6" | ||
}, | ||
"devDependencies": { | ||
"chai": "^3.4.0", | ||
"coffee-script": "^1.10.0", | ||
"hubot-test-helper": "^1.1.0", | ||
"mocha": "^2.3.3", | ||
"nock": "^2.15.0" | ||
} | ||
} |
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,54 @@ | ||
# Description | ||
# Verifica si un email ha sido comprometido en alguna ruptura de seguridad | ||
# | ||
# Dependencies: | ||
# "filesize": "^3.1.3", | ||
# "moment": "^2.10.6" | ||
# | ||
# Commands: | ||
# hubot hesidohackeado <email> -> Hay 1 registro para <email> ... | ||
# | ||
# Author: | ||
# lgaticaq | ||
|
||
filesize = require("filesize") | ||
moment = require("moment") | ||
|
||
module.exports = (robot) -> | ||
emailPattern = "([\\w.-]+@[\\w.-]+\\.[a-zA-Z.]{2,6})" | ||
regex = new RegExp("hesidohackeado #{emailPattern}", "i") | ||
robot.respond regex, (res) -> | ||
email = res.match[1] | ||
url = "https://hesidohackeado.com/api" | ||
query = {q: email} | ||
robot.http(url).query(query) | ||
.header("Accept", "application/json") | ||
.get() (err, response, body) -> | ||
if err | ||
res.reply "ocurrio un error al consultar el email" | ||
robot.emit "error", err, res | ||
return | ||
data = JSON.parse body | ||
if data.status is "badsintax" | ||
res.reply "Email mal ingresado" | ||
else if data.status is "notfound" | ||
res.send ":tada: Felicidades no hay registros para #{email} :tada:" | ||
else if data.status is "found" | ||
text = "" | ||
if data.results is 1 | ||
text += ">Hay *1* registro para #{email}" | ||
else | ||
text += ">Hay *#{data.results}* registros para #{email}" | ||
format = "YYYY-MM-DD HH:mm:ss" | ||
for d in data.data | ||
text += ">*Fecha*: #{moment(d.date_leaked).format(format)}\n" | ||
text += ">*Título*: #{d.title}\n" | ||
text += ">*Autor*: #{d.author}\n" | ||
text += ">*Sitio*: #{d.source_provider}\n" | ||
text += ">*Red*: #{d.source_network}\n" | ||
text += ">*Emails*: #{d.emails_count}\n" | ||
text += ">*Tamaño*: #{filesize(d.source_size)}\n" | ||
text += ">*Enlace*: #{d.details}\n\n" | ||
res.send text | ||
else | ||
res.reply "La respuesta no es la esperada" |
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,6 @@ | ||
{ | ||
"status": "badsintax", | ||
"query": "anon@@@@ymous", | ||
"results": 0, | ||
"data": [] | ||
} |
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,22 @@ | ||
{ | ||
"status": "found", | ||
"query": "anon@ymo.us", | ||
"results": 1, | ||
"data": [ | ||
{ | ||
"source_id": "4033", | ||
"source_url": "http://siph0n.net/exploits.php?id=4033", | ||
"source_lines": 19265, | ||
"source_size": 2721878, | ||
"source_network": "clearnet", | ||
"source_provider": "siph0n", | ||
"is_vrf": false, | ||
"title": "Multiple Dating/Marriage Websites (9)", | ||
"author": "smitz", | ||
"date_created": "2015-09-04T20:02:48+02:00", | ||
"date_leaked": "2015-09-04T00:00:00+02:00", | ||
"emails_count": 7744, | ||
"details": "https://hesidohackeado.com/leak/siph0n-4033" | ||
} | ||
] | ||
} |
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,98 @@ | ||
path = require("path") | ||
Helper = require("hubot-test-helper") | ||
expect = require("chai").expect | ||
nock = require("nock") | ||
filesize = require("filesize") | ||
moment = require("moment") | ||
|
||
helper = new Helper("./../src/index.coffee") | ||
|
||
describe "hesidohackeado", -> | ||
room = null | ||
|
||
beforeEach -> | ||
room = helper.createRoom() | ||
nock.disableNetConnect() | ||
|
||
afterEach -> | ||
room.destroy() | ||
nock.cleanAll() | ||
|
||
context "email valido con registros", -> | ||
email = "anon@ymo.us" | ||
format = "YYYY-MM-DD HH:mm:ss" | ||
|
||
beforeEach (done) -> | ||
nock("https://hesidohackeado.com") | ||
.get("/api") | ||
.query({q: email}) | ||
.replyWithFile(200, path.join(__dirname, "found.json")) | ||
room.user.say("pepito", "hubot hesidohackeado #{email}") | ||
setTimeout(done, 100) | ||
|
||
it "se espera que obtenga registros", -> | ||
expect(room.messages).to.eql([ | ||
["pepito", "hubot hesidohackeado #{email}"], | ||
[ | ||
"hubot", | ||
">Hay *1* registro para #{email}" + | ||
">*Fecha*: #{moment("2015-09-04T00:00:00+02:00").format(format)}\n" + | ||
">*Título*: Multiple Dating/Marriage Websites (9)\n" + | ||
">*Autor*: smitz\n" + | ||
">*Sitio*: siph0n\n" + | ||
">*Red*: clearnet\n" + | ||
">*Emails*: 7744\n" + | ||
">*Tamaño*: #{filesize(2721878)}\n" + | ||
">*Enlace*: https://hesidohackeado.com/leak/siph0n-4033\n\n" | ||
] | ||
]) | ||
|
||
context "email valido sin registros", -> | ||
email = "anon@ymo.us" | ||
|
||
beforeEach (done) -> | ||
nock("https://hesidohackeado.com") | ||
.get("/api") | ||
.query({q: email}) | ||
.replyWithFile(200, path.join(__dirname, "notfound.json")) | ||
room.user.say("pepito", "hubot hesidohackeado #{email}") | ||
setTimeout(done, 100) | ||
|
||
it "se espera que no obtenga registros", -> | ||
expect(room.messages).to.eql([ | ||
["pepito", "hubot hesidohackeado #{email}"], | ||
["hubot", ":tada: Felicidades no hay registros para #{email} :tada:"] | ||
]) | ||
|
||
context "email invalido", -> | ||
email = "anon@@@@ymous" | ||
|
||
beforeEach (done) -> | ||
nock("https://hesidohackeado.com") | ||
.get("/api") | ||
.query({q: email}) | ||
.replyWithFile(200, path.join(__dirname, "badsintax.json")) | ||
room.user.say("pepito", "hubot hesidohackeado #{email}") | ||
setTimeout(done, 100) | ||
|
||
it "se espera no obtener respuesta", -> | ||
expect(room.messages).to.eql([ | ||
["pepito", "hubot hesidohackeado #{email}"] | ||
]) | ||
|
||
context "error en el servidor", -> | ||
email = "anon@ymo.us" | ||
|
||
beforeEach (done) -> | ||
nock("https://hesidohackeado.com") | ||
.get("/api") | ||
.query({q: email}) | ||
.replyWithError("something awful happened") | ||
room.user.say("pepito", "hubot hesidohackeado #{email}") | ||
setTimeout(done, 100) | ||
|
||
it "se espera obtener error", -> | ||
expect(room.messages).to.eql([ | ||
["pepito", "hubot hesidohackeado #{email}"] | ||
["hubot", "@pepito ocurrio un error al consultar el email"] | ||
]) |
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,6 @@ | ||
{ | ||
"status": "notfound", | ||
"query": "anon@ymo.us", | ||
"results": 0, | ||
"data": [] | ||
} |