profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/phackt/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
Gabriel Compan phackt https://www.linkedin.com/in/gabriel-compan/ Paris https://phackt.com https//www.buymeacoffee.com/phackt

phackt/pentest 89

Custom tools and projects about security

phackt/Invoke-Recon 62

"Powershell script assisting with domain enumerating and in finding quick wins" - Basically written while doing the 'Advanced Red Team' lab from pentesteracademy.

phackt/mitm 11

Repository housing my 'man in the middle' project dealing with mitmproxy (Defeating HTTPS/HSTS, JS injection, DNS spoofing)

phackt/killswitch 2

VPN Killswitch

phackt/awesome-pentest 1

A collection of awesome penetration testing resources, tools and other shiny things

phackt/phackt.github.io 1

https://phackt.com

phackt/PowerSploit 1

PowerSploit - A PowerShell Post-Exploitation Framework

phackt/pwnwiki.github.io 1

PwnWiki - The notes section of the pentesters mind.

phackt/altdns 0

Generates permutations, alterations and mutations of subdomains and then resolves them

startedmakinhs/rest-api-tutorial

started time in a month

issue commentreligion-counter/onlyone

Error: Returned error: insufficient funds for gas * price + value

Hi @religion-counter, yes you are totally right i can now figure out what my mistakes are ! After fixing with what you said it works like a charm ! Thanks for your sharing it helps a lot !!

phackt

comment created time in 2 months

issue closedreligion-counter/onlyone

Error: Returned error: insufficient funds for gas * price + value

Hi, first of all thanks a lot for this content, it's hard to find this kind of code to let us know how things work under the hood.
I'm trying to buy a token (RUSD) with BUSD. The fact is i'm always getting that i have not enough funds on my wallet, even if i have enough BNB (0.5) to pay the transaction fee.

I'm using your code, just changed a few things for my needs:

var fs = require('fs')
var Tx = require('ethereumjs-tx').Transaction;
var Web3 = require('web3')
var Common = require('ethereumjs-common').default;

var web3 = new Web3(new Web3.providers.HttpProvider('https://bsc-dataseed.binance.org/'))
var BSC_FORK = Common.forCustomChain(
    'mainnet',
    {
        name: 'Binance Smart Chain Mainnet',
        networkId: 56,
        chainId: 56,
        url: 'https://bsc-dataseed.binance.org/'
    },
    'istanbul',
);

// Amount to buy
const execSync = require('child_process').execSync;
const originalAmountToBuyWith = execSync('node getTokensBalance.js busd', { encoding: 'utf-8' }).replace(/\s+/g, ' ').trim();

var busdAmount = web3.utils.toWei(originalAmountToBuyWith, 'ether');

var config = JSON.parse(fs.readFileSync('config.json', 'utf-8'));

console.log(`Buying RUSD for ${originalAmountToBuyWith} BUSD from pancakeswap for address ${config.walletAddress}`);

var res = buyRUSD(config.walletAddress, busdAmount);
console.log(res);

async function buyRUSD(walletAddress, amount) {

    var amountToBuyWith = web3.utils.toHex(amount);
    var privateKey = Buffer.from(config.privateKey, 'hex')  ;

    var amountOutMin = '100' + Math.random().toString().slice(2,6);

    var routerAbi = JSON.parse(fs.readFileSync('pancake-router-abi.json', 'utf-8'));
    var contract = new web3.eth.Contract(routerAbi, config.pancakeSwapRouterAddress, {from: walletAddress});
    var data = contract.methods.swapExactETHForTokens(
        web3.utils.toHex(amountOutMin),
        [config.busdAddress,
         config.rusdAddress],
        walletAddress,
        web3.utils.toHex(Math.round(Date.now()/1000)+60*20),
    );

    var count = await web3.eth.getTransactionCount(walletAddress);

    var rawTransaction = {
        "from":walletAddress,
        "gasPrice": web3.utils.toHex(web3.utils.toWei('5', 'gwei')),
        "gasLimit": 100000,
        "to":config.pancakeSwapRouterAddress,
        "value":web3.utils.toHex(amountToBuyWith),
        "data":data.encodeABI(),
        "nonce":web3.utils.toHex(count)
    };

    var transaction = new Tx(rawTransaction, { 'common': BSC_FORK });
    transaction.sign(privateKey);

    var result = await web3.eth.sendSignedTransaction('0x' + transaction.serialize().toString('hex'));
    return result;
}

