Skip to content

Commit

Permalink
add foreign lang comint analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
ggsmith842 committed Jan 12, 2024
1 parent 1b4e7b8 commit 1e9aa7f
Show file tree
Hide file tree
Showing 4 changed files with 327 additions and 0 deletions.
250 changes: 250 additions & 0 deletions Comint Analysis/comint_analysis.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,250 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"from deep_translator import GoogleTranslator"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>timestamp</th>\n",
" <th>sender</th>\n",
" <th>receiver</th>\n",
" <th>body</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>2024-01-12 11:24:32</td>\n",
" <td>darkhawk@h4ckm3.onion</td>\n",
" <td>shadowfox@crypt0n3t.onion</td>\n",
" <td>你找到那台服务器的后门了吗?</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>2024-01-14 11:28:47</td>\n",
" <td>shadowfox@crypt0n3t.onion</td>\n",
" <td>darkhawk@h4ckm3.onion</td>\n",
" <td>还没有,我还在分析代码。</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>2024-01-12 11:31:15</td>\n",
" <td>darkhawk@h4ckm3.onion</td>\n",
" <td>shadowfox@crypt0n3t.onion</td>\n",
" <td>试试社会工程学攻击?</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>2024-01-12 11:35:58</td>\n",
" <td>shadowfox@crypt0n3t.onion</td>\n",
" <td>darkhawk@h4ckm3.onion</td>\n",
" <td>好的,我会试试。</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>2024-01-12 11:38:21</td>\n",
" <td>ghostbyte@d33pweb.onion</td>\n",
" <td>darkhawk@h4ckm3.onion</td>\n",
" <td>那个新漏洞的利用工具你搞定了吗?</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" timestamp sender receiver \\\n",
"0 2024-01-12 11:24:32 darkhawk@h4ckm3.onion shadowfox@crypt0n3t.onion \n",
"1 2024-01-14 11:28:47 shadowfox@crypt0n3t.onion darkhawk@h4ckm3.onion \n",
"2 2024-01-12 11:31:15 darkhawk@h4ckm3.onion shadowfox@crypt0n3t.onion \n",
"3 2024-01-12 11:35:58 shadowfox@crypt0n3t.onion darkhawk@h4ckm3.onion \n",
"4 2024-01-12 11:38:21 ghostbyte@d33pweb.onion darkhawk@h4ckm3.onion \n",
"\n",
" body \n",
"0 你找到那台服务器的后门了吗? \n",
"1 还没有,我还在分析代码。 \n",
"2 试试社会工程学攻击? \n",
"3 好的,我会试试。 \n",
"4 那个新漏洞的利用工具你搞定了吗? "
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data = pd.read_json(\"transcripts.json\")\n",
"data.head()"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {},
"outputs": [],
"source": [
"data['en_translation'] = data.body.apply(\n",
" lambda message: GoogleTranslator(source=\"auto\", target=\"en\").translate(message)\n",
")\n",
"\n",
"#handle errors\n",
"data.loc[data.en_translation == '', 'en_translation'] = 'Error in translating message. Manual review is required.'"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>body</th>\n",
" <th>en_translation</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>你找到那台服务器的后门了吗?</td>\n",
" <td>Did you find the backdoor to that server?</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>还没有,我还在分析代码。</td>\n",
" <td>Not yet, I'm still analyzing the code.</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>试试社会工程学攻击?</td>\n",
" <td>Try a social engineering attack?</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>好的,我会试试。</td>\n",
" <td>OK, I'll try it.</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>那个新漏洞的利用工具你搞定了吗?</td>\n",
" <td>Have you got the tool to exploit the new vulne...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>还没,我遇到了一些问题。</td>\n",
" <td>Not yet, I'm having some problems.</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>需要帮忙吗?</td>\n",
" <td>Do you need help?</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>好的,谢谢。</td>\n",
" <td>OK, thanks.</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" body en_translation\n",
"0 你找到那台服务器的后门了吗? Did you find the backdoor to that server?\n",
"1 还没有,我还在分析代码。 Not yet, I'm still analyzing the code.\n",
"2 试试社会工程学攻击? Try a social engineering attack?\n",
"3 好的,我会试试。 OK, I'll try it.\n",
"4 那个新漏洞的利用工具你搞定了吗? Have you got the tool to exploit the new vulne...\n",
"5 还没,我遇到了一些问题。 Not yet, I'm having some problems.\n",
"6 需要帮忙吗? Do you need help?\n",
"7 好的,谢谢。 OK, thanks."
]
},
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data[['body',\"en_translation\"]]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "venv",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
18 changes: 18 additions & 0 deletions Comint Analysis/csv_to_json_util.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import json
import csv

def csv_to_json(csv_file_path, json_file_path):

with open(csv_file_path, 'r', encoding="utf-8") as csvf:

#load csv file data using csv lib
csvReader = csv.DictReader(csvf)

json_array = [row for row in csvReader]


with open(json_file_path, "w", encoding="utf-8") as jsonf:
jsonString = json.dumps(json_array, ensure_ascii=False,indent=4)
jsonf.write(jsonString)

csv_to_json("./transcripts.csv", "./transcripts.json")
9 changes: 9 additions & 0 deletions Comint Analysis/transcripts.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
timestamp,sender,receiver,body
2024-01-12 11:24:32,darkhawk@h4ckm3.onion,shadowfox@crypt0n3t.onion,你找到那台服务器的后门了吗?
2024-01-14 11:28:47,shadowfox@crypt0n3t.onion,darkhawk@h4ckm3.onion,还没有,我还在分析代码。
2024-01-12 11:31:15,darkhawk@h4ckm3.onion,shadowfox@crypt0n3t.onion,试试社会工程学攻击?
2024-01-12 11:35:58,shadowfox@crypt0n3t.onion,darkhawk@h4ckm3.onion,好的,我会试试。
2024-01-12 11:38:21,ghostbyte@d33pweb.onion,darkhawk@h4ckm3.onion,那个新漏洞的利用工具你搞定了吗?
2024-01-12 11:42:46,darkhawk@h4ckm3.onion,ghostbyte@d33pweb.onion,还没,我遇到了一些问题。
2024-01-12 11:45:33,ghostbyte@d33pweb.onion,darkhawk@h4ckm3.onion,需要帮忙吗?
2024-01-12 11:49:17,darkhawk@h4ckm3.onion,ghostbyte@d33pweb.onion,好的,谢谢。
50 changes: 50 additions & 0 deletions Comint Analysis/transcripts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[
{
"timestamp": "2024-01-12 11:24:32",
"sender": "darkhawk@h4ckm3.onion",
"receiver": "shadowfox@crypt0n3t.onion",
"body": "你找到那台服务器的后门了吗?"
},
{
"timestamp": "2024-01-14 11:28:47",
"sender": "shadowfox@crypt0n3t.onion",
"receiver": "darkhawk@h4ckm3.onion",
"body": "还没有,我还在分析代码。"
},
{
"timestamp": "2024-01-12 11:31:15",
"sender": "darkhawk@h4ckm3.onion",
"receiver": "shadowfox@crypt0n3t.onion",
"body": "试试社会工程学攻击?"
},
{
"timestamp": "2024-01-12 11:35:58",
"sender": "shadowfox@crypt0n3t.onion",
"receiver": "darkhawk@h4ckm3.onion",
"body": "好的,我会试试。"
},
{
"timestamp": "2024-01-12 11:38:21",
"sender": "ghostbyte@d33pweb.onion",
"receiver": "darkhawk@h4ckm3.onion",
"body": "那个新漏洞的利用工具你搞定了吗?"
},
{
"timestamp": "2024-01-12 11:42:46",
"sender": "darkhawk@h4ckm3.onion",
"receiver": "ghostbyte@d33pweb.onion",
"body": "还没,我遇到了一些问题。"
},
{
"timestamp": "2024-01-12 11:45:33",
"sender": "ghostbyte@d33pweb.onion",
"receiver": "darkhawk@h4ckm3.onion",
"body": "需要帮忙吗?"
},
{
"timestamp": "2024-01-12 11:49:17",
"sender": "darkhawk@h4ckm3.onion",
"receiver": "ghostbyte@d33pweb.onion",
"body": "好的,谢谢。"
}
]

0 comments on commit 1e9aa7f

Please sign in to comment.