Skip to content

Instantly share code, notes, and snippets.

View DiegoCaridei's full-sized avatar

DiegoCaridei DiegoCaridei

View GitHub Profile
@tothi
tothi / mkpsrevshell.py
Created February 17, 2019 00:05
reverse PowerShell cmdline payload generator (base64 encoded)
#!/usr/bin/env python3
#
# generate reverse powershell cmdline with base64 encoded args
#
import sys
import base64
def help():
print("USAGE: %s IP PORT" % sys.argv[0])
@taglia3
taglia3 / UIViewControllerExtension.swift
Last active August 21, 2018 19:04
This method allow you to go back the nearest ViewController of type T
import UIKit
extension UIViewController {
/// This method allow you to go back the nearest ViewController of type T
///
/// - Parameter type: the type of the target ViewController
/// - Returns: true if the method succeded, false if the user has to take extra actions to go back to the previous ViewController
func back<T: UIViewController>(to type: T.Type) -> Bool {
@ole
ole / UIAlertController+TextField.swift
Last active September 13, 2022 14:20
A UIAlertController with a text field and the ability to perform validation on the text the user has entered while the alert is on screen. The OK button is only enabled when the entered text passes validation. More info: https://oleb.net/2018/uialertcontroller-textfield/
import UIKit
/// A validation rule for text input.
public enum TextValidationRule {
/// Any input is valid, including an empty string.
case noRestriction
/// The input must not be empty.
case nonEmpty
/// The enitre input must match a regular expression. A matching substring is not enough.
case regularExpression(NSRegularExpression)
@darthpelo
darthpelo / swiftlint.yml
Created March 2, 2018 09:15
Basic aggressive SwiftLint
excluded: # paths to ignore during linting. Takes precedence over `included`.
- Tests
- Pods
- Carthage
- R.generated.swift
- MyPlayground.playground
disabled_rules:
- trailing_whitespace
- multiple_closures_trailing_closure
disabled_rules: # rule identifiers to exclude from running
- line_length
- function_body_length
- cyclomatic_complexity
- multiple_closures_with_trailing_closure
- xctfail_message
# Swift 3 rules that do not make sense for Swift 2.3
- implicit_getter
@unfo
unfo / enum.sh
Created April 7, 2017 14:30
Linux priv esc. Might be out-dated script versions
#!/bin/bash
BLACK="\033[30m"
RED="\033[31m"
GREEN="\033[32m"
YELLOW="\033[33m"
BLUE="\033[34m"
PINK="\033[35m"
CYAN="\033[36m"
WHITE="\033[37m"
@ccabanero
ccabanero / Swift 3 Protocol Pattern Snippet
Created January 10, 2017 23:49
Swift 3 Protocol Pattern Snippet
// set up - MapViewController is the parent. A ContainerView is used to place the UI for directions - part of the DirectionsViewController.
// The DirectionsViewController has a protocol method for letting the delegate know when a user has tapped the 'get directions' button and passes the to and from data
// this ViewController is the delegate for the DirectionsViewController
Class MapViewController: UIViewController, DirectionsViewControllerDelegate {
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// for getting access to the DirectionsViewController and settings its delegate as THIS controller
@JagCesar
JagCesar / Fastfile
Created December 29, 2016 15:36
Cookin Fastfile
# Customise this file, documentation can be found here:
# https://github.com/fastlane/fastlane/tree/master/docs
# All available actions: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Actions.md
# can also be listed using the `fastlane actions` command
# Change the syntax highlighting to Ruby
# All lines starting with a # are ignored when running `fastlane`
# If you want to automatically update fastlane if a new version is available:
# update_fastlane
@kristovatlas
kristovatlas / drozer_setup.sh
Last active February 16, 2020 11:58
Instructions for setting up drozer in MacOS 10.11 "El Capitan"
#Based on https://blog.ropnop.com/installing-drozer-on-os-x-el-capitan/
#Install recent python 2 and viritualenvwrapper
brew install python
brew upgrade python
pip install virtualenvwrapper
#At this point if you try to run mkvirtualenv, you'll get an error message. To resolve, follow the instructions indicated in /usr/local/bin/virtualenvwrapper.sh. In my current copy, they are:
# 1. Create a directory to hold the virtual environments.
# (mkdir $HOME/.virtualenvs).
function Invoke-UACBypass {
<#
.SYNOPSIS
Bypasses UAC on Windows 10 by abusing the SilentCleanup task to win a race condition, allowing for a DLL hijack without a privileged file copy.
Author: Matthew Graeber (@mattifestation), Matt Nelson (@enigma0x3)
License: BSD 3-Clause
Required Dependencies: None
Optional Dependencies: None