From 3b28e47efe18f71d43f8dca6ac25463ae5ca92a6 Mon Sep 17 00:00:00 2001 From: Giga <52905881+giga-a@users.noreply.github.com> Date: Thu, 16 Sep 2021 14:31:42 -0700 Subject: [PATCH] [auto-b] Added finding ages option (req) - ref 38d56f839602 --- app.js | 37 +++++++++++++++++----------- modules/string-analysis.js | 50 +++++++++++++++++++++++++++++++++++++- public/app.html | 48 +++++++++++++++++++++++++++++------- 3 files changed, 111 insertions(+), 24 deletions(-) diff --git a/app.js b/app.js index ddd7896..4756237 100755 --- a/app.js +++ b/app.js @@ -258,6 +258,7 @@ app.post('/analyze_string', async function (req, res, next) { unknown: [], maybe: [] } + let ages = [] let names_origins = [] const words_info = [] const temp_words = [] @@ -421,6 +422,12 @@ app.post('/analyze_string', async function (req, res, next) { await stringAnalysis.find_numbers(req, all_words) helper.log_to_file_queue(req.body.uuid, '[Done] Finding Numbers') } + if (req.body.option.includes('FindAges')) { + helper.log_to_file_queue(req.body.uuid, '[Starting] Finding Ages') + ages = await stringAnalysis.guess_age_from_string(req) + helper.log_to_file_queue(req.body.uuid, '[Done] Finding Ages') + } + req.body.string = req.body.string.toLowerCase() if (req.body.option.includes('ConvertNumbers')) { @@ -491,26 +498,28 @@ app.post('/analyze_string', async function (req, res, next) { helper.log_to_file_queue(req.body.uuid, '[Finished] Analyzing: ' + req.body.string + ' Task: ' + req.body.uuid) /*fs.writeFileSync('./test.json', JSON.stringify({ - username: username, - uuid: temp_uuid, - info, - table: all_words, - common: temp_words, - words_info: words_info, - user_info_normal: user_info_normal, - user_info_advanced: user_info_advanced, - user_info_special: user_info_special, - names_origins: names_origins, - custom_search: custom_search, - graph: graph, - stats: stats_default, - logs: logs + username: username, + uuid: temp_uuid, + info, + ages: ages, + table: all_words, + common: temp_words, + words_info: words_info, + user_info_normal: user_info_normal, + user_info_advanced: user_info_advanced, + user_info_special: user_info_special, + names_origins: names_origins, + custom_search: custom_search, + graph: graph, + stats: stats_default, + logs: logs }, null, 2) , 'utf-8');*/ res.json({ username: username, uuid: temp_uuid, info, + ages: ages, table: all_words, common: temp_words, words_info: words_info, diff --git a/modules/string-analysis.js b/modules/string-analysis.js index 600eef7..a6f62bd 100755 --- a/modules/string-analysis.js +++ b/modules/string-analysis.js @@ -225,6 +225,53 @@ async function get_maybe_words (req, all_words) { }).filter(word => word.length > 1) } +async function guess_age_from_string(req) { + let results = [] + + try { + let age_4_numbers = /\d{4}|\d{2}/g + let current_year = new Date().getFullYear() + while ((match = age_4_numbers.exec(req.body.string)) != null) { + let temp_dict = {"found":"","year":"","age":""} + let found = 0 + let year = 0 + let age = 0 + temp_dict.found = match[0] + found = parseInt(match[0]) + if (found >= 50 && found <= 99){ + year = found + 1900 + age = current_year - year + if (age <= 75){ + temp_dict.year = year.toString() + temp_dict.age = age.toString() + } + } + if (found >= 14 && found <= 49){ + year = current_year - found + age = found + if (age <= 75){ + temp_dict.year = year.toString() + temp_dict.age = age.toString() + } + } + if (found >= 1950){ + year = found + age = current_year - year + if (age <= 75){ + temp_dict.year = year.toString() + temp_dict.age = age.toString() + } + } + + results.push(temp_dict) + } + + } catch (err) { + } + + return results +} + module.exports = { get_maybe_words, find_symbols, @@ -235,5 +282,6 @@ module.exports = { split_alphabet_case, most_common, find_other, - analyze_string + analyze_string, + guess_age_from_string } diff --git a/public/app.html b/public/app.html index d1034fb..9fb9f6a 100755 --- a/public/app.html +++ b/public/app.html @@ -261,6 +261,7 @@ #words-info-section, #stats-section, #metadata-section, + #ages-section, #custom-search-section, #names-origins-section { display: none; @@ -805,6 +806,21 @@
+
+
+
Extracted combinations
+
+
+
+
+
+
+
Extracted Profile\Person age (Maybe)
+
+
+
+
+
Extracted words information
@@ -821,13 +837,6 @@
-
-
-
Possible words for combinations
-
-
-
-
Save Report
@@ -1003,6 +1012,12 @@ name: 'Find numbers in names or words before analyzing', disable: false, }, + { + group: 'Other options', + value: 'FindAges', + name: 'Find age in names or words before analyzing', + disable: false, + }, { group: 'Other options', value: 'FindSymbols', @@ -1199,6 +1214,8 @@ $('#stats-section').hide(); $('#metadata-table').html(''); $('#metadata-section').hide(); + $('#ages-table').html(''); + $('#ages-section').hide(); clearInterval(interval_logs); } @@ -1467,8 +1484,8 @@ $('#stats-tables').last().append(`${temp_tr}
[${status_key} profiles] ${type_key}Percentage
`); } }); + $('#stats-section').show(); } - $('#stats-section').show(); } if(typeof data.stats[type_key] === "object" && Array.isArray(data.stats[type_key])){ temp_tr = ''; @@ -1484,6 +1501,19 @@ } }); + if(data.ages.length > 0){ + temp_tr = ''; + data.ages.forEach((item) => { + temp_tr += `${item.found}${item.year}${item.age}`; + }); + + if (temp_tr.length > 0) { + $('#ages-table').last().append(`${temp_tr}
FoundYearAge
`); + } + + $('#ages-section').show(); + } + if (data.logs.length > 0) { $('#logs-pre').html(`
${data.logs}
`); $('#logs-section').show(); @@ -1625,7 +1655,7 @@ e.preventDefault(); $('#analyzed-options')[0].selectize.clear(); $('#analyzed-options')[0].selectize.setValue(['WordInfo', 'MostCommon', 'FindOrigins', 'LookUps', 'CustomSearch', 'FindUserProfilesFast,GetUserProfilesFast', 'ExtractMetadata', 'ExtractPatterns', 'NetworkGraph', 'FindNumbers', - 'CategoriesStats','MetadataStats', + 'CategoriesStats','MetadataStats','FindAges', 'FindSymbols', 'SplitWordsByAlphabet', 'SplitWordsByUpperCase', ]); });