commit
06307ef8ae
@ -1,14 +0,0 @@ |
|||||||
{ |
|
||||||
"blacklist": [ |
|
||||||
"0x627306090abab3a6e1400e9345bc60c78a8bef57", |
|
||||||
"0xf17f52151ebef6c7334fad080c5704d77216b732", |
|
||||||
"0xc5fdf4076b8f3a5357c5e395ab970b5b54098fef", |
|
||||||
"0x821aea9a577a9b44299b9c15c88cf3087f3b5544", |
|
||||||
"0x0d1d4e623d10f9fba5db95830f7d3839406c6af2", |
|
||||||
"0x2932b7a2355d6fecc4b5c0b6bd44cc31df247a2e", |
|
||||||
"0x2191ef87e392377ec08e7c08eb105ef5448eced5", |
|
||||||
"0x0f4f2ac550a1b4e2280d04c21cea7ebd822934b5", |
|
||||||
"0x6330a553fc93768f612722bb8c2ec78ac90b3bbc", |
|
||||||
"0x5aeda56215b167893e80b4fe645ba6d5bab767de" |
|
||||||
] |
|
||||||
} |
|
@ -0,0 +1,17 @@ |
|||||||
|
module.exports = { |
||||||
|
'blacklist': [ |
||||||
|
// IDEX phisher
|
||||||
|
'0x9bcb0A9d99d815Bb87ee3191b1399b1Bcc46dc77', |
||||||
|
// Ganache default seed phrases
|
||||||
|
'0x627306090abab3a6e1400e9345bc60c78a8bef57', |
||||||
|
'0xf17f52151ebef6c7334fad080c5704d77216b732', |
||||||
|
'0xc5fdf4076b8f3a5357c5e395ab970b5b54098fef', |
||||||
|
'0x821aea9a577a9b44299b9c15c88cf3087f3b5544', |
||||||
|
'0x0d1d4e623d10f9fba5db95830f7d3839406c6af2', |
||||||
|
'0x2932b7a2355d6fecc4b5c0b6bd44cc31df247a2e', |
||||||
|
'0x2191ef87e392377ec08e7c08eb105ef5448eced5', |
||||||
|
'0x0f4f2ac550a1b4e2280d04c21cea7ebd822934b5', |
||||||
|
'0x6330a553fc93768f612722bb8c2ec78ac90b3bbc', |
||||||
|
'0x5aeda56215b167893e80b4fe645ba6d5bab767de', |
||||||
|
], |
||||||
|
} |
@ -0,0 +1,24 @@ |
|||||||
|
const WritableStream = require('readable-stream').Writable |
||||||
|
const promiseToCallback = require('promise-to-callback') |
||||||
|
|
||||||
|
module.exports = createStreamSink |
||||||
|
|
||||||
|
|
||||||
|
function createStreamSink(asyncWriteFn, _opts) { |
||||||
|
return new AsyncWritableStream(asyncWriteFn, _opts) |
||||||
|
} |
||||||
|
|
||||||
|
class AsyncWritableStream extends WritableStream { |
||||||
|
|
||||||
|
constructor (asyncWriteFn, _opts) { |
||||||
|
const opts = Object.assign({ objectMode: true }, _opts) |
||||||
|
super(opts) |
||||||
|
this._asyncWriteFn = asyncWriteFn |
||||||
|
} |
||||||
|
|
||||||
|
// write from incomming stream to state
|
||||||
|
_write (chunk, encoding, callback) { |
||||||
|
promiseToCallback(this._asyncWriteFn(chunk, encoding))(callback) |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,6 @@ |
|||||||
|
Dear MetaMask Users, |
||||||
|
|
||||||
|
There have been several instances of high-profile legitimate websites such as BTC Manager and Games Workshop that have had their websites temporarily compromised. This involves showing a fake MetaMask window on the page asking for user's seed phrases. MetaMask will never open itself in this way and users are encouraged to report these instances immediately to either [our phishing blacklist](https://github.com/MetaMask/eth-phishing-detect/issues) or our support email at [support@metamask.io](mailto:support@metamask.io). |
||||||
|
|
||||||
|
Please read our full article on this ongoing issue at [https://medium.com/metamask/new-phishing-strategy-becoming-common-1b1123837168](https://medium.com/metamask/new-phishing-strategy-becoming-common-1b1123837168). |
||||||
|
|
@ -1,27 +0,0 @@ |
|||||||
var fs = require('fs') |
|
||||||
var path = require('path') |
|
||||||
var prompt = require('prompt') |
|
||||||
var open = require('open') |
|
||||||
var extend = require('extend') |
|
||||||
var notices = require('./notices.json') |
|
||||||
|
|
||||||
|
|
||||||
console.log('List of Notices') |
|
||||||
console.log(`ID \t DATE \t\t\t TITLE`) |
|
||||||
notices.forEach((notice) => { |
|
||||||
console.log(`${(' ' + notice.id).slice(-2)} \t ${notice.date} \t ${notice.title}`) |
|
||||||
}) |
|
||||||
prompt.get(['id'], (error, res) => { |
|
||||||
prompt.start() |
|
||||||
if (error) { |
|
||||||
console.log("Exiting...") |
|
||||||
process.exit() |
|
||||||
} |
|
||||||
var index = notices.findIndex((notice) => { return notice.id == res.id}) |
|
||||||
if (index === -1) { |
|
||||||
console.log('Notice not found. Exiting...') |
|
||||||
} |
|
||||||
notices.splice(index, 1) |
|
||||||
fs.unlink(`notices/archive/notice_${res.id}.md`) |
|
||||||
fs.writeFile(`notices/notices.json`, JSON.stringify(notices)) |
|
||||||
}) |
|
@ -1,33 +0,0 @@ |
|||||||
var fsp = require('fs-promise') |
|
||||||
var path = require('path') |
|
||||||
var prompt = require('prompt') |
|
||||||
var open = require('open') |
|
||||||
var extend = require('extend') |
|
||||||
var notices = require('./notices.json') |
|
||||||
var id = Number(require('./notice-nonce.json')) |
|
||||||
|
|
||||||
var date = new Date().toDateString() |
|
||||||
|
|
||||||
var notice = { |
|
||||||
read: false, |
|
||||||
date: date, |
|
||||||
} |
|
||||||
|
|
||||||
fsp.writeFile(`notices/archive/notice_${id}.md`,'Message goes here. Please write out your notice and save before proceeding at the command line.') |
|
||||||
.then(() => { |
|
||||||
open(`notices/archive/notice_${id}.md`) |
|
||||||
prompt.start() |
|
||||||
prompt.get(['title'], (err, result) => { |
|
||||||
notice.title = result.title |
|
||||||
fsp.readFile(`notices/archive/notice_${id}.md`) |
|
||||||
.then((body) => { |
|
||||||
notice.body = body.toString() |
|
||||||
notice.id = id |
|
||||||
notices.push(notice) |
|
||||||
return fsp.writeFile(`notices/notices.json`, JSON.stringify(notices)) |
|
||||||
}).then((completion) => { |
|
||||||
id += 1 |
|
||||||
return fsp.writeFile(`notices/notice-nonce.json`, id) |
|
||||||
}) |
|
||||||
}) |
|
||||||
}) |
|
@ -1 +0,0 @@ |
|||||||
4 |
|
@ -0,0 +1,34 @@ |
|||||||
|
// fs.readFileSync is inlined by browserify transform "brfs"
|
||||||
|
const fs = require('fs') |
||||||
|
|
||||||
|
module.exports = [ |
||||||
|
{ |
||||||
|
id: 0, |
||||||
|
read: false, |
||||||
|
date: 'Thu Feb 09 2017', |
||||||
|
title: 'Terms of Use', |
||||||
|
body: fs.readFileSync(__dirname + '/archive/notice_0.md', 'utf8'), |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: 2, |
||||||
|
read: false, |
||||||
|
date: 'Mon May 08 2017', |
||||||
|
title: 'Privacy Notice', |
||||||
|
body: fs.readFileSync(__dirname + '/archive/notice_2.md', 'utf8'), |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: 3, |
||||||
|
read: false, |
||||||
|
date: 'Tue Nov 28 2017', |
||||||
|
title: 'Seed Phrase Alert', |
||||||
|
firstVersion: '<=3.12.0', |
||||||
|
body: fs.readFileSync(__dirname + '/archive/notice_3.md', 'utf8'), |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: 4, |
||||||
|
read: false, |
||||||
|
date: 'Wed Jun 13 2018', |
||||||
|
title: 'Phishing Warning', |
||||||
|
body: fs.readFileSync(__dirname + '/archive/notice_4.md', 'utf8'), |
||||||
|
} |
||||||
|
] |
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -1,31 +1,59 @@ |
|||||||
const assert = require('assert') |
const assert = require('assert') |
||||||
const path = require('path') |
const path = require('path') |
||||||
const accountImporter = require('../../../app/scripts/account-import-strategies/index') |
|
||||||
const ethUtil = require('ethereumjs-util') |
const ethUtil = require('ethereumjs-util') |
||||||
|
const accountImporter = require('../../../app/scripts/account-import-strategies/index') |
||||||
|
const { assertRejects } = require('../test-utils') |
||||||
|
|
||||||
describe('Account Import Strategies', function () { |
describe('Account Import Strategies', function () { |
||||||
const privkey = '0x4cfd3e90fc78b0f86bf7524722150bb8da9c60cd532564d7ff43f5716514f553' |
const privkey = '0x4cfd3e90fc78b0f86bf7524722150bb8da9c60cd532564d7ff43f5716514f553' |
||||||
const json = '{"version":3,"id":"dbb54385-0a99-437f-83c0-647de9f244c3","address":"a7f92ce3fba24196cf6f4bd2e1eb3db282ba998c","Crypto":{"ciphertext":"bde13d9ade5c82df80281ca363320ce254a8a3a06535bbf6ffdeaf0726b1312c","cipherparams":{"iv":"fbf93718a57f26051b292f072f2e5b41"},"cipher":"aes-128-ctr","kdf":"scrypt","kdfparams":{"dklen":32,"salt":"7ffe00488319dec48e4c49a120ca49c6afbde9272854c64d9541c83fc6acdffe","n":8192,"r":8,"p":1},"mac":"2adfd9c4bc1cdac4c85bddfb31d9e21a684e0e050247a70c5698facf6b7d4681"}}' |
const json = '{"version":3,"id":"dbb54385-0a99-437f-83c0-647de9f244c3","address":"a7f92ce3fba24196cf6f4bd2e1eb3db282ba998c","Crypto":{"ciphertext":"bde13d9ade5c82df80281ca363320ce254a8a3a06535bbf6ffdeaf0726b1312c","cipherparams":{"iv":"fbf93718a57f26051b292f072f2e5b41"},"cipher":"aes-128-ctr","kdf":"scrypt","kdfparams":{"dklen":32,"salt":"7ffe00488319dec48e4c49a120ca49c6afbde9272854c64d9541c83fc6acdffe","n":8192,"r":8,"p":1},"mac":"2adfd9c4bc1cdac4c85bddfb31d9e21a684e0e050247a70c5698facf6b7d4681"}}' |
||||||
|
|
||||||
it('imports a private key and strips 0x prefix', async function () { |
describe('private key import', function () { |
||||||
const importPrivKey = await accountImporter.importAccount('Private Key', [ privkey ]) |
it('imports a private key and strips 0x prefix', async function () { |
||||||
assert.equal(importPrivKey, ethUtil.stripHexPrefix(privkey)) |
const importPrivKey = await accountImporter.importAccount('Private Key', [ privkey ]) |
||||||
}) |
assert.equal(importPrivKey, ethUtil.stripHexPrefix(privkey)) |
||||||
|
}) |
||||||
|
|
||||||
it('fails when password is incorrect for keystore', async function () { |
it('throws an error for empty string private key', async () => { |
||||||
const wrongPassword = 'password2' |
assertRejects(async function() { |
||||||
|
await accountImporter.importAccount('Private Key', [ '' ]) |
||||||
|
}, Error, 'no empty strings') |
||||||
|
}) |
||||||
|
|
||||||
try { |
it('throws an error for undefined string private key', async () => { |
||||||
await accountImporter.importAccount('JSON File', [ json, wrongPassword]) |
assertRejects(async function () { |
||||||
} catch (error) { |
await accountImporter.importAccount('Private Key', [ undefined ]) |
||||||
assert.equal(error.message, 'Key derivation failed - possibly wrong passphrase') |
}) |
||||||
} |
}) |
||||||
}) |
|
||||||
|
|
||||||
it('imports json string and password to return a private key', async function () { |
it('throws an error for undefined string private key', async () => { |
||||||
const fileContentsPassword = 'password1' |
assertRejects(async function () { |
||||||
const importJson = await accountImporter.importAccount('JSON File', [ json, fileContentsPassword]) |
await accountImporter.importAccount('Private Key', []) |
||||||
assert.equal(importJson, '0x5733876abe94146069ce8bcbabbde2677f2e35fa33e875e92041ed2ac87e5bc7') |
}) |
||||||
|
}) |
||||||
|
|
||||||
|
it('throws an error for invalid private key', async () => { |
||||||
|
assertRejects(async function () { |
||||||
|
await accountImporter.importAccount('Private Key', [ 'popcorn' ]) |
||||||
|
}) |
||||||
|
}) |
||||||
}) |
}) |
||||||
|
|
||||||
|
describe('JSON keystore import', function () { |
||||||
|
it('fails when password is incorrect for keystore', async function () { |
||||||
|
const wrongPassword = 'password2' |
||||||
|
|
||||||
|
try { |
||||||
|
await accountImporter.importAccount('JSON File', [ json, wrongPassword]) |
||||||
|
} catch (error) { |
||||||
|
assert.equal(error.message, 'Key derivation failed - possibly wrong passphrase') |
||||||
|
} |
||||||
|
}) |
||||||
|
|
||||||
|
it('imports json string and password to return a private key', async function () { |
||||||
|
const fileContentsPassword = 'password1' |
||||||
|
const importJson = await accountImporter.importAccount('JSON File', [ json, fileContentsPassword]) |
||||||
|
assert.equal(importJson, '0x5733876abe94146069ce8bcbabbde2677f2e35fa33e875e92041ed2ac87e5bc7') |
||||||
|
}) |
||||||
|
}) |
||||||
}) |
}) |
||||||
|
@ -0,0 +1,17 @@ |
|||||||
|
const assert = require('assert') |
||||||
|
|
||||||
|
module.exports = { |
||||||
|
assertRejects, |
||||||
|
} |
||||||
|
|
||||||
|
// assert.rejects added in node v10
|
||||||
|
async function assertRejects (asyncFn, regExp) { |
||||||
|
let f = () => {} |
||||||
|
try { |
||||||
|
await asyncFn() |
||||||
|
} catch (error) { |
||||||
|
f = () => { throw error } |
||||||
|
} finally { |
||||||
|
assert.throws(f, regExp) |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue