text
stringlengths
0
9.3M
# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2017 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
from enum import Enum class Verbosity(int, Enum): DEFAULT = 0 VERBOSE = 1
#!/usr/bin/env python3 # Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
# Copyright 2017 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
#!/usr/bin/env python3 # Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
#!/usr/bin/env python3 # Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
#!/usr/bin/env python3 # Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
#!/usr/bin/env python3 # Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
#!/usr/bin/env python3 # Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
# Copyright 2017 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2017 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
import pathlib import pytest from floss.results import StaticString, StringEncoding from floss.language.go.extract import extract_go_strings @pytest.fixture(scope="module") def go_strings32(): n = 6 path = pathlib.Path(__file__).parent / "data" / "language" / "go" / "go-hello" / "bin" / "go-hello.exe" r...
import pathlib import pytest from floss.results import StaticString, StringEncoding from floss.language.rust.extract import extract_rust_strings @pytest.fixture(scope="module") def rust_strings32(): n = 6 path = pathlib.Path(__file__).parent / "data" / "language" / "rust" / "rust-hello" / "bin" / "rust-hell...
import pathlib import contextlib import pefile import pytest from floss.utils import get_static_strings from floss.language.go.extract import extract_go_strings from floss.language.go.coverage import get_extract_stats @pytest.mark.parametrize( "binary_file", [ ("data/language/go/go-unknown-binaries/...
import pathlib import zipfile import pytest from floss.language.go.extract import extract_go_strings @pytest.fixture(scope="module") def extract_files(request): def _extract_files(zip_file_name, extracted_dir_name): zip_file_path = ( pathlib.Path(__file__).parent / "data" ...
from pathlib import Path import pytest from floss.utils import get_static_strings from floss.language.identify import VERSION_UNKNOWN_OR_NA, Language, identify_language_and_version @pytest.mark.parametrize( "binary_file, expected_result, expected_version", [ ("data/language/go/go-hello/bin/go-hello....
import pathlib import contextlib import pefile import pytest from floss.strings import extract_ascii_unicode_strings from floss.language.utils import get_extract_stats from floss.language.rust.extract import extract_rust_strings @pytest.mark.parametrize( "binary_file", [ ( "data/language...
import pathlib import zipfile import pytest from floss.language.rust.extract import extract_rust_strings @pytest.fixture(scope="module") def extract_files(request): def _extract_files(zip_file_name, extracted_dir_name): zip_file_path = ( pathlib.Path(__file__).parent / "data" ...
import textwrap import floss.main # floss --no static -j tests/data/src/decode-in-place/bin/test-decode-in-place.exe RESULTS = textwrap.dedent( """ { "analysis": { "enable_decoded_strings": true, "enable_stack_strings": true, "enable_static_strings": false, "enable_tight_string...
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2017 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
#!/usr/bin/env python import os import csv import queue import zipfile import requests import argparse import multiprocessing # TODO: Don't hardcode the relative path? samples_path = "gym_malware/envs/utils/samples/" hashes_path = "gym_malware/envs/utils/sample_hashes.csv" vturl = "https://www.virustotal.com/vtapi/v2...
from setuptools import setup setup(name='gym_malware', version='0.0.1', install_requires=['gym','numpy','sklearn','requests','keras-rl'] # And any other dependencies the package needs ) # note: must install https://github.com/lief-project/LIEF/releases/download/0.7.0/linux_lief-0.7.0_py3.6.tar.gz [modi...
import numpy as np from gym_malware.envs.utils import interface, pefeatures from gym_malware.envs.controls import manipulate2 as manipulate from gym_malware import sha256_train, sha256_holdout, MAXTURNS from collections import defaultdict from keras.models import load_model ACTION_LOOKUP = {i: act for i, act in enum...
import numpy as np from gym_malware.envs.utils import interface, pefeatures from gym_malware.envs.controls import manipulate2 as manipulate from gym_malware import sha256_train, sha256_holdout, MAXTURNS from collections import defaultdict from keras.models import load_model ACTION_LOOKUP = {i: act for i, act in enum...
import numpy as np import gym import gym_malware import chainer import chainer.functions as F import chainer.links as L import chainerrl from chainerrl.action_value import DiscreteActionValue from chainerrl import links from chainerrl.agents import acer from chainerrl.distribution import SoftmaxDistribution from ch...
import pickle import numpy as np import gym np.random.seed(123) # set a random seed when setting up the gym environment (train_test_split) import gym_malware from keras.models import Sequential from keras.layers import Dense, Activation, Flatten, ELU, Dropout, BatchNormalization from keras.optimizers import Adam, SGD,...
from gym.envs.registration import register # get samples for environment from gym_malware.envs.utils import interface, pefeatures sha256 = interface.get_available_sha256() # create a holdout set from sklearn.model_selection import train_test_split import numpy as np np.random.seed(123) sha256_train, sha256_holdout = t...
import random import gym from collections import OrderedDict from gym import error, spaces, utils from gym.utils import seeding import hashlib import os import numpy as np from gym_malware.envs.utils import interface, pefeatures from gym_malware.envs.controls import manipulate2 as manipulate ACTION_LOOKUP = {i: act f...
import random import gym from collections import OrderedDict from gym import error, spaces, utils from gym.utils import seeding import hashlib import os import numpy as np from gym_malware.envs.utils import interface, pefeatures from gym_malware.envs.controls import manipulate2 as manipulate ACTION_LOOKUP = {i: act f...
from gym_malware.envs.malware_env import MalwareEnv from gym_malware.envs.malware_score_env import MalwareScoreEnv from gym_malware.envs import utils
# TODO: # * modify exports using lief # * zero out rich header (if it exists) --> requires updating OptionalHeader's checksum ("Rich Header" only in Microsoft-produced executables) # * tinker with resources: https://lief.quarkslab.com/doc/tutorials/07_pe_resource.html import lief # pip install https://github.com/lief...
import requests import gzip import json import re import sys import os import glob module_path = os.path.dirname(os.path.abspath(sys.modules[__name__].__file__)) SAMPLE_PATH = os.path.join(module_path, 'samples') try: # for RESTful interface to remote model __private_data = json.load(open(os.path.join(module...
# -*- coding: utf-8 -*- ''' Extracts some basic features from PE files. Many of the features implemented have been used in previously published works. For more information, check out the following resources: * Schultz, et al., 2001: http://128.59.14.66/sites/default/files/binaryeval-ieeesp01.pdf * Kolter and Maloof, 2...
####################################################################################### # # InjectingMalwareIntoJPG.py (Injecting Malware Into JPG File) [ Main Program ] # © 2022 ABDULKADİR GÜNGÖR All Rights Reserved # Contact email address: abdulkadir_gungor@outlook.com # # Developper: Abdulkadir GÜNGÖR (abdulka...
####################################################################################### # # malware_v1.py (Malware v1) [ Main Program ] # © 2022 ABDULKADİR GÜNGÖR All Rights Reserved # Contact email address: abdulkadir_gungor@outlook.com # # Developper: Abdulkadir GÜNGÖR (abdulkadir_gungor@outlook.com) # Date: 05...
####################################################################################### # # malware_v2.py (Malware v2) [ Main Program ] # © 2022 ABDULKADİR GÜNGÖR All Rights Reserved # Contact email address: abdulkadir_gungor@outlook.com # # Developper: Abdulkadir GÜNGÖR (abdulkadir_gungor@outlook.com) # Date: 05...
####################################################################################### # # malware_v3.py (Malware v3) [ Main Program ] # © 2022 ABDULKADİR GÜNGÖR All Rights Reserved # Contact email address: abdulkadir_gungor@outlook.com # # Developper: Abdulkadir GÜNGÖR (abdulkadir_gungor@outlook.com) # Date: 05...
import sys import pickle newc=pickle.load(open('cmd3g.p')) nx={} c=0 for i in newc: if newc[i]>100: c+=1 nx[i]=newc[i] print c,len(nx) pickle.dump(nx,open('cutcmd3g.p','w'))
import sys import pickle newc=pickle.load(open('cmd3g.p')) nx={} c=0 for i in newc: if newc[i]>10000: c+=1 nx[i]=newc[i] print c,len(newc) pickle.dump(nx,open('cutcmd3g_for_4g.p','w'))
import sys import pickle newc=pickle.load(open('cmd4g.p')) nx={} c=0 for i in newc: if newc[i]>100: c+=1 nx[i]=newc[i] print c,len(newc) pickle.dump(nx,open('cutcmd4g.p','w'))
import heapq import pickle import math from csv import DictReader import glob import os import csv from datetime import datetime # generate dfs features and dll call features. #three different types: memory, constant, register # memory: dword, word, byte # constant: arg, var # register: eax ebx ecx edx esi edi esp eb...
import heapq import pickle import math from csv import DictReader import glob import os import csv from datetime import datetime # dll call features. # load file names def load_label(path, label): result = [] for row in DictReader(open(path)): if int(row['Class']) == label: result.append(...
import pandas as pd s1=pd.read_csv('model1.csv',index_col=0) s2=pd.read_csv('model2.csv',index_col=0) s3=pd.read_csv('model3.csv',index_col=0) for i in s1.columns.values: s1[i]=s1[i]**0.1*s2[i]**0.4*s3[i]*0.5 s1.to_csv('ensemble.csv')
import pandas as pd import sys import numpy as np def multiclass_log_loss(y_true, y_pred, eps=1e-15): """Multi class version of Logarithmic Loss metric. https://www.kaggle.com/wiki/MultiClassLogLoss Parameters ---------- y_true : array, shape = [n_samples] true class, intergers in [0, n...
import pickle cmd=pickle.load(open('newcmd.p')) newc={} for c in cmd: if '_' in c or c[0] in '?1234567890ABCDEF': continue else: #print c,cmd[c] newc[c]=cmd[c] print newc pickle.dump(newc,open('newc.p','w'))
import sys import pickle ########################################################## # usage # pypy findhead.py xid_train.p ../../data/train # xid_train.p is a list like ['loIP1tiwELF9YNZQjSUO',''....] to specify # the order of samples in traing data # ../../data/train is the path of original train data #############...
import sys import pickle ########################################################## # usage # pypy find_2g.py xid_train.p ../../data/train # xid_train.p is a list like ['loIP1tiwELF9YNZQjSUO',''....] to specify # the order of samples in traing data # ../../data/train is the path of original train data ##############...
import sys import pickle ########################################################## # usage # pypy find_3g.py xid_train.p ../../data/train # xid_train.p is a list like ['loIP1tiwELF9YNZQjSUO',''....] to specify # the order of samples in traing data # ../../data/train is the path of original train data ##############...
import sys import pickle ########################################################## # usage # pypy find_4g.py xid_train.p ../../data/train # xid_train.p is a list like ['loIP1tiwELF9YNZQjSUO',''....] to specify # the order of samples in traing data # ../../data/train is the path of original train data ##############...
import pickle import os import sys ########################################################## # usage # pypy find_new_ins.py xid_train.p ./ins_train ./jump_map_train # xid_train.p is a list like ['loIP1tiwELF9YNZQjSUO',''....] to specify # the order of samples in traing data # ./ins_train is where the local folder o...
# -*- coding: utf-8 -*- """ part of the code borrowed from the benchmark in the forum. create Frequency Features for 1 byte. So 16*16 features will add to train and test. """ from multiprocessing import Pool import os from csv import writer paths = ['train','test'] def consolidate(path): s_path = path Fil...
import subprocess asm_code_path='asm_code_' data_path='.' cmd='mkdir '+' '.join([asm_code_path+'train',asm_code_path+'test']) subprocess.call(cmd,shell=True) cmd='pypy writeasm.py xid_train.p '+' '.join([data_path+'/train',asm_code_path+'train']) subprocess.call(cmd,shell=True) cmd='pypy writeasm.py xid_test.p '+' '....
import subprocess data_path='.' opcode_path='op_train' jump_path='jump_train' jump_map_path='jump_map_train' cmd='mkdir '+' '.join([opcode_path,jump_path,jump_map_path]) subprocess.call(cmd,shell=True) cmd='pypy get_ins.py xid_train.p '+' '.join([data_path+'/train',opcode_path]) subprocess.call(cmd,shell=True) cmd='...
from sklearn.ensemble import RandomForestClassifier import pickle import sys import numpy as np X1=np.array(pickle.load(open('X2g_train.p'))) X2=np.array(pickle.load(open('X3g_train.p'))) X3=np.array(pickle.load(open('X4g_train.p'))) X4=np.array(pickle.load(open('Xhead_train.p'))) X=np.hstack((X2,X1,X3,X4)) y=np.arra...
import os xid=[i.split('.')[0] for i in os.listdir('train') if '.asm' in i] Xt_id=[i.split('.')[0] for i in os.listdir('test') if '.asm' in i] f=open('trainLabels.csv') f.readline() label={} for line in f: xx=line.split(',') idx=xx[0][1:-1] label[idx]=int(xx[-1]) f.close() y=[label[i] for i in xid] import p...
import pickle import sys ########################################################## # usage # pypy getins.py xid_train.p ../../data/train ./ins_train ./jump_train # xid_train.p is a list like ['loIP1tiwELF9YNZQjSUO',''....] to specify # the order of samples in traing data # ../../data/train is the path of original tra...
import pickle import sys xid=pickle.load(open(sys.argv[1])) #unconditional_jump=['jmp','j','ja'] ins_path=sys.argv[2] jump_path=sys.argv[3] for cc,i in enumerate(xid): jmp={} tmp=pickle.load(open(ins_path+'/'+i+'.ins.p')) for add in tmp: if tmp[add] == 'jmp' or tmp[add]=='ja': jmp[add]...
import pickle import sys ########################################################## # usage # pypy get_jump_map.py xid_train.p ../../data/train ./jump_train ./jump_map_train # xid_train.p is a list like ['loIP1tiwELF9YNZQjSUO',''....] to specify # the order of samples in traing data # ../../data/train is the path of ...
import numpy,scipy.misc, os, array def get_feature(data_set = 'train', data_type = 'bytes'): files=os.listdir(data_set) with open('%s_%s_image.csv'%(data_set, data_type),'wb') as f: f.write('Id,%s\n'%','.join(['%s_%i'%(data_type,x)for x in xrange(1000)])) for cc,x in enumerate(files): ...
# -*- coding: utf-8 -*- ## instructions frequency from multiprocessing import Pool import os import csv paths = ['train','test'] instr_set = set(['mov','xchg','stc','clc','cmc','std','cld','sti','cli','push', 'pushf','pusha','pop','popf','popa','cbw','cwd','cwde','in','out', 'add','adc','sub','sbb','div','idiv','m...
import heapq import pickle import math from csv import DictReader import glob import os import csv def join_ngrams(num = 100000): dict_all = dict() for c in range(1,10): #print "merging %i out of 9"%c heap = pickle.load(open('gram/ngram_%i_top%i'%(c,num),'rb')) while heap: c...
from sklearn.ensemble import RandomForestClassifier as RF from sklearn.linear_model import LogisticRegression as LGR from sklearn.ensemble import GradientBoostingClassifier as GBC from sklearn.ensemble import ExtraTreesClassifier as ET from xgboost_multi import XGBC from sklearn import cross_validation from sklearn.cro...
from sklearn.ensemble import RandomForestClassifier as RF from sklearn.linear_model import LogisticRegression as LGR from sklearn.ensemble import GradientBoostingClassifier as GBC from sklearn.ensemble import ExtraTreesClassifier as ET from xgboost_multi import XGBC from sklearn import cross_validation from sklearn.cro...
from sklearn.ensemble import RandomForestClassifier as RF from sklearn.linear_model import LogisticRegression as LGR from sklearn.ensemble import GradientBoostingClassifier as GBC from sklearn.ensemble import ExtraTreesClassifier as ET from xgboost_multi import XGBC from sklearn import cross_validation from sklearn.cro...
import sys import pickle ########################################################## # usage # pypy rebuild_2g.py xid_train.p ../../data/train # xid_train.p is a list like ['loIP1tiwELF9YNZQjSUO',''....] to specify # the order of samples in traing data # ../../data/train is the path of original train data ###########...
import os,array import pickle import numpy as np import sys xid=pickle.load(open(sys.argv[1])) asm_code_path=sys.argv[2] train_or_test=asm_code_path.split('_')[-1] X = np.zeros((len(xid),2000)) for cc,i in enumerate(xid): f=open(asm_code_path+'/'+i+'.asm') ln = os.path.getsize(asm_code_path+'/'+i+'.asm') # len...
from sklearn.ensemble import RandomForestClassifier as RF from sklearn.linear_model import LogisticRegression as LGR from sklearn.ensemble import GradientBoostingClassifier as GBC from sklearn.ensemble import ExtraTreesClassifier as ET from xgboost_multi import XGBC from sklearn import cross_validation from sklearn.cro...
from sklearn.ensemble import RandomForestClassifier as RF from xgboost_multi import XGBC from sklearn import cross_validation from sklearn.cross_validation import StratifiedKFold as KFold from sklearn.metrics import log_loss import numpy as np import pandas as pd import pickle # create model_list def get_model_list()...
from csv import DictReader from datetime import datetime import pickle import heapq import sys # load data def load_label(path, label): result = [] for row in DictReader(open(path)): if int(row['Class']) == label: result.append((row['Id'])) return result # generate grams dictionary fo...
import pickle import sys xid=pickle.load(open(sys.argv[1])) data_path=sys.argv[2] asm_code_path=sys.argv[3] for cc,i in enumerate(xid): f=open(data_path+'/'+i+'.asm') fo=open(asm_code_path+'/'+i+'.asm','w') start=True for line in f: xx=line.split() for c,x in enumerate(xx): ...
import inspect import os import sys code_path = os.path.join( os.path.split(inspect.getfile(inspect.currentframe()))[0], "xgboost-master/wrapper") sys.path.append(code_path) import xgboost as xgb import numpy as np class XGBC(object): def __init__(self, num_round = 2, max_depth = 2, eta= 1.0, min_child_weight = 2...
import sys import pickle newc=pickle.load(open('cmd3g.p')) nx={} c=0 for i in newc: if newc[i]>100: c+=1 nx[i]=newc[i] print c,len(nx) pickle.dump(nx,open('cutcmd3g.p','w'))
import sys import pickle newc=pickle.load(open('cmd3g.p')) nx={} c=0 for i in newc: if newc[i]>10000: c+=1 nx[i]=newc[i] print c,len(newc) pickle.dump(nx,open('cutcmd3g_for_4g.p','w'))
import sys import pickle newc=pickle.load(open('cmd4g.p')) nx={} c=0 for i in newc: if newc[i]>100: c+=1 nx[i]=newc[i] print c,len(newc) pickle.dump(nx,open('cutcmd4g.p','w'))
import heapq import pickle import math from csv import DictReader import glob import os import csv from datetime import datetime # generate dfs features and dll call features. #three different types: memory, constant, register # memory: dword, word, byte # constant: arg, var # register: eax ebx ecx edx esi edi esp eb...
import heapq import pickle import math from csv import DictReader import glob import os import csv from datetime import datetime # dll call features. # load file names def load_label(path, label): result = [] for row in DictReader(open(path)): if int(row['Class']) == label: result.append(...
import pandas as pd s1=pd.read_csv('model1.csv',index_col=0) s2=pd.read_csv('model2.csv',index_col=0) s3=pd.read_csv('model3.csv',index_col=0) for i in s1.columns.values: s1[i]=s1[i]**0.1*s2[i]**0.4*s3[i]*0.5 s1.to_csv('ensemble.csv')
import pandas as pd import sys import numpy as np def multiclass_log_loss(y_true, y_pred, eps=1e-15): """Multi class version of Logarithmic Loss metric. https://www.kaggle.com/wiki/MultiClassLogLoss Parameters ---------- y_true : array, shape = [n_samples] true class, intergers in [0, n...
import pickle cmd=pickle.load(open('newcmd.p')) newc={} for c in cmd: if '_' in c or c[0] in '?1234567890ABCDEF': continue else: #print c,cmd[c] newc[c]=cmd[c] print newc pickle.dump(newc,open('newc.p','w'))
import sys import pickle ########################################################## # usage # pypy findhead.py xid_train.p ../../data/train # xid_train.p is a list like ['loIP1tiwELF9YNZQjSUO',''....] to specify # the order of samples in traing data # ../../data/train is the path of original train data #############...
import sys import pickle ########################################################## # usage # pypy find_2g.py xid_train.p ../../data/train # xid_train.p is a list like ['loIP1tiwELF9YNZQjSUO',''....] to specify # the order of samples in traing data # ../../data/train is the path of original train data ##############...
import sys import pickle ########################################################## # usage # pypy find_3g.py xid_train.p ../../data/train # xid_train.p is a list like ['loIP1tiwELF9YNZQjSUO',''....] to specify # the order of samples in traing data # ../../data/train is the path of original train data ##############...
import sys import pickle ########################################################## # usage # pypy find_4g.py xid_train.p ../../data/train # xid_train.p is a list like ['loIP1tiwELF9YNZQjSUO',''....] to specify # the order of samples in traing data # ../../data/train is the path of original train data ##############...
import pickle import os import sys ########################################################## # usage # pypy find_new_ins.py xid_train.p ./ins_train ./jump_map_train # xid_train.p is a list like ['loIP1tiwELF9YNZQjSUO',''....] to specify # the order of samples in traing data # ./ins_train is where the local folder o...
# -*- coding: utf-8 -*- """ part of the code borrowed from the benchmark in the forum. create Frequency Features for 1 byte. So 16*16 features will add to train and test. """ from multiprocessing import Pool import os from csv import writer paths = ['train','test'] def consolidate(path): s_path = path Fil...
import subprocess asm_code_path='asm_code_' data_path='.' cmd='mkdir '+' '.join([asm_code_path+'train',asm_code_path+'test']) subprocess.call(cmd,shell=True) cmd='pypy writeasm.py xid_train.p '+' '.join([data_path+'/train',asm_code_path+'train']) subprocess.call(cmd,shell=True) cmd='pypy writeasm.py xid_test.p '+' '....