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
// Do reverse dns lookup for list of ipv4 concurrently. | |
func (bs *BotSpecifier) ReverseDNSLookup(ctx context.Context, ipv4s []string) error { | |
bs.Logger.WithFields(logrus.Fields{ | |
"package": "specifier", | |
"function": "ReverseDNSLookup", | |
}).Debugf("Start Reverse DNS Lookup about %d ipv4s.", len(ipv4s)) | |
for _, ipv4 := range ipv4s { | |
bs.WaitGroup.Add(1) | |
go func(ipv4 string) { | |
defer bs.WaitGroup.Done() |
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
🌞 Morning 151 commits █████▎░░░░░░░░░░░░░░░ 25.4% | |
🌆 Daytime 243 commits ████████▌░░░░░░░░░░░░ 40.8% | |
🌃 Evening 150 commits █████▎░░░░░░░░░░░░░░░ 25.2% | |
🌙 Night 51 commits █▊░░░░░░░░░░░░░░░░░░░ 8.6% |
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
schema = 'important_schema' | |
tbl_name = f'important_table' | |
tmp_tbl = f'{tbl_name}_TMP' | |
old_tbl = f'{tbl_name}_OLD' | |
try: | |
engine.execute(f'TRUNCATE TABLE {tmp_tbl}') # Make sure tmp table is empty | |
pandas_dataframe.to_sql(tmp_tbl, engine, schema, if_exists='append', index=False) | |
engine.execute(f'RENAME TABLE {tbl_name} TO {old_tbl}, {tmp_tbl} TO {tbl_name}, {old_tbl} TO {tmp_tbl}') | |
engine.execute(f'TRUNCATE TABLE {tmp_tbl}') | |
except Exception as e: |
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
package repository | |
import ( | |
"fmt" | |
"math/rand" | |
"testing" | |
"github.com/DATA-DOG/go-sqlmock" | |
) |
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
class BlackIPv4Servicer(biv4_pb2_grpc.BlackIPv4ServiceServicer): | |
def __init__(self): | |
self.cnxpool = repository.get_connection_pool() | |
def GetReputationByIPv4(self, request, context): | |
try: | |
cnx = self.cnxpool.get_connection() | |
reputation = repository.get_reputation_by_ipv4(cnx, request) | |
return reputation | |
except Exception as e: |
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
func (r *BlackIPv4Repository) GetReputationByIPv4(c context.Context, rr *model.ReputationRequest) (reputation *pb.Reputation, err error) { | |
cli := pb.NewBlackIPv4ServiceClient(r.ClientConn) | |
l := r.Logger | |
reputation, err = cli.GetReputationByIPv4( | |
c, | |
&pb.ReputationRequest{ | |
StartDate: rr.StartDate, Ipv4: rr.IPv4, Descending: rr.Descending, Limit: rr.Limit, Language: rr.Language, | |
}, | |
) | |
if err != nil { |
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
syntax = "proto3"; | |
package black_ipv4; | |
service BlackIPv4Service { | |
rpc GetReputationByIPv4(ReputationRequest) returns (Reputation); | |
} | |
message AttackVector { | |
uint32 vulnerability_scan = 1; |
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
attack_purposes = ['Vulnerability Scan', 'Falsifying Websites', 'Interrupting Server', 'Spreading Malware', 'Identity Theft', 'Monetary Loss'] | |
r_len = len(ipv4_list) | |
c_len = len(attack_purposes) | |
attack_purposes_map = np.zeros((r_len, c_len)) | |
before = None | |
start = True | |
row_idx = 0 | |
for tup, detected_count in grp_attack_purpose.items(): | |
ipv4 = tup[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
No | Vulnerability Scan | Falsifying Websites | Interrupting Server | Spreading Malware | Identity Theft | Monetary Loss | |
---|---|---|---|---|---|---|---|
0 | 0 | 0 | 0 | 0 | 1 | 0 | |
1 | 0 | 0 | 1 | 0 | 0 | 0 | |
2 | 0 | 0 | 0 | 1 | 1 | 0 | |
3 | 0 | 1 | 1 | 0 | 1 | 0 | |
4 | 0 | 0 | 8 | 0 | 9 | 0 | |
5 | 0 | 20 | 0 | 1 | 30 | 0 | |
6 | 0 | 190 | 0 | 7 | 18 | 0 | |
7 | 0 | 0 | 1 | 5 | 50 | 0 | |
8 | 0 | 0 | 0 | 1 | 1 | 100 |
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
# 각 공격목적에 해당하는 리스트를 생성합니다. | |
vulnerability_scan_vector = list() | |
falsifying_websites_vector = list() | |
# ... | |
# 위에서 생성한 공격 목적별 리스트에 다음과 같이 값을 삽입해줍니다. | |
# 공격 목적이 없는것에 대해서는 0을 추가해준다. | |
for idx in range(len(ipv4_list)): | |
ipv4 = ipv4_list[idx] | |
for attack_purpose, detected_cnt in grp_attack_purpose[ipv4].items(): |
NewerOlder