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
import sys | |
import multiprocessing | |
import csv | |
from pyparsing import Word, alphas, Suppress, Combine, string, nums, Optional, Regex | |
from itertools import zip_longest | |
class ParallelLogParser(object): | |
def __init__(self, log_file): | |
self.log_file = log_file |
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
import sys | |
import multiprocessing | |
import csv | |
from pyparsing import Word, alphas, Suppress, Combine, string, nums, Optional, Regex | |
class ParallelLogParser(object): | |
def __init__(self, log_file): | |
self.log_file = log_file | |
self.authlog_grammar = self.__get_authlog_grammar() |
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
import sys | |
import csv | |
from pyparsing import Word, alphas, Suppress, Combine, string, nums, Optional, Regex | |
class AuthLogParser(object): | |
def __init__(self, log_file): | |
self.log_file = log_file | |
self.authlog_grammar = self.__get_authlog_grammar() | |
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
# https://nlpforhackers.io/training-ner-large-dataset/ | |
import os | |
from nltk import conlltags2tree | |
import re | |
from nltk.stem.snowball import SnowballStemmer | |
import itertools | |
from nltk import tree2conlltags | |
from nltk.chunk import ChunkParserI | |
from sklearn.linear_model import Perceptron, SGDClassifier |
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
import socket | |
BUFF = 1024 | |
mail_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
mail_socket.connect(('mail.***.edu', 143)) | |
mail_socket.recv(BUFF).strip() | |
commands = ['a1 LOGIN ***@***.edu ***\r\n', 'a2 LIST "" "*"\r\n', 'a3 EXAMINE INBOX\r\n', 'a4 LOGOUT\r\n'] | |
for command in commands: | |
mail_socket.send(command) |
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
import socket | |
import select | |
import sys | |
server_address = ('127.0.0.1', 80) | |
server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) | |
server_socket.bind(server_address) | |
server_socket.listen(5) |
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
import socket | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
s.connect(('localhost', 21)) | |
welcome_msg = s.recv(1024).strip() | |
# print welcome_msg | |
commands = ['USER 5112100155\r\n', 'PASS 123\r\n', 'TYPE I\r\n', 'EPSV\r\n', 'QUIT\r\n'] | |
i = 1 | |
while True: |
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 python | |
# a Python script to filter exported bib file from Mendeley Desktop | |
import sys | |
import glob | |
import os | |
# read all .bib files | |
bibfiles = glob.glob('*.bib') |
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
import socket | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
s.connect (('localhost', 21)) | |
commands = ['USER hudan\r\n', 'PASS 123\r\n', 'TYPE I\r\n', 'EPSV\r\n', 'MLSD\r\n', 'QUIT\r\n'] | |
i = 1 | |
while True: | |
try: | |
if i > len(commands): |
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
import socket | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
s.connect (('localhost', 21)) | |
commands = ['USER hudan\r\n', 'PASS 123\r\n', 'HELP\r\n', 'QUIT\r\n'] | |
i = 1 | |
while True: | |
try: | |
if i > len(commands): |
NewerOlder