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
private static NetworkCredential PromptForUserCredentials(string preferredUserName, Uri serverUri) | |
{ | |
Unmanaged.CREDUI_INFO uiInfo = new Unmanaged.CREDUI_INFO() | |
{ | |
cbSize = Marshal.SizeOf(typeof(Unmanaged.CREDUI_INFO)), | |
pszCaptionText = serverUri.Host, | |
pszMessageText = string.Format(Resources.DeployWebResources_CredentialPromptMessage, serverUri.Host) | |
}; | |
uint autoPackage = 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
$objUser = New-Object System.Security.Principal.NTAccount("<domain>","<user name>") | |
$objUser.Translate([System.Security.Principal.SecurityIdentifier]).Value |
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
/// <summary> | |
/// Compare if given two byte arrays are identical. | |
/// </summary> | |
/// <param name="x">byte array to compare.</param> | |
/// <param name="y">byte array to compare.</param> | |
/// <returns>true if x and y are identical.</returns> | |
public unsafe static bool ByteArrayCompare(byte[] x, byte[] y) | |
{ | |
if (x == null || y == null || x.Length != y.Length) | |
{ |
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
foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies()) | |
{ | |
try | |
{ | |
foreach (Type t in a.GetExportedTypes()) | |
{ | |
try | |
{ | |
IntPtr pUnk = Marshal.GetIUnknownForObject(ProjectCfgObject); |
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
function printStackTrace() { | |
var callstack = []; | |
var isCallstackPopulated = false; | |
try { | |
i.dont.exist+=0; //doesn't exist- that's the point | |
} catch(e) { | |
if (e.stack) { //Firefox | |
var lines = e.stack.split('\n'); | |
for (var i=0, len=lines.length; i<len; i++) { | |
if (lines[i].match(/^\s*[A-Za-z0-9\-_\$]+\(/)) { |
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
import java.net.URI | |
import java.util.regex.{Pattern, Matcher} | |
import scala.annotation.tailrec | |
object UrlNormalizer { | |
/** | |
* URI.normalize handles path normalization. Doc: http://docs.oracle.com/javase/7/docs/api/java/net/URI.html#normalize() | |
* e.g. /a/b/../c will become /a/c | |
* Fragment is also removed. |
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
# errexit on | |
set -e | |
echo Distroying /dev/sda and creating partition. Press Ctrl+C to exit | |
read -n1 -r -p "Press any key to continue" | |
sgdisk -Z --new=0:0:0 --typecode=0:8300 --new=0:0:0 --typecode=0:EF02 /dev/sda | |
mkfs.ext4 /dev/sda1 | |
mkfs.ext4 /dev/sda2 |
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
private void CreateMesh() | |
{ | |
var start = Quaternion.AngleAxis(-45, Vector3.up) * Vector3.forward * 6f; | |
var end = Quaternion.AngleAxis(45, Vector3.up) * Vector3.forward * 6f; | |
var control = Vector3.forward * 6f; | |
var points1 = GetPointsInCurve(start, end, control, 20); | |
start = Quaternion.AngleAxis(15, Vector3.right) * start; | |
end = Quaternion.AngleAxis(15, Vector3.right) * end; |
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
# Credits to https://losfuzzys.github.io/writeup/2017/02/27/bkpctf2017-signed-shell-server/ | |
from pwn import * # noqa | |
import string | |
import random | |
velf = ELF("./sss") | |
# this is the byte we'd need... | |
last_byte = velf.symbols['exec_command'] & 0xff | |
log.info("last byte of exec_command 0x{:x}".format(last_byte)) |
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
# curl -L goo.gl/pJHMCG | bash | |
sudo pacman -Syu --noconfirm | |
sudo pacman -S --noconfirm --needed \ | |
calc \ | |
firefox \ | |
git \ | |
gvim \ | |
gnu-netcat \ | |
python \ |
OlderNewer