This file contains hidden or 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
| #include <stdio.h> | |
| #include <fcntl.h> | |
| #include <unistd.h> | |
| #include <machine/cpufunc.h> | |
| int main() { | |
| /* Opening /dev/io grants the process permission to use outb/inb | |
| instructions on FreeBSD x86/amd64 systems. */ | |
| int fd = open("/dev/io", O_RDWR); | |
| if (fd == -1) { |
This file contains hidden or 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
| #include <stdio.h> | |
| #include <stdint.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #define IEEE80211_ADDR_LEN 6 | |
| #define IEEE80211_ELEMID_SSID 0 | |
| #define IEEE80211_ELEMID_RATES 1 |
This file contains hidden or 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
| # IPv4 with CIDR | |
| re.match('^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(/(3[0-2]|2[0-9]|1[0-9]|[0-9]))?$', '192.0.2.0/24') | |
| # IPv6 with CIDR | |
| re.match('^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))(\/((1(1[0-9]|2[0-8]))|([0-9][0-9])|([0-9])))?$', '2001:DB8::/128') | |
| # Host Name | |
| re.match('^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Z |
This file contains hidden or 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
| SRCS=taskqueue_example.c | |
| KMOD=taskqueue_example | |
| .include <bsd.kmod.mk> |
This file contains hidden or 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
| # Basic skeleton of Daemon Fork-based daemon service | |
| # | |
| # It will accept a new socket connection, then trigger execute_cmd(). You | |
| # can create a global variable to keep track of the child processes if you | |
| # need to. This approach is sub-optimal, it should use select/poll on the | |
| # accept() function, but this is python not C with a Posix interface. I am | |
| # having the child process just do a simple "/bin/ls" as a proof of concept. | |
| # | |
| # Farhan Khan (khanzf@gmail.com) |
This file contains hidden or 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
| AUTHENTICATION_BACKENDS = ( | |
| 'django_auth_ldap.backend.LDAPBackend', | |
| 'django.contrib.auth.backends.ModelBackend', | |
| ) | |
| import ldap | |
| from django_auth_ldap.config import LDAPSearch, NestedActiveDirectoryGroupType | |
| # Binding and connection options | |
| AUTH_LDAP_SERVER_URI = "ldap://192.168.1.13" |
This file contains hidden or 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
| #include <sys/stat.h> | |
| #include <stdio.h> | |
| #include <stdint.h> | |
| int main() { | |
| printf("struct stat: %lu\n", sizeof(struct stat)); | |
| printf("struct stat->st_dev %lu\n", sizeof(unsigned long)); | |
| printf("struct stat->ctime_nsec: %lu\n", sizeof(unsigned long)); | |
| printf("unsigned long: %lu\n", sizeof(unsigned long)); | |
| printf("uint64_t: %lu\n", sizeof(uint64_t)); |
This file contains hidden or 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
| // Compiled on BSD with cc shatest.c -o shatest -lmd | |
| #include <sys/types.h> | |
| #include <string.h> | |
| #include <stdio.h> | |
| #include <sha.h> | |
| #define HEX_DIGEST_LENGTH 257 | |
| int |
This file contains hidden or 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
| #!/usr/sbin/dtrace -qs | |
| /* | |
| * Run with sudo ./tap_function.d -q | |
| */ | |
| struct ieee80211_channel { | |
| uint32_t ic_flags; /* see below */ | |
| uint16_t ic_freq; /* primary centre frequency in MHz */ | |
| uint8_t ic_ieee; /* IEEE channel number */ |
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| ''' | |
| Recursively downloads Debian/Ubuntu/Kali packages and all associated dependencies | |
| By: Farhan Khan (Farhan_Khan@McAfee.com) (khanzf@gmail.com) | |
| You MUST run this on the same distribution AND version of the target system. | |
| This only downloads the latest version of the package available within the | |
| target distribution. | |
| Download a single package: |
NewerOlder