Skip to content

Instantly share code, notes, and snippets.

@jerrypy
jerrypy / p0f-ssl-2012-05-17.diff
Created January 7, 2018 11:05 — forked from majek/p0f-ssl-2012-05-17.diff
p0f-ssl-2012-05-17.diff
diff --git a/build.sh b/build.sh
index 112e404..2974fdc 100755
--- a/build.sh
+++ b/build.sh
@@ -31,7 +31,7 @@ else
USE_LIBS="-lpcap $LIBS"
fi
-OBJFILES="api.c process.c fp_tcp.c fp_mtu.c fp_http.c readfp.c"
+OBJFILES="api.c process.c fp_tcp.c fp_mtu.c fp_http.c fp_ssl.c readfp.c"
@jerrypy
jerrypy / ps3d.py
Created November 5, 2017 14:23
MIT 6.00 Assignments solution
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from ps3b import subStringMatchExact
from ps3c import subStringMatchOneSub
def subStringMatchExactlyOneSub(target, key):
t1 = subStringMatchExact(target, key)
t2 = subStringMatchOneSub(target, key)
@jerrypy
jerrypy / ps3c.py
Created November 5, 2017 14:19
MIT 6.00 Assignments solution
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from ps3b import subStringMatchExact
def constrainedMatchPair(firstMatch, SecondMatch, lenth):
ans = ()
for i in firstMatch:
for j in SecondMatch:
@jerrypy
jerrypy / ps3b.py
Created November 5, 2017 09:56
MIT 6.00 Assignments solution
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def subStringMatchExact(target, key):
idx = 0
res = ()
while True:
new_idx = target.find(key, idx)
if new_idx < 0:
@jerrypy
jerrypy / ps3a.py
Created November 5, 2017 09:56
MIT 6.00 Assignments soluntion
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def countSubStringMatch(target, key):
count = 0
idx = 0
while True:
new_idx = target.find(key, idx)
if new_idx < 0:
@jerrypy
jerrypy / ps2.py
Created November 4, 2017 13:55
MIT 6.00 Assignments solutions
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def diophantine(n):
a = b = c = 0
for a in range(20):
for b in range(20):
for c in range(20):
if 6 * a + 9 * b + 20 * c == n:
@jerrypy
jerrypy / ps1b.py
Created November 2, 2017 07:28
MIT 6.00 Assignments solutions
'''
Problem 1 b
Write a program that computes the sum of the logarithms of all the primes from 2 to some
number n, and print out the sum of the logs of the primes, the number n, and the ratio of these
two quantities. Test this for different values of n.
You should be able to make only some small changes to your solution to Problem 1 to solve this
problem as well.
'''
@jerrypy
jerrypy / ps1a.py
Created November 2, 2017 07:25
MIT 6.00 Assignments solutions
'''
Problem 1 a
Write a program that computes and prints the 1000th prime number.
'''
from math import sqrt
def is_prime(num):
i = 2
while i <= sqrt(num):