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
/* Heartbleed OpenSSL vulnerbility POC | |
* CVE-2014-0160 | |
* | |
* You need to modify OpenSSL client code: ssl/t1_lib.c, function tls1_heartbeat | |
* Previous line: \/\* Payload length (18 bytes here) \*\/ | |
* Old line: s2n(payload, p); | |
* New line: s2n(65536 - 100, p); // pretend that we have so many bytes of payload... | |
* | |
* To compile: | |
* gcc -g -o testssl -Iinclude -L. -lssl ssl/*.o testssl.c |
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
#include <linux/kernel.h> | |
#include <linux/module.h> | |
#include <linux/kprobes.h> | |
#include <linux/netdevice.h> | |
#include <linux/fs.h> | |
#include <linux/fs_struct.h> | |
/* For each probe you need to allocate a kprobe structure */ | |
static struct kprobe kp = { | |
.symbol_name = "dev_change_flags", |
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
/* Simple Browser Sample | |
* Put this file (browser.h) and browser.cpp, browser.pro in one folder. | |
* Use Qt Creator with Qt 5 to compile the project. | |
* | |
* Content of browser.cpp | |
* | |
#include "browser.h" | |
int main(int argc, char** argv) { | |
QApplication app(argc, argv); |
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
#include<stdio.h> | |
static long get_factor_num(long n) { | |
int factor; | |
int exp_count = 0; | |
int ans = 1; | |
for (factor = 2; n > 1; factor++) { | |
exp_count = 0; | |
while (n % factor == 0) { | |
n /= factor; | |
++exp_count; |
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
#include<stdio.h> | |
#define N 15 | |
int main() { | |
int i, j, max = 0; | |
int a[N][N]; | |
for (i=0; i<N; i++) | |
for (j=0; j<=i; j++) | |
scanf("%d", &a[i][j]); | |
for (i=1; i<N; i++) { | |
a[i][0] += a[i-1][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
#include<stdio.h> | |
#define N 15 | |
int main() { | |
int i, j, max = 0, state, total, pos; | |
int a[N][N]; | |
for (i=0; i<N; i++) | |
for (j=0; j<=i; j++) | |
scanf("%d", &a[i][j]); | |
for (state=0; state<(1<<(N-1)); state++) { | |
total = 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
#include<stdio.h> | |
static long get_factor_num(long n) { | |
int factor; | |
int exp_count = 1; | |
int ans = 1; | |
for (factor = 2; n > 1; factor++) { | |
exp_count = 1; | |
while (n % factor == 0) { | |
n /= factor; | |
exp_count *= factor; |
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
#include<stdio.h> | |
int ischar(char now) { | |
return (now >= 'a' && now <= 'z' || now >= 'A' && now <= 'Z'); | |
} | |
int main() | |
{ | |
char last = 0, now = 0; | |
int count = 0; | |
while ((now = getchar()) != EOF) { | |
if (ischar(now) && !ischar(last)) |
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
#include<stdio.h> | |
int main() { | |
double sign = 1, intpart = 0, decmod = 1; | |
int expsign = 1, exp = 0; | |
double ans; | |
int i; | |
char c; | |
c = getchar(); | |
if (c == '-') { |
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
#include<stdio.h> | |
void c_p_mn_array(int m, int n, int result[2]) { | |
int i; | |
result[1] = 1; | |
for (i=m-n+1; i<=m; i++) | |
result[1] *= i; | |
result[0] = result[1]; | |
for (i=2; i<=n; i++) | |
result[0] /= i; | |
} |
OlderNewer