I always get (node:327974) UnhandledPromiseRejectionWarning: Error: Returned error: insufficient funds for gas * price + value. I'm using my metamask wallet, i'm sure the wallet address is good, also the privatekey associated.

Another point, how are you sure you won't spend too much transaction fees if there is some congestion ? gasLimit i suppose.

Thanks again mate if you have any idea! Gabriel.

closed time in 2 months

phackt

issue commentreligion-counter/onlyone

Error: Returned error: insufficient funds for gas * price + value

Start of answer, i changed;

const busdAmount = web3.utils.toWei(originalAmountToBuyWith, 'ether');

with;

const busdAmount = Math.floor(originalAmountToBuyWith);

Now the tx has been reverted, got Fail with error 'PancakeRouter: INVALID_PATH' (0x4bd551cd835cd17ac71458cc61faeb3569bafd19e607df2feb3c0b7f0b131e32)

phackt

comment created time in 2 months

issue openedreligion-counter/onlyone

Error: Returned error: insufficient funds for gas * price + value

Hi, first of all thanks a lot for this content, it's hard to find this kind of code to let us know how things work under the hood.
I'm trying to buy a token (RUSD) with BUSD. The fact is i'm always getting that i have not enough funds on my wallet, even if i have enough BNB (0.5) to pay the transaction fee.

I'm using your code, just changed a few things for my needs:

var fs = require('fs')
var Tx = require('ethereumjs-tx').Transaction;
var Web3 = require('web3')
var Common = require('ethereumjs-common').default;

var web3 = new Web3(new Web3.providers.HttpProvider('https://bsc-dataseed.binance.org/'))
var BSC_FORK = Common.forCustomChain(
    'mainnet',
    {
        name: 'Binance Smart Chain Mainnet',
        networkId: 56,
        chainId: 56,
        url: 'https://bsc-dataseed.binance.org/'
    },
    'istanbul',
);

// Amount to buy
const execSync = require('child_process').execSync;
const originalAmountToBuyWith = execSync('node getTokensBalance.js busd', { encoding: 'utf-8' }).replace(/\s+/g, ' ').trim();

var busdAmount = web3.utils.toWei(originalAmountToBuyWith, 'ether');

var config = JSON.parse(fs.readFileSync('config.json', 'utf-8'));

console.log(`Buying RUSD for ${originalAmountToBuyWith} BUSD from pancakeswap for address ${config.walletAddress}`);

var res = buyRUSD(config.walletAddress, busdAmount);
console.log(res);

async function buyRUSD(walletAddress, amount) {

    var amountToBuyWith = web3.utils.toHex(amount);
    var privateKey = Buffer.from(config.privateKey, 'hex')  ;

    var amountOutMin = '100' + Math.random().toString().slice(2,6);

    var routerAbi = JSON.parse(fs.readFileSync('pancake-router-abi.json', 'utf-8'));
    var contract = new web3.eth.Contract(routerAbi, config.pancakeSwapRouterAddress, {from: walletAddress});
    var data = contract.methods.swapExactETHForTokens(
        web3.utils.toHex(amountOutMin),
        [config.busdAddress,
         config.rusdAddress],
        walletAddress,
        web3.utils.toHex(Math.round(Date.now()/1000)+60*20),
    );

    var count = await web3.eth.getTransactionCount(walletAddress);

    var rawTransaction = {
        "from":walletAddress,
        "gasPrice": web3.utils.toHex(web3.utils.toWei('5', 'gwei')),
        "gasLimit": 100000,
        "to":config.pancakeSwapRouterAddress,
        "value":web3.utils.toHex(amountToBuyWith),
        "data":data.encodeABI(),
        "nonce":web3.utils.toHex(count)
    };

    var transaction = new Tx(rawTransaction, { 'common': BSC_FORK });
    transaction.sign(privateKey);

    var result = await web3.eth.sendSignedTransaction('0x' + transaction.serialize().toString('hex'));
    return result;
}

