CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/external/source/exploits/CVE-2016-4669/utils.h
Views: 11780
1
#ifndef UTILS_H
2
#define UTILS_H
3
4
@import Foundation;
5
#include <stdio.h>
6
#include <dlfcn.h>
7
#include <stdlib.h>
8
#include <fcntl.h>
9
#include <unistd.h>
10
#include <sys/attr.h>
11
#include <mach/mach.h>
12
#include <sys/mman.h>
13
#include <sys/types.h>
14
#include <sys/stat.h>
15
#include <sys/syscall.h>
16
#include <sys/mount.h>
17
#include <spawn.h>
18
#include <sys/sysctl.h>
19
#include <sys/types.h> /* See NOTES */
20
#include <sys/socket.h>
21
22
#include <stdint.h>
23
#include <CoreFoundation/CoreFoundation.h>
24
25
typedef mach_port_t io_object_t;
26
typedef io_object_t io_iterator_t;
27
typedef io_object_t io_service_t;
28
typedef char * io_buf_ptr_t;
29
typedef uintptr_t addr_t;
30
31
void for_other_threads(void (^handler)(thread_act_t thread));
32
void set_nofile_limit();
33
int download(char *src, char *dest);
34
mach_port_t alloc_port();
35
kern_return_t kalloc_ool_ports(mach_port_t port, mach_port_t ool_port, size_t cnt);
36
kern_return_t kalloc_page_ool_ports(mach_port_t port);
37
kern_return_t kalloc_8_ool_ports(mach_port_t port, mach_port_t ool_port);
38
void discard_message(mach_port_t port);
39
void hexdump(void *ptr, size_t n);
40
int pipe_create(int fds[2]);
41
int pipe_alloc(int fds[2], void *buf, size_t size);
42
void pipes_close(int *pipes, size_t count);
43
int pipes_create(int *pipes, size_t count);
44
int pipes_alloc(int *pipes, size_t count, char *pipe_buf);
45
46
//#define DEBUG 1
47
#ifdef DEBUG
48
#define LOG(str, args...) do { NSLog(@str, ##args); } while(0)
49
#else
50
#define LOG(str, args...) do {} while(0)
51
#endif
52
53
#endif
54
55