I always get (node:327974) UnhandledPromiseRejectionWarning: Error: Returned error: insufficient funds for gas * price + value. I'm using my metamask wallet, i'm sure the wallet address is good, also the privatekey associated.

Another point, how are you sure you won't spend too much transaction fees if there is some congestion ? gasLimit i suppose.

Thanks again mate if you have any idea! Gabriel.

created time in 2 months

issue openedGhostPack/PSPKIAudit

"Operation is not supported on this platform." from runas /netonly

Hi, did you succeed in using your module from a non joined machine (runas /netonly) ?. I'm facing this issue:

> Get-AuditCertificateAuthority -CAComputerName "CN=ACNAME,CN=Certification Authorities,CN=Public Key Services,CN=Services,CN=Configuration,DC=contoso,DC=local"
Exception calling "GetAdPkiContainer" with "1" argument(s): "Operation is not supported on this platform."
At C:\Users\user\Documents\tools\pentest\PSPKIAudit\PSPKI\3.7.2\Server\Get-CertificationAuthority.ps1:18 char:9
+         $DSList = [SysadminsLV.PKI.Management.ActiveDirectory.DsPkiCo ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : PlatformNotSupportedException

Thanks,

created time in 2 months

push eventphackt/Invoke-Recon

phackt

commit sha cc6b14f88c9206e2dc7e42de3e624eacdfa34766

fix bug exchange build version

view details

push time in 2 months

push eventphackt/Invoke-Recon

phackt

commit sha 4d48688405c5947d591c9510329cbdc047243cd7

fix bug about prixexchange detection

view details

push time in 2 months

startedtopotam/PetitPotam

started time in 2 months

push eventphackt/Invoke-Recon

phackt

commit sha 5adfdd198ab6bd2f7e581ba1c4512fa9b4f89df1

fix Admnistrators domain local group

view details

push time in 2 months

fork phackt/labs

Labs setup for tests & experimentations

fork in 2 months

startedcommial/labs

started time in 2 months

push eventphackt/phackt.github.io

phackt

commit sha d5069b1acbccba3e8ca730ceda2b4f44ab0a4ccc

quick update

view details

push time in 3 months

push eventphackt/wptsextensions.dll

Gabriel Compan

commit sha 6794f27f505af95f720832a45f896e79864d55dd

Update README.md

view details

push time in 3 months

startedafwu/PrintNightmare

started time in 3 months

push eventphackt/phackt.github.io

phackt

commit sha 90dec63bb5eab7743f2fbd49b0f62c5a5c593d4b

add write property extended

view details

push time in 3 months

push eventphackt/phackt.github.io

phackt

commit sha 7d56c0a17b19bfd69a51808863a19d3547140b78

fix typo dnsadmins

view details

push time in 3 months

push eventphackt/phackt.github.io

phackt

commit sha 161321914983beeec971267b8191a200b5ce1526

update dnsadmins mitigations

view details

push time in 3 months

push eventphackt/phackt.github.io

phackt

commit sha 5a8f78709a3489a03295df241131bd1d4e612e94

update dnsadmins

view details

push time in 3 months

push eventphackt/phackt.github.io

phackt

commit sha d36f83d540423d4c1da6070d02cc52aebaf76153

temp dnsadms mitigations

view details

phackt

commit sha bdba9246649ad400945b10fdb7be34653b72b423

update dnsadmins

view details

phackt

commit sha bddcd26ae894ec45c49787b8c946205f63fdd6bc

update dnsadmins

view details

push time in 3 months

push eventphackt/phackt.github.io

phackt

commit sha 51abadbb1cd6cf758cc8fd43f59c5ffce603d372

update dnsadmins

view details

push time in 3 months

startedMichaelGrafnetter/DSInternals

started time in 3 months