move legacy code to separate branch

This commit is contained in:
Marco Realacci 2025-01-17 21:07:54 +01:00
parent 68a30c8ee6
commit ac8e143b89
3401 changed files with 0 additions and 36722 deletions

View file

@ -1,90 +0,0 @@
using Newtonsoft.Json;
using Telegram.Bot;
using Telegram.Bot.Types;
using Telegram.Bot.Types.ReplyMarkups;
namespace SoUnBot.AccessControl
{
public class AccessManager
{
private string _acl_path;
private Dictionary<long, HashSet<string>> _acl;
public long AdminId { get; private set; }
public AccessManager(string aclPath, long adminId)
{
_acl_path = aclPath;
AdminId = adminId;
if (!System.IO.File.Exists(aclPath + "/acl.json"))
{
_acl = new Dictionary<long, HashSet<string>>();
return;
}
var json = System.IO.File.ReadAllText(aclPath + "/acl.json");
_acl = JsonConvert.DeserializeObject<Dictionary<long, HashSet<string>>>(json) ?? new Dictionary<long, HashSet<string>>();;
}
public long[] Users()
{
return _acl.Keys.ToArray();
}
private void SaveToJson()
{
var json = JsonConvert.SerializeObject(_acl);
System.IO.File.WriteAllText(_acl_path + "/acl.json", json);
}
public void GrantPermission(long uid, string perm)
{
if (_acl.ContainsKey(uid)) _acl[uid].Add(perm);
else _acl.Add(uid, new HashSet<string> { perm });
SaveToJson();
}
public bool RevokePermission(long uid, string perm)
{
if (_acl.ContainsKey(uid)) _acl[uid].Remove(perm);
else return false;
SaveToJson();
return true;
}
public bool CheckPermission(long uid, string perm)
{
return _acl.ContainsKey(uid) ? _acl[uid].Contains(perm) : false;
}
public bool CheckPermission(User user, string perm, ITelegramBotClient client)
{
var uid = user.Id;
var hasPerm = _acl.ContainsKey(uid) ? _acl[uid].Contains(perm) : false;
if (hasPerm) return true;
client.SendTextMessageAsync(
chatId: uid,
text: $"ACM\nNon hai l'accesso a `{ perm }`. Puoi richiederlo ad un amministratore usando il pulsante qui sotto",
replyMarkup: new InlineKeyboardMarkup(InlineKeyboardButton.WithCallbackData("🔆 Richiedi accesso"))
);
return false;
}
public void AskPermission(User user, string perm, ITelegramBotClient client)
{
/*InlineKeyboardButton[][] ik = new InlineKeyboardButton[][]
{
new InlineKeyboardButton[]
{
new InlineKeyboardButton("✅ Grant")
},
new InlineKeyboardButton[]
{
new InlineKeyboardButton("❌ Deny")
}
};*/
client.SendTextMessageAsync(
chatId: AdminId,
text: $"ACM: { user.Id }\nL'utente { user.FirstName } { user.LastName } @{ user.Username }\nHa richiesto l'accesso a: { perm }",
replyMarkup: new InlineKeyboardMarkup(InlineKeyboardButton.WithCallbackData("✅ Grant"))
);
}
}
}

View file

@ -1,12 +0,0 @@
using Telegram.Bot;
using Telegram.Bot.Types;
namespace SoUnBot.ModuleLoader
{
public interface IModule
{
public string Cmd();
public string GetName();
public void ProcessUpdate(ITelegramBotClient botClient, Update update, CancellationToken cancellationToken);
}
}

View file

@ -1,18 +0,0 @@
namespace SoUnBot.ModuleLoader
{
public class ModuleLoader
{
public Dictionary<string, IModule> Modules { get; private set; }
public ModuleLoader()
{
Modules = new Dictionary<string, IModule>();
}
public void LoadModule(IModule module)
{
if (Modules == null) Modules = new Dictionary<string, IModule>();
Modules.Add(module.Cmd(), module);
}
}
}

View file

@ -1,565 +0,0 @@
using System.Collections;
using Newtonsoft.Json;
using SoUnBot.AccessControl;
using SoUnBot.ModuleLoader;
using Telegram.Bot;
using Telegram.Bot.Types;
using Telegram.Bot.Types.Enums;
using Telegram.Bot.Types.InputFiles;
using Telegram.Bot.Types.ReplyMarkups;
using File = System.IO.File;
namespace SoUnBot.Modules.OttoLinux
{
public class BotGame : IModule
{
private AccessManager _accessManager;
private List<Question> _questions;
private string _questionsPath;
private string _name;
private bool _lock;
private string _imgBaseDir;
private Dictionary<long, OttoScore> _scores;
private Dictionary<long, Question> _playingQuestions;
private Dictionary<long, List<int>> _playedQuestions;
private Dictionary<Question, OttoScore> _questionStats;
private static Random _rng = new Random();
public BotGame(AccessManager accessManager, string name, string path, bool locke, string imgBaseDir, int version = 1)
{
_accessManager = accessManager;
_questionsPath = path;
_name = name;
_lock = locke;
_imgBaseDir = imgBaseDir;
_questions = new List<Question>();
_scores = new Dictionary<long, OttoScore>();
_playingQuestions = new Dictionary<long, Question>();
_questionStats = new Dictionary<Question, OttoScore>();
_playedQuestions = new Dictionary<long, List<int>>();
if (version == 2) LoadQuestionsV2();
else if (version == 3) LoadQuestionsJSON();
else LoadQuestions();
}
public BotGame(AccessManager accessManager)
{
_accessManager = accessManager;
_questions = new List<Question>();
_scores = new Dictionary<long, OttoScore>();
_playingQuestions = new Dictionary<long, Question>();
_questionStats = new Dictionary<Question, OttoScore>();
_playedQuestions = new Dictionary<long, List<int>>();
LoadQuestions();
}
private void LoadQuestions()
{
var lines = System.IO.File.ReadAllLines(_questionsPath);
Question cur = null;
var preEmpty = true;
foreach (var line in lines)
{
if (line.Equals("")) preEmpty = true;
else preEmpty = false;
if (line.StartsWith(">")) cur.AddAnswer(line.Substring(2), false);
else if (line.StartsWith("v")) cur.AddAnswer(line.Substring(2), true);
else
{
if (!preEmpty && cur != null)
{
cur.Append("\n" + line);
continue;
}
if (cur != null) _questions.Add(cur);
cur = new Question(line);
}
}
_questions.Add(cur);
SanitizeQuestions();
}
private void LoadQuestionsV2()
{
var questions = System.IO.Directory.GetFileSystemEntries(_questionsPath);
foreach (var questPath in questions)
{
var quest = System.IO.File.ReadAllText(questPath + "/quest.txt");
if (quest.StartsWith("img=")) quest = quest.Insert(quest.IndexOf("\n") + 1, questPath.Split(new char[] { '/', '\\' }).Last() + ". ");
else quest = questPath.Split(new char[] { '/', '\\' }).Last() + ". " + quest;
Question cur = new Question(quest);
var shuffledAnsPaths = Directory.GetFiles(questPath).OrderBy(a => _rng.Next()).ToArray();
foreach (var ansPath in shuffledAnsPaths)
{
if (ansPath.EndsWith("quest.txt")) continue;
if (ansPath.EndsWith(".png")) continue;
var ans = System.IO.File.ReadAllText(ansPath);
if (ansPath.EndsWith("correct.txt")) cur.AddAnswer(ans, true);
else cur.AddAnswer(ans, false);
}
_questions.Add(cur);
}
SanitizeQuestions();
}
private void LoadQuestionsJSON()
{
var json = System.IO.File.ReadAllText(_questionsPath);
var quests = JsonConvert.DeserializeObject<Question[]>(json);
if (quests != null) _questions = quests.ToList();
}
private void SanitizeQuestions()
{
var invalidQuestions = new List<Question>();
foreach (var qst in _questions)
{
while (qst.Quest.StartsWith("\n")) qst.Quest = qst.Quest.Substring(1);
for (int i = 0; i < qst.Answers.Count; i++)
{
while (qst.Answers[i].StartsWith("\n")) qst.Answers[i] = qst.Answers[i].Substring(1);
}
if (qst.Quest == "")
{
invalidQuestions.Add(qst);
Console.WriteLine("an empty question was found, skipping it");
}
else if(qst.Answers.Count == 0)
{
invalidQuestions.Add(qst);
Console.WriteLine($"The following question: {qst.Quest} \nhas no answers, skipping it");
}
}
_questions = _questions.Except(invalidQuestions).ToList();
}
public Question PickRandomQuestion(long player, ITelegramBotClient botClient)
{
//WebRequest w = WebRequest.Create($"https://www.random.org/integers/?num=1&min=1&max={_questions.Count - 1 }&col=1&base=10&format=plain&rnd=new");
//w.Method = "GET";
//var number = int.Parse(new StreamReader(w.GetResponse().GetResponseStream()).ReadToEnd());
var number = _rng.Next(0, _questions.Count - 1);
while (_questions[number].Quest == "")
{
number = _rng.Next(0, _questions.Count - 1);
}
if (!_playedQuestions.ContainsKey(player)) _playedQuestions.Add(player, new List<int>());
if (_playedQuestions[player].Count >= _questions.Count)
{
_playedQuestions[player].Clear();
botClient.SendTextMessageAsync(
chatId: player,
text: $"🥳🥳🥳 Congratulazioni! Hai risposto a tutte le {_questions.Count} domande!"
);
}
while (_playedQuestions[player].Contains(number))
{
if (number < _questions.Count - 1) number++;
else number = 0;
}
_playedQuestions[player].Add(number);
return _questions[number];
}
public string Cmd()
{
return GetName();
}
async void IModule.ProcessUpdate(ITelegramBotClient botClient, Update update, CancellationToken cancellationToken)
{
var uid = update.Message.From.Id;
if (_lock)
{
if (!_accessManager.CheckPermission(update.Message.From, Cmd(), botClient)) return;
}
else
{
if (!_accessManager.CheckPermission(uid, Cmd()))
{
_accessManager.GrantPermission(uid, Cmd());
await botClient.SendTextMessageAsync(
chatId: _accessManager.AdminId,
text: $"ACM: { update.Message.From.Id }\nL'utente { update.Message.From.FirstName } { update.Message.From.LastName } @{ update.Message.From.Username }\nHa iniziato a usare il bot."
);
}
}
//if (!scores.Keys.Contains(uid))
//{
// await botClient.SendTextMessageAsync(
// chatId: _acm.AdminId,
// text: $"ACM: { update.Message.From.Id }\nL'utente { update.Message.From.FirstName } { update.Message.From.LastName } @{ update.Message.From.Username }\nHa iniziato a usare il bot."
// );
//}
if (update.Type != UpdateType.Message)
return;
if (update.Message!.Type != MessageType.Text)
return;
if (update.Message.Text.StartsWith("/qsc"))
{
int number = 1;
if (update.Message.Text.Length > 4) int.TryParse(update.Message.Text.Substring(5), out number);
var mostCorrect = _questionStats.GroupBy(e => e.Value.Correct).ToDictionary(e => e.Key, t => t.Select(r => r.Key).ToArray());
var c = 0;
foreach (var item in mostCorrect.Keys.OrderByDescending(i => i))
{
if (c == number) break;
var msg = mostCorrect[item].Select(q => q.Quest.Substring(0, 30)).Aggregate((a, b) => a + "\n\n" + b);
await botClient.SendTextMessageAsync(
chatId: uid,
text: $"✅ Risposte indovinate {item} volte:\n{msg}");
c++;
}
return;
}
if (update.Message.Text.StartsWith("/qsw"))
{
int number = 1;
if (update.Message.Text.Length > 4) int.TryParse(update.Message.Text.Substring(5), out number);
var mostWrong = _questionStats.GroupBy(e => e.Value.Wrong).ToDictionary(e => e.Key, t => t.Select(r => r.Key).ToArray());
var c = 0;
foreach (var item in mostWrong.Keys.OrderByDescending(i => i))
{
if (c == number) break;
var msg = mostWrong[item].Select(q => q.Quest.Substring(0, 30)).Aggregate((a, b) => a + "\n\n" + b);
await botClient.SendTextMessageAsync(
chatId: uid,
text: $"❌ Risposte sbagliate {item} volte:\n{msg}");
c++;
}
return;
}
if (update.Message.Text.StartsWith("/qsb"))
{
int number = 1;
if (update.Message.Text.Length > 4) int.TryParse(update.Message.Text.Substring(5), out number);
var mostBlank = _questionStats.GroupBy(e => e.Value.Blank).ToDictionary(e => e.Key, t => t.Select(r => r.Key).ToArray());
var c = 0;
foreach (var item in mostBlank.Keys.OrderByDescending(i => i))
{
if (c == number) break;
var msg = mostBlank[item].Select(q => q.Quest.Substring(0, 30)).Aggregate((a, b) => a + "\n\n" + b);
await botClient.SendTextMessageAsync(
chatId: uid,
text: $"🟡 Risposte non date {item} volte:\n{msg}");
c++;
}
return;
}
if (update.Message.Text.Equals("/rsp"))
{
if (!_playedQuestions.ContainsKey(uid))
{
await botClient.SendTextMessageAsync(
chatId: uid,
text: "❌ Non c'è niente da eliminare!");
return;
}
_playedQuestions[uid].Clear();
await botClient.SendTextMessageAsync(
chatId: uid,
text: "✅ Memoria eliminata!");
return;
}
if ((!_playingQuestions.ContainsKey(uid)) || update.Message.Text == GetName().ToLower() || update.Message.Text == "/" + GetName().ToLower() || update.Message.Text == "/reset" || update.Message.Text == "/restart")
{
if (_scores.ContainsKey(update.Message.From.Id)) _scores[update.Message.From.Id] = new OttoScore();
else _scores.Add(update.Message.From.Id, new OttoScore());
SendRandomQuestion(update.Message.From.Id, botClient, cancellationToken);
return;
}
var cur = _playingQuestions[uid];
var wrongMsg = "🟡 La risposta corretta era la " + (cur.Correct + 1) + " ☹️";
if (update.Message.Text == "n" || update.Message.Text == "Passa")
{
_scores[uid].Blank += 1;
_questionStats[cur].Blank += 1;
await botClient.SendTextMessageAsync(
chatId: uid,
text: wrongMsg
);
SendRandomQuestion(uid, botClient, cancellationToken);
return;
}
//todo try parse
var pick = -1;
if (!int.TryParse(update.Message.Text, out pick))
{
await botClient.SendTextMessageAsync(
chatId: uid,
text: "❓ scusa, non ho capito 😭");
await botClient.SendTextMessageAsync(
chatId: uid,
text: "⭕️ per uscire da 8linux, scrivi /leave");
return;
}
pick -= 1;
if (pick == _playingQuestions[uid].Correct)
{
await botClient.SendTextMessageAsync(
chatId: uid,
text: "✅ Risposta esatta!");
_scores[uid].Correct += 1;
_questionStats[cur].Correct += 1;
}
else
{
await botClient.SendTextMessageAsync(
chatId: uid,
text: "❌ Risposta errata!");
await botClient.SendTextMessageAsync(
chatId: uid,
text: wrongMsg);
_scores[uid].Wrong += 1;
_questionStats[cur].Wrong += 1;
}
SendStats(uid, botClient, cancellationToken);
await Task.Delay(400);
SendRandomQuestion(uid, botClient, cancellationToken);
}
private async void SendRandomQuestion(long uid, ITelegramBotClient botClient, CancellationToken cancellationToken)
{
var qst = PickRandomQuestion(uid, botClient);
try
{
if (qst.Quest.Length <= 40)
{
Console.WriteLine("Sto inviando la domanda " + qst.Quest + " a " + uid);
}
else
{
Console.WriteLine("Sto inviando la domanda " + qst.Quest.Substring(0, 40) + " a " + uid);
}
}
catch(Exception e)
{
botClient.SendTextMessageAsync(
chatId: _accessManager.AdminId,
text: $"Question is malformed -> {qst.Quest} \n {e.Message}"
);
return;
}
if (!_questionStats.ContainsKey(qst)) _questionStats.Add(qst, new OttoScore());
if (_playingQuestions.ContainsKey(uid)) _playingQuestions[uid] = qst;
else _playingQuestions.Add(uid, qst);
string answers = "";
List<KeyboardButton> kbs = new List<KeyboardButton>();
bool splitAns = false;
foreach (var ans in qst.Answers)
if ((ans.Contains("\n") && ans.Substring(ans.IndexOf("\n")).Length > 1 ) || ans.Contains("img=")) splitAns = true;
var corry = qst.Answers[qst.Correct];
for (int i = 0; i < qst.Answers.Count; i++)
{
if (!splitAns) answers += (i + 1) + ". " + qst.Answers[i] + "\n\n";
kbs.Add((i + 1).ToString());
}
KeyboardButton[] fr = kbs.ToArray();
ReplyKeyboardMarkup replyKeyboardMarkup = new(new[]
{
fr,
new KeyboardButton[] { "Passa" },
})
{
ResizeKeyboard = true
};
string quest = qst.Quest;
if (!string.IsNullOrEmpty(qst.Image))
{
try
{
if (qst.Image.Contains("http"))
{
await botClient.SendPhotoAsync(
chatId: uid,
photo: qst.Image);
}
else
{
await botClient.SendPhotoAsync(
chatId: uid,
photo: File.OpenRead(_imgBaseDir + "/" + qst.Image));
}
}
catch(Exception e)
{
CatchParsingError(botClient, quest, uid, e);
}
}
if (qst.Quest.StartsWith("img="))
{
try
{
if (qst.Image.Contains("http"))
{
await botClient.SendPhotoAsync(
chatId: uid,
photo: quest.Substring(4).Split('\n')[0]);
}
else
{
await botClient.SendPhotoAsync(
chatId: uid,
photo: File.OpenRead(_imgBaseDir + "/" + quest.Substring(4).Split('\n')[0]));
}
}
catch(Exception e)
{
CatchParsingError(botClient, quest, uid, e);
}
quest = quest.Substring(quest.IndexOf('\n') + 1);
}
try
{
Message sentMessage = await botClient.SendTextMessageAsync(
chatId: uid,
text: "📎 " + PrepareHtml(quest) + "\n\n" + PrepareHtml(answers),
replyMarkup: replyKeyboardMarkup,
parseMode: ParseMode.Html
);
}
catch (Exception e) { CatchParsingError(botClient, quest, uid, e); }
if (splitAns)
{
for (int i = 0; i < qst.Answers.Count; i++)
{
await Task.Delay(350);
if (qst.Answers[i].StartsWith("img="))
{
try
{
if (qst.Image.Contains("http"))
{
await botClient.SendPhotoAsync(
chatId: uid,
photo: qst.Answers[i].Split('\n')[0].Substring(4));
}
else
{
await botClient.SendPhotoAsync(
chatId: uid,
photo: File.OpenRead(_imgBaseDir + "/" + qst.Answers[i].Split('\n')[0].Substring(4)));
}
}
catch(Exception e)
{
CatchParsingError(botClient, "[R] " + qst.Answers[i].Substring(0, 20) + " -> " + quest, uid, e);
}
}
else
{
Message sentMessage = await botClient.SendTextMessageAsync(
chatId: uid,
text: "✏️ Risposta " + PrepareHtml((i + 1) + ":\n" + qst.Answers[i]),
replyMarkup: replyKeyboardMarkup,
parseMode: ParseMode.Html
);
}
}
}
}
private async void CatchParsingError(ITelegramBotClient botClient, string quest, long uid, Exception e)
{
await botClient.SendTextMessageAsync(
chatId: uid,
text: "❌ Cercavo di inviarti una domanda ma si è verificato un errore anomalo nel parsing. Per favore, invia /restart per resettarmi.\nL'errore verrà automaticamente segnalato (visto che tecnologia avanzatissima?)"
);
await botClient.SendTextMessageAsync(
chatId: uid,
text: $"❌ La domanda {quest.Substring(0, 60)} è rotta.\nSi è verificato {e.Message}"
);
}
private static string PrepareHtml(string s)
{
return s.Replace("<", "&lt;")
.Replace(">", "&gt;")
.Replace("&lt;code&gt;", "<code>")
.Replace("&lt;/code&gt;", "</code>")
.Replace("&lt;pre&gt;", "<pre>")
.Replace("&lt;/pre&gt;", "</pre>")
.Replace("&lt;b&gt;", "<b>")
.Replace("&lt;/b&gt;", "</b>");
}
private async void SendStats(long uid, ITelegramBotClient botClient, CancellationToken cancellationToken)
{
var stats = _scores[uid];
var total = stats.Correct + stats.Wrong + stats.Blank;
await botClient.SendTextMessageAsync(
chatId: uid,
text: stats.Correct + " corrette (" + ((float)stats.Correct / (float)total) * 100f + "%)\n" + stats.Wrong + " errate (" + ((float)stats.Wrong / (float)total) * 100f + "%)\n" + stats.Blank + " non date (" + ((float)stats.Blank / (float)total) * 100f + "%)\n");
}
public string GetName()
{
return _name;
}
public List<Question> GetQuestions()
{
return _questions;
}
}
}

View file

@ -1,197 +0,0 @@
// This feature is not maintained anymore
// it has been commented as it depends on the old project structure
/** using HomeBot.ACL;
using HomeBot.ModuleLoader;
using System.Net;
using Telegram.Bot;
using Telegram.Bot.Types;
using Telegram.Bot.Types.Enums;
using Telegram.Bot.Types.ReplyMarkups;
namespace HomeBot.Modules.OttoLinux
{
public class OttoReverse : IModule
{
private List<Question> _questions;
private string NAME = "8reverse";
private bool LOCK = false;
public OttoReverse(string name, List<Question> questions, bool lck)
{
_questions = questions;
LOCK = lck;
NAME = name;
Thread thread = new Thread(() => new WebReverse(GetMatch));
thread.Start();
}
public string Cmd()
{
return GetName();
}
public List<Question> GetMatch(string qst)
{
var m = qst
.Replace("\n", "")
.Replace("\r", "")
.Replace("<pre>", "")
.Replace("<code>", "")
.Replace("</pre>", "")
.Replace("</code>", "")
.Replace("'", "")
.Replace("à", "a")
.Replace("è", "e")
.Replace("é", "e")
.Replace("ì", "i")
.Replace("ò", "o")
.Replace("ù", "u")
.Replace(" ", "")
.Replace(" ", "")
.ToLower();
var filtered = _questions.FindAll((Question q) =>
{
return q.Quest
.Replace("\n", "")
.Replace("\r", "")
.Replace("<pre>", "")
.Replace("<code>", "")
.Replace("</pre>", "")
.Replace("</code>", "")
.Replace("'", "")
.Replace("à", "a")
.Replace("è", "e")
.Replace("é", "e")
.Replace("ì", "i")
.Replace("ò", "o")
.Replace("ù", "u")
.Replace(" ", "")
.Replace(" ", "")
.ToLower()
.Contains(m);
});
return filtered;
}
async void IModule.ProcessUpdate(ITelegramBotClient botClient, Update update, CancellationToken cancellationToken)
{
var uid = update.Message.Chat.Id;
if (LOCK)
{
if (!ACM.CheckPermission(update.Message.From, Cmd(), botClient)) return;
}
else
{
if (!ACM.CheckPermission(uid, Cmd()))
{
ACM.GrantPermission(uid, Cmd());
await botClient.SendTextMessageAsync(
chatId: _acm.AdminId,
text: $"ACM: {update.Message.From.Id}\nL'utente {update.Message.From.FirstName} {update.Message.From.LastName} @{update.Message.From.Username}\nHa iniziato a usare il bot."
);
}
}
if (update.Type != UpdateType.Message)
return;
if (update.Message!.Type != MessageType.Text)
return;
if (update.Message.Text.Equals("/" + NAME))
{
await botClient.SendTextMessageAsync(
chatId: uid,
text: $"🤫 Hai appena scoperto una funzione nascosta! 🤐🥶"
);
return;
}
var m = update.Message.Text
.Replace("\n", "")
.Replace("\r", "")
.Replace("<pre>", "")
.Replace("<code>", "")
.Replace("</pre>", "")
.Replace("</code>", "")
.Replace("'", "")
.Replace("à", "a")
.Replace("è", "e")
.Replace("é", "e")
.Replace("ì", "i")
.Replace("ò", "o")
.Replace("ù", "u")
.Replace(" ", "")
.Replace(" ", "")
.ToLower();
if (string.IsNullOrEmpty(m)) return;
var filtered = _questions.FindAll((Question q) =>
{
return q.Quest
.Replace("\n", "")
.Replace("\r", "")
.Replace("<pre>", "")
.Replace("<code>", "")
.Replace("</pre>", "")
.Replace("</code>", "")
.Replace("'", "")
.Replace("à", "a")
.Replace("è", "e")
.Replace("é", "e")
.Replace("ì", "i")
.Replace("ò", "o")
.Replace("ù", "u")
.Replace(" ", "")
.Replace(" ", "")
.ToLower()
.Contains(m);
});
if (!filtered.Any())
await botClient.SendTextMessageAsync(
chatId: uid,
text: $"❌ No match :("
);
else
await botClient.SendTextMessageAsync(
chatId: uid,
text: $"✅ Found {filtered.Count} matches!"
);
foreach (var q in filtered)
{
await botClient.SendTextMessageAsync(
chatId: uid,
text: $"❓ Possible match:\n\n{q.Quest}"
);
await Task.Delay(250);
await botClient.SendTextMessageAsync(
chatId: uid,
text: $"✅ Correct answare for the match:\n\n{q.Answers[q.Correct]}"
);
await Task.Delay(500);
}
}
public string GetName()
{
return NAME;
}
public void ProcessUpdate(ITelegramBotClient botClient, global::Telegram.Bot.Types.Update update, CancellationToken cancellationToken)
{
throw new NotImplementedException();
}
public List<Question> GetQuestions()
{
return _questions;
}
}
} **/

View file

@ -1,16 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SoUnBot.Modules.OttoLinux
{
public class OttoScore
{
public int Score { get; set; }
public int Correct { get; set; }
public int Wrong { get; set; }
public int Blank { get; set; }
}
}

View file

@ -1,66 +0,0 @@
// This feature is not maintained anymore
// it was exposing a webserver returning a json with all the questions and answers.
// It was originally intended for a web version of the bot, but was never completed.
using System.Net;
namespace SoUnBot.Modules.OttoLinux
{
public class PhotoServer
{
public PhotoServer(string baseDir)
{
using var listener = new HttpListener();
listener.Prefixes.Add("http://+:8001/");
listener.Start();
Console.WriteLine("PhotoServer is listening on port 8001...");
while (true)
{
HttpListenerContext ctx = listener.GetContext();
using HttpListenerResponse resp = ctx.Response;
resp.StatusCode = (int)HttpStatusCode.OK;
resp.StatusDescription = "Status OK";
resp.AddHeader("Access-Control-Allow-Origin", "*");
resp.AddHeader("Access-Control-Allow-Headers", "*");
resp.AddHeader("Access-Control-Allow-Methods", "GET");
if (ctx.Request.Url == null)
{
resp.StatusCode = (int)HttpStatusCode.BadRequest;
continue;
}
if (!File.Exists(baseDir + "/" + ctx.Request.Url.AbsolutePath))
{
resp.StatusCode = (int)HttpStatusCode.NotFound;
continue;
}
if (ctx.Request.Url.AbsolutePath.EndsWith("png"))
{
resp.AddHeader("Content-Type", "image/png");
}
else if (ctx.Request.Url.AbsolutePath.EndsWith("jpg"))
{
resp.AddHeader("Content-Type", "image/jpeg");
}
else
{
resp.StatusCode = (int)HttpStatusCode.BadRequest;
continue;
}
byte[] buffer = File.ReadAllBytes(baseDir + "/" + ctx.Request.Url.AbsolutePath);
resp.ContentLength64 = buffer.Length;
using Stream ros = resp.OutputStream;
try
{
ros.Write(buffer, 0, buffer.Length);
} catch { }
}
}
}
}

View file

@ -1,39 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace SoUnBot.Modules.OttoLinux
{
public class Question
{
[JsonProperty("quest")]
public String Quest { get; set; }
[JsonProperty("answers")]
public List<string> Answers { get; }
[JsonProperty("correct")]
public int Correct { get; private set; }
[JsonProperty("image")]
public string Image { get; private set; }
public Question(String quest)
{
Quest = quest;
Answers = new List<string>();
Correct = 0;
}
public void AddAnswer(String answer, bool correct)
{
Answers.Add(answer);
Correct = correct ? Answers.Count - 1 : Correct;
}
public void Append(String quest)
{
Quest += quest;
}
}
}

View file

@ -1,57 +0,0 @@
// This feature is not maintained anymore
// it was exposing a webserver returning a json with all the questions and answers.
// It was originally intended for a web version of the bot, but was never completed.
/**using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using Newtonsoft.Json;
namespace SoUnBot.Modules.OttoLinux
{
internal class WebReverse
{
public WebReverse(Func<string, List<Question>> match)
{
using var listener = new HttpListener();
listener.Prefixes.Add("http://+:8001/");
listener.Start();
Console.WriteLine("Listening on port 8001...");
string pre = "";
while (true)
{
HttpListenerContext ctx = listener.GetContext();
using HttpListenerResponse resp = ctx.Response;
resp.StatusCode = (int)HttpStatusCode.OK;
resp.StatusDescription = "Status OK";
resp.AddHeader("Access-Control-Allow-Origin", "*");
resp.AddHeader("Access-Control-Allow-Headers", "*");
resp.AddHeader("Access-Control-Allow-Methods", "POST");
resp.AddHeader("Content-Type", "application/json");
var body = new StreamReader(ctx.Request.InputStream).ReadToEnd();
//if (body.Equals("")) body = pre;
pre = body;
string data = JsonConvert.SerializeObject(match(pre));
byte[] buffer = Encoding.UTF8.GetBytes(data);
resp.ContentLength64 = buffer.Length;
using Stream ros = resp.OutputStream;
try
{
ros.Write(buffer, 0, buffer.Length);
} catch { }
}
}
}
}
**/

View file

@ -1,60 +0,0 @@
using SoUnBot.AccessControl;
using SoUnBot.ModuleLoader;
using SoUnBot.Modules.OttoLinux;
using SoUnBot.Telegram;
string dataPath = Environment.GetEnvironmentVariable("DATA_PATH") ?? "BotData";
string aclPath = Environment.GetEnvironmentVariable("ACL_PATH") ?? "BotData/ACL";
string tgToken = Environment.GetEnvironmentVariable("TELEGRAM_TOKEN") ?? "this-string-is-not-a-token";
string tgAdminId = Environment.GetEnvironmentVariable("TELEGRAM_ADMIN_ID") ?? "000000";
string imagesPath = dataPath + "/Images";
Console.WriteLine("Welcome to SO un bot!");
long tgAdminLong;
if (!long.TryParse(tgAdminId, out tgAdminLong))
{
Console.WriteLine("Telegram Admin ID is invalid or unset");
return;
}
var acl = new AccessManager(aclPath, tgAdminLong);
var moduleLoader = new ModuleLoader();
try
{
foreach (string f in Directory.GetFiles(dataPath + "/Questions"))
{
if (f.EndsWith("txt"))
{
Console.WriteLine("Loading module " + Path.GetFileNameWithoutExtension(f));
moduleLoader.LoadModule(new BotGame(acl, Path.GetFileNameWithoutExtension(f), f, false, imagesPath));
}
else if (f.EndsWith("json"))
{
Console.WriteLine("Loading module " + Path.GetFileNameWithoutExtension(f));
moduleLoader.LoadModule(new BotGame(acl, Path.GetFileNameWithoutExtension(f), f, false, imagesPath, 3));
}
else
{
Console.WriteLine("Skipping " + Path.GetFileName(f) + " as the file extension is not supported");
}
}
foreach (string d in Directory.GetDirectories(dataPath + "/Questions"))
{
Console.WriteLine("Loading module " + Path.GetFileName(d));
moduleLoader.LoadModule(new BotGame(acl, Path.GetFileName(d), d, false, imagesPath, 2));
}
}
catch (System.Exception ex)
{
Console.WriteLine("There was an issue loading the module: " + ex.Message);
return;
}
Console.WriteLine("Starting Telegram bot listener...");
new TelegramBot(tgToken, acl, dataPath + "/motd.txt", moduleLoader.Modules);
// worst way ever to keep the main thread running, I know
while (true)
Thread.Sleep(10000);

View file

@ -1,16 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Telegram.Bot" Version="17.0.0" />
<PackageReference Include="Telegram.Bot.Extensions.Polling" Version="1.0.0" />
</ItemGroup>
</Project>

View file

@ -1,199 +0,0 @@
using SoUnBot.AccessControl;
using SoUnBot.ModuleLoader;
using Telegram.Bot;
using Telegram.Bot.Exceptions;
using Telegram.Bot.Extensions.Polling;
using Telegram.Bot.Types;
using Telegram.Bot.Types.Enums;
using Telegram.Bot.Types.ReplyMarkups;
namespace SoUnBot.Telegram
{
internal class TelegramBot
{
private AccessManager _accessManager;
private string _moth_path;
private Dictionary<string, IModule> _modules;
public TelegramBotClient BotClient { get; private set; }
private Dictionary<long, IModule> _usersContext;
public TelegramBot(string token, AccessManager accessManager, string motd_path, Dictionary<string, IModule> modules)
{
_accessManager = accessManager;
_moth_path = motd_path;
_modules = modules;
_usersContext = new Dictionary<long, IModule>();
BotClient = new TelegramBotClient(token);
using var cts = new CancellationTokenSource();
// StartReceiving does not block the caller thread. Receiving is done on the ThreadPool.
var receiverOptions = new ReceiverOptions
{
AllowedUpdates = { } // receive all update types
};
BotClient.StartReceiving(
HandleUpdateAsync,
HandleErrorAsync,
receiverOptions,
cancellationToken: cts.Token);
GetMe();
}
private async void GetMe()
{
var me = await BotClient.GetMeAsync();
Console.WriteLine($"Start listening for @{me.Username}");
}
async Task HandleUpdateAsync(ITelegramBotClient botClient, Update update, CancellationToken cancellationToken)
{
try
{
long chatId;
if (update.Type == UpdateType.CallbackQuery)
{
chatId = update.CallbackQuery.From.Id;
if (update.CallbackQuery.Message.Text.StartsWith("ACM: ") && update.CallbackQuery.Data.Contains("Grant"))
{
long uid = int.Parse(update.CallbackQuery.Message.Text.Substring(5).Split('\n')[0]);
string perm = update.CallbackQuery.Message.Text.Split("Ha richiesto l'accesso a: ")[1];
_accessManager.GrantPermission(uid, perm);
await botClient.AnswerCallbackQueryAsync(
update.CallbackQuery.Id,
"Successo!"
);
await botClient.SendTextMessageAsync(
uid,
"✅ Congratulazioni! Hai ottenuto l'accesso a: " + perm
);
return;
}
if (update.CallbackQuery.Message.Text.StartsWith("ACM") && update.CallbackQuery.Data.Contains("🔆 Richiedi accesso"))
{
string perm = update.CallbackQuery.Message.Text.Split('`')[1];
_accessManager.AskPermission(update.CallbackQuery.From, perm, botClient);
await botClient.AnswerCallbackQueryAsync(
update.CallbackQuery.Id,
"Richiesta effettuata"
);
await botClient.EditMessageTextAsync(
update.CallbackQuery.From.Id,
update.CallbackQuery.Message.MessageId,
update.CallbackQuery.Message.Text,
replyMarkup: new InlineKeyboardMarkup(InlineKeyboardButton.WithCallbackData("Richiesto 〽️"))
);
return;
}
if (update.CallbackQuery.Message.Text.StartsWith("ACM")) {
return;
}
}
if (update.Type != UpdateType.Message) // this is temp
return;
if (update.Message!.Type != MessageType.Text)
return;
chatId = update.Message.Chat.Id;
if (update.Type == UpdateType.Message && update.Message!.Type == MessageType.Text && update.Message.Text.StartsWith("/spam"))
{
if (!_accessManager.CheckPermission(update.Message.From, "global.spam", botClient)) return;
await botClient.SendTextMessageAsync(
chatId: chatId,
text: "Invio annuncio in corso...");
new Thread(() =>
{
Thread.CurrentThread.IsBackground = true;
SendToEveryone(botClient, chatId, update.Message.Text.Substring(6));
}).Start();
return;
}
if (update.Type == UpdateType.Message && update.Message!.Type == MessageType.Text && update.Message.Text == "/leave")
{
_usersContext.Remove(chatId);
}
if (_usersContext.ContainsKey(chatId))
{
_usersContext[chatId].ProcessUpdate(botClient, update, cancellationToken);
return;
}
if (update.Type == UpdateType.Message && update.Message!.Type == MessageType.Text)
{
var msg = update.Message.Text.StartsWith("/") ? update.Message.Text.Substring(1) : update.Message.Text;
if (_modules.ContainsKey(msg))
{
_usersContext.Add(chatId, _modules[msg]);
_modules[msg].ProcessUpdate(botClient, update, cancellationToken);
return;
}
}
string validModules = _modules.Keys.Select(i => "/" + i).Aggregate((a, b) => a + "\n" + b);
var motd = System.IO.File.ReadAllText(_moth_path);
// Echo received message text
Message sentMessage = await botClient.SendTextMessageAsync(
chatId: chatId,
text: motd);
}
catch(Exception e)
{
Console.WriteLine("Error handling the update: " + e.Message);
}
}
async Task HandleErrorAsync(ITelegramBotClient botClient, Exception exception, CancellationToken cancellationToken)
{
if (exception is ApiRequestException apiRequestException)
{
await botClient.SendTextMessageAsync(_accessManager.AdminId, apiRequestException.ToString());
}
// Restart the bot (otherwise it would become an amoeba)
using var cts = new CancellationTokenSource();
var receiverOptions = new ReceiverOptions
{
AllowedUpdates = { }
};
BotClient.StartReceiving(
HandleUpdateAsync,
HandleErrorAsync,
receiverOptions,
cancellationToken: cts.Token);
}
private async void SendToEveryone(ITelegramBotClient botClient, long chatId, string text)
{
foreach (long user in _accessManager.Users())
{
try
{
Console.WriteLine("Sto spammando a" + user.ToString());
await botClient.SendTextMessageAsync(
chatId: user,
text: text
);
await Task.Delay(100);
}
catch
{
Console.WriteLine("Ho fallito");
}
}
await botClient.SendTextMessageAsync(
chatId: chatId,
text: "✅ Annunciato a tutti!");
}
}
}

Binary file not shown.

View file

@ -1,104 +0,0 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v8.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v8.0": {
"SoUnBot/1.0.0": {
"dependencies": {
"Newtonsoft.Json": "13.0.1",
"Telegram.Bot": "17.0.0",
"Telegram.Bot.Extensions.Polling": "1.0.0"
},
"runtime": {
"SoUnBot.dll": {}
}
},
"JetBrains.Annotations/2021.3.0": {
"runtime": {
"lib/netstandard2.0/JetBrains.Annotations.dll": {
"assemblyVersion": "2021.3.0.0",
"fileVersion": "2021.3.0.0"
}
}
},
"Newtonsoft.Json/13.0.1": {
"runtime": {
"lib/netstandard2.0/Newtonsoft.Json.dll": {
"assemblyVersion": "13.0.0.0",
"fileVersion": "13.0.1.25517"
}
}
},
"System.Threading.Channels/6.0.0": {},
"Telegram.Bot/17.0.0": {
"dependencies": {
"Newtonsoft.Json": "13.0.1"
},
"runtime": {
"lib/netcoreapp3.1/Telegram.Bot.dll": {
"assemblyVersion": "17.0.0.0",
"fileVersion": "17.0.0.0"
}
}
},
"Telegram.Bot.Extensions.Polling/1.0.0": {
"dependencies": {
"JetBrains.Annotations": "2021.3.0",
"System.Threading.Channels": "6.0.0",
"Telegram.Bot": "17.0.0"
},
"runtime": {
"lib/netcoreapp3.1/Telegram.Bot.Extensions.Polling.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.0.0.0"
}
}
}
}
},
"libraries": {
"SoUnBot/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"JetBrains.Annotations/2021.3.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-Ddxjs5RRjf+c8m9m++WvhW1lz1bqNhsTjWvCLbQN9bvKbkJeR9MhtfNwKgBRRdG2yLHcXFr5Lf7fsvvkiPaDRg==",
"path": "jetbrains.annotations/2021.3.0",
"hashPath": "jetbrains.annotations.2021.3.0.nupkg.sha512"
},
"Newtonsoft.Json/13.0.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A==",
"path": "newtonsoft.json/13.0.1",
"hashPath": "newtonsoft.json.13.0.1.nupkg.sha512"
},
"System.Threading.Channels/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-TY8/9+tI0mNaUMgntOxxaq2ndTkdXqLSxvPmas7XEqOlv9lQtB7wLjYGd756lOaO7Dvb5r/WXhluM+0Xe87v5Q==",
"path": "system.threading.channels/6.0.0",
"hashPath": "system.threading.channels.6.0.0.nupkg.sha512"
},
"Telegram.Bot/17.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-YvQ9lqEt1bTafu6BJPTbYWDHxyHP+TK8PtjTjNV/6VQw3XxVcZnGwYkJ1CdYW3lJHmHjYxzhBlhhOGNtqJ3U7g==",
"path": "telegram.bot/17.0.0",
"hashPath": "telegram.bot.17.0.0.nupkg.sha512"
},
"Telegram.Bot.Extensions.Polling/1.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-OsUbHdHIMmldevoRYzArh5uJDVs1fzlpj+T3mddeP/ELhhhHLmcjon0ZEypgf1KFEj6QWbuZHkijauIW1LZlqg==",
"path": "telegram.bot.extensions.polling/1.0.0",
"hashPath": "telegram.bot.extensions.polling.1.0.0.nupkg.sha512"
}
}
}

View file

@ -1,12 +0,0 @@
{
"runtimeOptions": {
"tfm": "net8.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "8.0.0"
},
"configProperties": {
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}

View file

@ -1,4 +0,0 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]

View file

@ -1,22 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("SoUnBot")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+72f6cd30d09e169dfba57519c055fbf65c07a93c")]
[assembly: System.Reflection.AssemblyProductAttribute("SoUnBot")]
[assembly: System.Reflection.AssemblyTitleAttribute("SoUnBot")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generato dalla classe WriteCodeFragment di MSBuild.

View file

@ -1 +0,0 @@
3680e5812d66c6777eb08b0e2862f4230324a1c5273b0801b0700e9dd5595131

View file

@ -1,13 +0,0 @@
is_global = true
build_property.TargetFramework = net8.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = SoUnBot
build_property.ProjectDir = /home/marco/RiderProjects/so-un-bot/Bot/
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =

View file

@ -1,8 +0,0 @@
// <auto-generated/>
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Threading;
global using global::System.Threading.Tasks;

View file

@ -1 +0,0 @@
982238a87ff881b98e1723d06960a74addf8ab5fd20a247d9811e87171da4117

View file

@ -1,21 +0,0 @@
/home/marco/RiderProjects/so-un-bot/Bot/bin/Debug/net8.0/SoUnBot
/home/marco/RiderProjects/so-un-bot/Bot/bin/Debug/net8.0/SoUnBot.deps.json
/home/marco/RiderProjects/so-un-bot/Bot/bin/Debug/net8.0/SoUnBot.runtimeconfig.json
/home/marco/RiderProjects/so-un-bot/Bot/bin/Debug/net8.0/SoUnBot.dll
/home/marco/RiderProjects/so-un-bot/Bot/bin/Debug/net8.0/SoUnBot.pdb
/home/marco/RiderProjects/so-un-bot/Bot/bin/Debug/net8.0/JetBrains.Annotations.dll
/home/marco/RiderProjects/so-un-bot/Bot/bin/Debug/net8.0/Newtonsoft.Json.dll
/home/marco/RiderProjects/so-un-bot/Bot/bin/Debug/net8.0/Telegram.Bot.dll
/home/marco/RiderProjects/so-un-bot/Bot/bin/Debug/net8.0/Telegram.Bot.Extensions.Polling.dll
/home/marco/RiderProjects/so-un-bot/Bot/obj/Debug/net8.0/SoUnBot.csproj.AssemblyReference.cache
/home/marco/RiderProjects/so-un-bot/Bot/obj/Debug/net8.0/SoUnBot.GeneratedMSBuildEditorConfig.editorconfig
/home/marco/RiderProjects/so-un-bot/Bot/obj/Debug/net8.0/SoUnBot.AssemblyInfoInputs.cache
/home/marco/RiderProjects/so-un-bot/Bot/obj/Debug/net8.0/SoUnBot.AssemblyInfo.cs
/home/marco/RiderProjects/so-un-bot/Bot/obj/Debug/net8.0/SoUnBot.csproj.CoreCompileInputs.cache
/home/marco/RiderProjects/so-un-bot/Bot/obj/Debug/net8.0/SoUnBot.sourcelink.json
/home/marco/RiderProjects/so-un-bot/Bot/obj/Debug/net8.0/SoUnBot.csproj.CopyComplete
/home/marco/RiderProjects/so-un-bot/Bot/obj/Debug/net8.0/SoUnBot.dll
/home/marco/RiderProjects/so-un-bot/Bot/obj/Debug/net8.0/refint/SoUnBot.dll
/home/marco/RiderProjects/so-un-bot/Bot/obj/Debug/net8.0/SoUnBot.pdb
/home/marco/RiderProjects/so-un-bot/Bot/obj/Debug/net8.0/SoUnBot.genruntimeconfig.cache
/home/marco/RiderProjects/so-un-bot/Bot/obj/Debug/net8.0/ref/SoUnBot.dll

View file

@ -1 +0,0 @@
7855311d295825590d1f2d744602bb1f5d081ad75841f435f06048bdf5846452

View file

@ -1 +0,0 @@
{"documents":{"/home/marco/RiderProjects/so-un-bot/*":"https://raw.githubusercontent.com/appinfosapienza/so-un-bot/72f6cd30d09e169dfba57519c055fbf65c07a93c/*"}}

Binary file not shown.

View file

@ -1,81 +0,0 @@
{
"format": 1,
"restore": {
"/home/marco/RiderProjects/so-un-bot/Bot/SoUnBot.csproj": {}
},
"projects": {
"/home/marco/RiderProjects/so-un-bot/Bot/SoUnBot.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/home/marco/RiderProjects/so-un-bot/Bot/SoUnBot.csproj",
"projectName": "SoUnBot",
"projectPath": "/home/marco/RiderProjects/so-un-bot/Bot/SoUnBot.csproj",
"packagesPath": "/home/marco/.nuget/packages/",
"outputPath": "/home/marco/RiderProjects/so-un-bot/Bot/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/home/marco/.nuget/NuGet/NuGet.Config"
],
"originalTargetFrameworks": [
"net8.0"
],
"sources": {
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net8.0": {
"targetAlias": "net8.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"net8.0": {
"targetAlias": "net8.0",
"dependencies": {
"Newtonsoft.Json": {
"target": "Package",
"version": "[13.0.1, )"
},
"Telegram.Bot": {
"target": "Package",
"version": "[17.0.0, )"
},
"Telegram.Bot.Extensions.Polling": {
"target": "Package",
"version": "[1.0.0, )"
}
},
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"downloadDependencies": [
{
"name": "Microsoft.AspNetCore.App.Ref",
"version": "[8.0.3, 8.0.3]"
}
],
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/8.0.103/PortableRuntimeIdentifierGraph.json"
}
}
}
}
}

View file

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/home/marco/.nuget/packages/</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/home/marco/.nuget/packages/</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.9.1</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="/home/marco/.nuget/packages/" />
</ItemGroup>
</Project>

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />

View file

@ -1,280 +0,0 @@
{
"version": 3,
"targets": {
"net8.0": {
"JetBrains.Annotations/2021.3.0": {
"type": "package",
"compile": {
"lib/netstandard2.0/JetBrains.Annotations.dll": {
"related": ".deps.json;.xml"
}
},
"runtime": {
"lib/netstandard2.0/JetBrains.Annotations.dll": {
"related": ".deps.json;.xml"
}
}
},
"Newtonsoft.Json/13.0.1": {
"type": "package",
"compile": {
"lib/netstandard2.0/Newtonsoft.Json.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/netstandard2.0/Newtonsoft.Json.dll": {
"related": ".xml"
}
}
},
"System.Threading.Channels/6.0.0": {
"type": "package",
"compile": {
"lib/net6.0/System.Threading.Channels.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/net6.0/System.Threading.Channels.dll": {
"related": ".xml"
}
},
"build": {
"buildTransitive/netcoreapp3.1/_._": {}
}
},
"Telegram.Bot/17.0.0": {
"type": "package",
"dependencies": {
"Newtonsoft.Json": "12.0.2"
},
"compile": {
"lib/netcoreapp3.1/Telegram.Bot.dll": {
"related": ".pdb;.xml"
}
},
"runtime": {
"lib/netcoreapp3.1/Telegram.Bot.dll": {
"related": ".pdb;.xml"
}
}
},
"Telegram.Bot.Extensions.Polling/1.0.0": {
"type": "package",
"dependencies": {
"JetBrains.Annotations": "2021.3.0",
"System.Threading.Channels": "6.0.0",
"Telegram.Bot": "17.0.0"
},
"compile": {
"lib/netcoreapp3.1/Telegram.Bot.Extensions.Polling.dll": {
"related": ".pdb;.xml"
}
},
"runtime": {
"lib/netcoreapp3.1/Telegram.Bot.Extensions.Polling.dll": {
"related": ".pdb;.xml"
}
}
}
}
},
"libraries": {
"JetBrains.Annotations/2021.3.0": {
"sha512": "Ddxjs5RRjf+c8m9m++WvhW1lz1bqNhsTjWvCLbQN9bvKbkJeR9MhtfNwKgBRRdG2yLHcXFr5Lf7fsvvkiPaDRg==",
"type": "package",
"path": "jetbrains.annotations/2021.3.0",
"files": [
".nupkg.metadata",
".signature.p7s",
"icon.png",
"jetbrains.annotations.2021.3.0.nupkg.sha512",
"jetbrains.annotations.nuspec",
"lib/net20/JetBrains.Annotations.dll",
"lib/net20/JetBrains.Annotations.xml",
"lib/netstandard1.0/JetBrains.Annotations.deps.json",
"lib/netstandard1.0/JetBrains.Annotations.dll",
"lib/netstandard1.0/JetBrains.Annotations.xml",
"lib/netstandard2.0/JetBrains.Annotations.deps.json",
"lib/netstandard2.0/JetBrains.Annotations.dll",
"lib/netstandard2.0/JetBrains.Annotations.xml",
"lib/portable40-net40+sl5+win8+wp8+wpa81/JetBrains.Annotations.dll",
"lib/portable40-net40+sl5+win8+wp8+wpa81/JetBrains.Annotations.xml"
]
},
"Newtonsoft.Json/13.0.1": {
"sha512": "ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A==",
"type": "package",
"path": "newtonsoft.json/13.0.1",
"files": [
".nupkg.metadata",
".signature.p7s",
"LICENSE.md",
"lib/net20/Newtonsoft.Json.dll",
"lib/net20/Newtonsoft.Json.xml",
"lib/net35/Newtonsoft.Json.dll",
"lib/net35/Newtonsoft.Json.xml",
"lib/net40/Newtonsoft.Json.dll",
"lib/net40/Newtonsoft.Json.xml",
"lib/net45/Newtonsoft.Json.dll",
"lib/net45/Newtonsoft.Json.xml",
"lib/netstandard1.0/Newtonsoft.Json.dll",
"lib/netstandard1.0/Newtonsoft.Json.xml",
"lib/netstandard1.3/Newtonsoft.Json.dll",
"lib/netstandard1.3/Newtonsoft.Json.xml",
"lib/netstandard2.0/Newtonsoft.Json.dll",
"lib/netstandard2.0/Newtonsoft.Json.xml",
"newtonsoft.json.13.0.1.nupkg.sha512",
"newtonsoft.json.nuspec",
"packageIcon.png"
]
},
"System.Threading.Channels/6.0.0": {
"sha512": "TY8/9+tI0mNaUMgntOxxaq2ndTkdXqLSxvPmas7XEqOlv9lQtB7wLjYGd756lOaO7Dvb5r/WXhluM+0Xe87v5Q==",
"type": "package",
"path": "system.threading.channels/6.0.0",
"files": [
".nupkg.metadata",
".signature.p7s",
"Icon.png",
"LICENSE.TXT",
"THIRD-PARTY-NOTICES.TXT",
"buildTransitive/netcoreapp2.0/System.Threading.Channels.targets",
"buildTransitive/netcoreapp3.1/_._",
"lib/net461/System.Threading.Channels.dll",
"lib/net461/System.Threading.Channels.xml",
"lib/net6.0/System.Threading.Channels.dll",
"lib/net6.0/System.Threading.Channels.xml",
"lib/netcoreapp3.1/System.Threading.Channels.dll",
"lib/netcoreapp3.1/System.Threading.Channels.xml",
"lib/netstandard2.0/System.Threading.Channels.dll",
"lib/netstandard2.0/System.Threading.Channels.xml",
"lib/netstandard2.1/System.Threading.Channels.dll",
"lib/netstandard2.1/System.Threading.Channels.xml",
"system.threading.channels.6.0.0.nupkg.sha512",
"system.threading.channels.nuspec",
"useSharedDesignerContext.txt"
]
},
"Telegram.Bot/17.0.0": {
"sha512": "YvQ9lqEt1bTafu6BJPTbYWDHxyHP+TK8PtjTjNV/6VQw3XxVcZnGwYkJ1CdYW3lJHmHjYxzhBlhhOGNtqJ3U7g==",
"type": "package",
"path": "telegram.bot/17.0.0",
"files": [
".nupkg.metadata",
".signature.p7s",
"lib/netcoreapp3.1/Telegram.Bot.dll",
"lib/netcoreapp3.1/Telegram.Bot.pdb",
"lib/netcoreapp3.1/Telegram.Bot.xml",
"lib/netstandard2.0/Telegram.Bot.dll",
"lib/netstandard2.0/Telegram.Bot.pdb",
"lib/netstandard2.0/Telegram.Bot.xml",
"package-icon.png",
"telegram.bot.17.0.0.nupkg.sha512",
"telegram.bot.nuspec"
]
},
"Telegram.Bot.Extensions.Polling/1.0.0": {
"sha512": "OsUbHdHIMmldevoRYzArh5uJDVs1fzlpj+T3mddeP/ELhhhHLmcjon0ZEypgf1KFEj6QWbuZHkijauIW1LZlqg==",
"type": "package",
"path": "telegram.bot.extensions.polling/1.0.0",
"files": [
".nupkg.metadata",
".signature.p7s",
"lib/netcoreapp3.1/Telegram.Bot.Extensions.Polling.dll",
"lib/netcoreapp3.1/Telegram.Bot.Extensions.Polling.pdb",
"lib/netcoreapp3.1/Telegram.Bot.Extensions.Polling.xml",
"lib/netstandard2.0/Telegram.Bot.Extensions.Polling.dll",
"lib/netstandard2.0/Telegram.Bot.Extensions.Polling.pdb",
"lib/netstandard2.0/Telegram.Bot.Extensions.Polling.xml",
"package-icon.png",
"telegram.bot.extensions.polling.1.0.0.nupkg.sha512",
"telegram.bot.extensions.polling.nuspec"
]
}
},
"projectFileDependencyGroups": {
"net8.0": [
"Newtonsoft.Json >= 13.0.1",
"Telegram.Bot >= 17.0.0",
"Telegram.Bot.Extensions.Polling >= 1.0.0"
]
},
"packageFolders": {
"/home/marco/.nuget/packages/": {}
},
"project": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/home/marco/RiderProjects/so-un-bot/Bot/SoUnBot.csproj",
"projectName": "SoUnBot",
"projectPath": "/home/marco/RiderProjects/so-un-bot/Bot/SoUnBot.csproj",
"packagesPath": "/home/marco/.nuget/packages/",
"outputPath": "/home/marco/RiderProjects/so-un-bot/Bot/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/home/marco/.nuget/NuGet/NuGet.Config"
],
"originalTargetFrameworks": [
"net8.0"
],
"sources": {
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net8.0": {
"targetAlias": "net8.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"net8.0": {
"targetAlias": "net8.0",
"dependencies": {
"Newtonsoft.Json": {
"target": "Package",
"version": "[13.0.1, )"
},
"Telegram.Bot": {
"target": "Package",
"version": "[17.0.0, )"
},
"Telegram.Bot.Extensions.Polling": {
"target": "Package",
"version": "[1.0.0, )"
}
},
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"downloadDependencies": [
{
"name": "Microsoft.AspNetCore.App.Ref",
"version": "[8.0.3, 8.0.3]"
}
],
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/8.0.103/PortableRuntimeIdentifierGraph.json"
}
}
}
}

View file

@ -1,15 +0,0 @@
{
"version": 2,
"dgSpecHash": "SEGQ12m9AW+QER7Y2rV+jE8A1HXwy7fhpFirLSBhBNS7WqVkdPM2naTyYcFc+MOC1gyeO3WdP0+uVYxDWUvDRA==",
"success": true,
"projectFilePath": "/home/marco/RiderProjects/so-un-bot/Bot/SoUnBot.csproj",
"expectedPackageFiles": [
"/home/marco/.nuget/packages/jetbrains.annotations/2021.3.0/jetbrains.annotations.2021.3.0.nupkg.sha512",
"/home/marco/.nuget/packages/newtonsoft.json/13.0.1/newtonsoft.json.13.0.1.nupkg.sha512",
"/home/marco/.nuget/packages/system.threading.channels/6.0.0/system.threading.channels.6.0.0.nupkg.sha512",
"/home/marco/.nuget/packages/telegram.bot/17.0.0/telegram.bot.17.0.0.nupkg.sha512",
"/home/marco/.nuget/packages/telegram.bot.extensions.polling/1.0.0/telegram.bot.extensions.polling.1.0.0.nupkg.sha512",
"/home/marco/.nuget/packages/microsoft.aspnetcore.app.ref/8.0.3/microsoft.aspnetcore.app.ref.8.0.3.nupkg.sha512"
],
"logs": []
}

View file

@ -1 +0,0 @@
"restore":{"projectUniqueName":"/home/marco/RiderProjects/so-un-bot/Bot/SoUnBot.csproj","projectName":"SoUnBot","projectPath":"/home/marco/RiderProjects/so-un-bot/Bot/SoUnBot.csproj","outputPath":"/home/marco/RiderProjects/so-un-bot/Bot/obj/","projectStyle":"PackageReference","originalTargetFrameworks":["net8.0"],"sources":{"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net8.0":{"targetAlias":"net8.0","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]}}"frameworks":{"net8.0":{"targetAlias":"net8.0","dependencies":{"Newtonsoft.Json":{"target":"Package","version":"[13.0.1, )"},"Telegram.Bot":{"target":"Package","version":"[17.0.0, )"},"Telegram.Bot.Extensions.Polling":{"target":"Package","version":"[1.0.0, )"}},"imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"downloadDependencies":[{"name":"Microsoft.AspNetCore.App.Ref","version":"[8.0.3, 8.0.3]"}],"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"/usr/share/dotnet/sdk/8.0.103/PortableRuntimeIdentifierGraph.json"}}

View file

@ -1 +0,0 @@
17116412128528733

View file

@ -1 +0,0 @@
17116412128528733

View file

@ -1,5 +0,0 @@
git pull origin main
docker stop SOBOT
docker rm SOBOT
docker build -t sobot3 .
docker run -d --name='SOBOT' --net='bridge' -e TZ="Europe/Berlin" -e HOST_OS="Unraid" -e HOST_HOSTNAME="Tower" -e HOST_CONTAINERNAME="SOBOT" -l net.unraid.docker.managed=dockerman -p 8001:8001 -v '/mnt/user/SSD/sobot_data':'/App/ACL':'rw' 'sobot3:latest'

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 506 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 353 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 214 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 216 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 215 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 310 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 251 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

View file

@ -1,229 +0,0 @@
1) L'autenticazione dei messaggi consente di
(scegli una o più alternative)
> Garantire la segretezza del messaggio
> Garantire il non-ripudio del mittente (non-repudiation of origin)
> Verificare l'integrità del messaggio
> le prime due sono corrette
v le ultime due sono corrette
> la prima e l'ultima sono corrette
2) Possiamo affermare che un sistema è sicuro se, partendo da uno stato autorizzato non entra mai in uno stato non-autorizzato
v V
> F
3) Una delle primarie assunzioni dell'anomaly detection è la seguente:
Le attività normali e quelle anomale non hanno evidenze distinte
> V
v F
4) L'SSL Handshake Protocol permette al client ed al server di negoziare l'algoritmo di cifratura e l'algoritmo MAC.
v V
> F
5) Quale delle seguenti è una caratteristica di un certificato utente (user certificate) generato da una CA?
> Le chiavi pubbliche utente che sono state certificate dalla CA sono disponibili in una directory accessibile a chiunque
v Ogni utente con accesso alla chiave pubblica della CA può recuperare la chiave pubblica utente che è stata certificata OK
> Ogni utente con accesso alla chiave pubblica della CA può modificare il certificato senza essere scoperto
6) Si consideri il Role-Based Access Control:
I ruoli (role) possono essere utilizzati per gestire un'assegnazione di permessi che soddisfi il principio del Least Privilege.
v V
> F
7) Un sistema di Misuse detection è in grado di identificare anche attacchi sconosciuti a chi sviluppa i set di regole.
> V
v F
8) Il principio del Fail-Safe Defaults asserisce che se un soggetto non ha accesso esplicito a un oggetto, dovrebbe essere garantito l'accesso a quell'oggetto. Scegli una risposta:
> V
v F
9) La cifratura a chiave pubblica trova campo di applicazione nella firma digitale ma non è opportuno utilizzarla per lo scambio di chiavi.
> V
v F
10) La crittografia offre protezione solo da attacchi di passivi
> V
v F
11) Quale è la definizione corretta di Mandatory Access Control?
v Un meccanismo di sistema, basato su regole, che controlla l'accesso ad oggetti e in cui gli utenti individuali non possono alterare la politica di accesso.
> Un meccanismo di sistema, basato su regole, che controlla l'accesso ad oggetti e in cui gli utenti individuali possono alterare la politica di accesso ai loro oggetti.
> Un meccanismo, basato sull'identità, che permette agli utenti individuali di controllare chi può accedere o no agli oggetti del sistema.
12) Il principio di Separazione dei Privilegi (Separation of Privilege) prevede che vengano verificate più condizioni per concedere i privilegi e che due o più componenti lavorino insieme per imporre il livello di sicurezza desiderato.
v V
> F
13) Quali dei seguenti criteri vengono utilizzati nel Attribute-based Access Control per autorizzare o negare un operazione su di un oggetto?
(scegli una o più alternative)
> Attributi assegnati del soggetto
> Condizioni dell'ambiente
> Tipo di operazione da effettuare
v le prime due sono corrette
> le ultime due sono corrette
> la prima e l'ultima sono corrette
15) Considerando un sistema Firewall, quali delle seguenti affermazioni è corretta?
> Il Firewall non penalizza le prestazioni
v Il Firewall è un single-point-of-failure
> Il firewall non è un single-point-of-failure
16) Considerando un sistema Firewall, quali delle seguenti affermazioni è corretta?
> Il firewall, tracciando il traffico in uscita ed in entrate, protegge anche dagli Insider-attacks.
> Il firewall non è un single-point-of-failure.
v Il firewall è il punto centrale per le decisioni relative alla sicurezza di una rete.
17) Supponiamo di dover definire una politica che vieti ad un programma di accedere al file delle password /etc/passwd.
Supponiamo anche di usare un linguaggio ad alto livello, e che i metodi del programma per accedere ai file sono i seguenti:
<pre>
class File {
public file(String name); //Crea un file
public String getfilename(); // Restituisce il nome di un file
public char read(); //Accede ad un file in lettura
}
</pre>
Quali delle seguenti politiche è corretta?
> allow( |-> file.read) when (file.getfilename() == "/etc/passwd")
> deny( |-> file.read) when (file.file(/etc/passwd) == true)
v deny( |-> file.read) when (file.getfilename() == "/etc/passwd")
18) Si supponga di utilizzare un controllo di accessi basato sui ruoli (RBAC) per gestire i permessi in un'azienda.
Si supponga che il dipendente U1 abbia funzione F1 e F1 è associata al ruolo R1.
Se U1 viene rimpiazzato dal dipendente U2 nella funzione F1 quale delle seguenti affermazioni è corretta?
> Il fatto che U2 rimpiazzi U1 nella sua funzione F1 non ha alcuna relazione con l'assegnazione di U2 ad un ruolo.
> U2 può avere tutti i permessi di U1 solo se viene creato un nuovo ruolo R2=R1 e U2 viene assegnato a R2.
v U2 acquisisce automaticamente tutti i permessi di U1.
19) Quale tra i seguenti NON è uno dei principi di progettazione sicura dei sistemi?
v Separation of Responsibilities
> Open Design
> Economy of Mechanisms
20) In un sistema di Verifica e Identificazione Biometrica, la fase di Verifica potrebbe dare un esito inconcludente.
v V
> F
21) Una matrice di controllo degli accessi (Access Control Matrix) è definita da:
soggetti (subjects) S = { s ,…,s }
oggetti (objects) O = { o ,…,o }
Diritti (rights) R = { r ,…,r }
Quale è il significato di un elemento A[s, o ] = { r , ..., r } della matrice R?
v Il soggetto s ha diritti r ,...,r sull'oggetto o
> Il soggetto s può utilizzare le risorse r ,...,r dell'oggetto o
> Il soggetto s non ha i diritti r ,...,r sull'oggetto o
23) Il protocollo di Needham-Schroeder per la distribuzione delle chiavi non è vulnerabile ad attacchi di tipo Replay
> V
v F
24) Quante chiavi usa un algoritmo a cifratura simmetrica?
> Usa due chiavi, una per cifrare ed una per decifrare il messaggio
v Usa una singola chiave sia per cifrare che per decifrare il messaggio
> Il numero di chiavi utilizzate dipende dall'algoritmo scelto
25) Una delle primarie assunzioni dell'anomaly detection è la seguente: Le attività normali e quelle anomale non hanno evidenze distinte
> V
v F
26) Mettendo a confronto RSA e DES, quali delle seguenti affermazioni è corretta?
> La dimensione delle chiavi in RSA è fissa e definita dallo standard KO
v RSA può essere utilizzato per lo scambio di chiavi nella cifratura a blocchi simmetrica (DES)
> RSA garantisce una velocità di cifratura (bit/sec) maggiore rispetto al DES
27) SSL è un protocollo a tre livelli. Al livello più basso (sopra al TCP) abbiamo il SSL Record Protocol, al secondo livello abbiamo il protocollo SSL Change Cipher Spec, ed al livello più alto abbiamo l'SSL Handshake protocol
> V
v F
28) Considerando il protocollo SSL, quali delle seguenti affermazioni è corretta?
> SSL non usa certificati X.509 per l'autentiicazione
> SSL richiede l'uso di IPSec
v SSL usa RSA per la cifratura a chiave pubblica
29) Quali problemi ha un Anomaly Detection System basato su di un modello di Markov?
> Il profilo degli utenti può evolvere nel tempo e quindi bisogna pesare i dati in modo appropriato
v Il sistema ha bisogno di apprendere quali sono le sequenze valide
> Il sistema ha bisogno di apprendere quali sono le sequenze anomale
30) Quale delle seguenti è una tecnica di crittoanalisi?
v Chosen Ciphertext
> Know Ciphertext
> Known Chipherkey
31) Assumiamo che:
A = insieme degli stati del sistema
B = insieme degli stati sicuri del sistema
Se il meccanismo di sicurezza applicato al sistema è tale che A è contenuto, ma non uguale a B, che tipo di meccanismo di sicurezza abbiamo?
> Ampio
> Preciso
v Sicuro
32) Quali tra i seguenti NON è un parametro SSL negoziato mediante il protocollo di handshake?
> master secret
v Kerberos TGS ticket
> X.509 public-key certificate of peer
33) Nella modalità Trasporto, IPSec usa
AH per autenticare il payload IP
ESP per cifrare il payload IP: se si usa IPv4 non viene cifrato l'header; se si usa IPv6 viene cifrato l'extension header.
v V
> F
34) Nella modalità Trasporto, IPSec usa:
AH per autenticare il payload IP
ESP per cifrare l'inner IP packet (che include anche l'header)
> Vero
v Falso
35) Assumiamo che:
A = insieme degli stati del sistema
B = insieme degli stati sicuri del sistema
Se il meccanismo di sicurezza applicato al sistema è tale che A è uguale a B, che tipo di meccanismo di sicurezza abbiamo?
> Ampio
v Preciso
> Sicuro
36) Quali delle seguenti liste contiene solo parametri SSL negoziati mediante il protocollo di handshake?
v session ID; compression algorithm; master secret OK
> master secret; X.509 public-key certificate of peer; client_write_key
> Change Cipher Spec; Alert; X.509 public-key certificate of peer
img=https://i.imgur.com/iwCvLLu.png%
37) Si consideri la seguente regola di firewall: quale delle seguenti affermazioni è corretta?
v Solo il traffico generato da un host interno al firewall è ammesso verso la porta 25 di un host qualsiasi; Solo il traffico che appartiene ad una connessione già instaurata sulla porta 25 è ammesso indipendentemente dalla provenienza/destinazione.
> Il traffico generato da un host interno al firewall verso la porta 25 è bloccato a meno che non appartenga ad una connessione già esistente.
> Solo il traffico sulla porta 25 è ammesso indipendentemente dalla sorgente/destinazione, e dal tipo di messaggio.
38) Un sistema Firewall è definito dagli RFC 2828 e 2979.
Quali delle seguenti proprietà dovrebbe avere un Firewall?
> Se nella rete delimitata dal Firewall ci sono sistemi non critici, il loro traffico può aggirare il Firewall.
v Il Firewall deve essere immune alla penetrazione, facendo uso di un sistema trusted equipaggiato come un sistema operativo sicuro.
> Le politiche di sicurezza del Firewall hanno il compito di re-indirizzare (re-routing) il traffico non sensibile proveniente dalla rete protetta in modo che il Firewall stesso non sia sovraccaricato inutilmente.
39) Quale delle seguenti non è una tecnica di crittoanalisi?
> Chosen Ciphertext
> Known Plaintext
v Know Ciphertext
40) Un sistema crittografico (Criptosystem) è definito dalla quintupla (E, D, M, K, C) dove
M insieme dei plaintexts
K insieme delle chiavi
C insieme ciphertexts
E funzione di cifratura (encryption functions)
D funzione di decifratura (decryption functions)
Quale è la definizione corretta di E?
> <code>E = { Ec : M --> K | c in C}</code>
> <code>E = { Ek : C --> M | k in K}</code>
v <code>E = { Ek : M --> C | k in K}</code>
La cifratura a chiave pubblica può essere utilizzata per garantire la confidenzialità (confidentiality) o integrità/autenticazione (integrity/authentication) del messaggio, ma non entrambe.
> V
v F
41) Tre approcci alternativi all'utenticazione di un messaggio sono:
cifratura del messaggio
calcolo di una hash function del messaggio
calcolo di una keyed hash functions del messaggio
v V
> F

View file

@ -1,331 +0,0 @@
1) Esiste un codice di diritto dellinformatica?
v No.
> Si
2) Cosa si intende con principio di neutralità della rete?
> Che opera nella rete non deve discriminare politicamente
v Che chi opera nella rete non deve discriminare tra tecnologie di accesso.
> Che chi opera nella rete non deve discriminare i consumatori
3) Quando in Italia la riservatezza è divenuto diritto tutelato delle leggi?
> A metà degli anni 70
v A metà degli anni 90
> Dal 2023
4) Perché di solito un internet provider non chiede un canone allutente?
> Perché vende le informazioni sugli interessi dell'utente
> Perché riceve dallo Stato un apposito finanziamento per far funzionare l rete
v Perché ricava gli utili da altri servizi che offre agli utenti
5) Un file è un documento valido?
> Si
v Si ma solo se firmato digitalmente.
> No
6) Cosa è la dematerializzazione dei titoli finanziari?
> Il fatto che ormai nessuno è più interessato a questi documenti
> Il fatto che si sta passando dalla moneta cartacea a quella digitale (bitcoins e simili)
v Il fatto che i titoli di carta sono stati sostituiti da scritturazioni elettroniche.
7) Cosè linformatizzazione dei registri immobiliari?
> Il fatto che i registri di carta sono ora digitali
v Il fatto che chiunque può accedere telematicamente ai registri digitali.
> Il fatto che i notati si trasmettono gli atti ai registri in formato digitale
8) I bitcoins sono una moneta?
> Si, digitale
> Si ma privata
v No, sono un mezzo di scambio.
9) Il commercio elettronico riguarda?
v Consumatori e/o imprese.
> solo i consumatori
> solo le imprese
10) Per effettuare una comunicazione commerciale:
v occorre il preventivo consenso del destinatario.
> occorre che siano dirette solo ad imprese, non a consumatori
> occorre che chiariscano di essere comunicazioni commerciali
11) A cosa servono i marchi di qualità?
v Per attestare la qualità del prodotto
> Per acquistare la fiducia dei cliente sulla bontà del prodotto
> Per rispettare le norme sulla etichettatura dei prodotti
12) Si possono utilizzare tecniche digitali per bloccare laccesso a proprie opere dingegno?
v Si sempre.
> Si ma solo se sono opere che hanno carattere creativo
> Si ogni volta che sono brevettate
13) Esistono norme penali contro luso improprio del software?
> Si ma riguardano solo gli hacker
v Si ma riguardano solo la violazione del diritto dautore.
> Si e riguardano anche i mezzi di pagamento
14) I provider devono controllare il materiale che viene inserito dagli utenti?
> Si
> Si se si tratta di tutela dei minori o di terrorismo
v No
15) Quali regole disciplinano i social network?
> Il contratto ed eventuali norme di legge
v Lapposita disciplina legale e poi il contratto.
> Non ci sono regole
16) Da quando è la legge scritta a tutelare la privacy?
> Dagli anni 50
> Dagli anni 70
v Dagli anni 90
17) Chi è il "responsabile" nel trattamento dei dati personali?
> Chi paga i danni se non ci sono le autorizzazioni
v Chi è titolare delle modalità di trattamento
> Chi fa apporre la firma per il consenso al soggetto interessato
18) Dove si trovano le regole sulla trasparenza nelle comunicazioni elettroniche?
v Nel codice delle telecomunicazioni
> Nel codice penale
> Nel codice civile
19) Le regole del codice dell'amministrazione digitale sui documenti informatici valgono per i privati?
v No
> Si, ma solo se autorizzati
> Si
20) Si può imporre ad un'amministrazione di rispondere via pec alle istanze dei privati?
v Si
> No
21) Quali mezzi di comunicazione hanno la data certa opponibile a tutti?
> La mail e il fax
> La pec
v La pec ed il fax.
22) Cosa è il processo civile telematico?
v Il processo civile in cui il deposito degli atti avviene in forma telematica.
> Il processo civile che ha per oggetto una lite informatica
> Il fatto che nella società moderna vi è un processo di sostituzione della carta con il mezzo informatico
23) Cos'è la moneta elettronica?
> Il bitcoin
> Carte di debito e di credito
v Un valore monetario memorizzato elettronicamente.
24) I bitcoins hanno valore stabile?
> Tendenzialmente si
v Tendenzialmente no;
> Non esistono dati rilevati
25) I pagamenti mediante bitcoins sono tracciati?
v Si, ma non i loro autori
> No
> No ma sono tracciati i loro autori
26) Si possono fornire ai consumatori beni non richiesti?
v No, occorre un previo ordine di acquisto
> No, a meno che il venditore li offra gratuitamente
> No, a meno che il venditore si impegni a ritirarli gratuitamente a richiesta
27) A cosa servono i marchi di qualità?
v È una dichiarazione di un terzo circa l'affidabilità di un soggetto
> È un marchio che protegge un software o un sito web
> È un marchio rilasciato dallo stato ad imprenditori che hanno certe qualifiche
28) Le banche dati sono tutelate?
v Si sempre.
> Si ogni volta che hanno carattere creativo
> Si ogni volta che sono brevettate
29) Esiste un' autorità centrale che governa Internet?
> Si
> Si ma non in Italia
v No
30) Cosa si intende per privacy?
v Il diritto di mantenere il controllo sulle proprie informazioni
> Il diritto alla proprietà privata
> Il diritto alla non ingerenza nella sfera sessuale
31) I privati possono raccogliere i dati personali altrui?
> No
> Si, ma solo se autorizzati
v Si ma solo se non sono destinati alla diffusione.
32) Quando non si adottano misure minime di sicurezza nella conservazione dei dati vi è una responsabilità?
> Civile
v Penale.
> Amministrativa
33) I documenti informatici?
> Sono validi nei soli casi previsti dalla legge
v Sono validi se con firma digitale.
> Sono validi a tutti gli effetti
34) Quando un documento inviato a mezzo posta certificata si considera consegnato?
> Quando viene inviato dal proprio server
v Quando arriva al server del destinatario
> Quando viene letto dal destinatario
35) Chi emette i bitcoins?
> Le autorità dei vari paesi controllano le loro emissioni
> Le banche centrali
v Colui che li ha inventati
36) I bitcoins sono convertibili in denaro?
v Si
> No
> Solo se la conversione è autorizzata dalle banche centrali
37) Il commercio elettronico disciplinato dal codice del consumo vale:
> Per qualsiasi transazione effettuata con strumenti telematici
> Per le transazioni con strumenti telematici tra consumatori
v Per le transazioni con strumenti telematici tra consumatori ed imprese.
38) In caso di acquisti online si può recedere dall'acquisto?
> Per qualsiasi transazione effettuata con strumenti telematici
> Per le transazioni con strumenti telematici tra consumatori
v Per le transazioni con strumenti telematici tra consumatori ed imprese
39) Il commercio elettronico disciplinato dalla disciplina delle società dell'informazione riguarda:
v Qualsiasi transazione effettuata con strumenti telematici con imprese
> Le transazioni con strumenti telematici tra consumatori
> Le transazioni con strumenti telematici tra consumatori ed imprese
40) Quando inizia il trattamento dei dati personali?
> Da quando inizia la raccolta dei dati
v Da quando linteressato rilascia il consenso
> Da quando i dati vengono elaborati
41) I codici di autoregolamento sono obbligatori?
> Si
> Si, se lo dice la legge
v No
42) Scannerizzo ed appongo la mia firma ad un documento, questa è una firma elettronica avanzata?
> Si
> Si se poi non la contesto
v No
43) Si può concludere un contratto via mail?
v Si.
> Si se poi non lo contestano
> No
> 44)Nei contratti a distanza con il consumatore, questi può recedere?
v Si, senza dare spiegazioni
> Si ma solo per giusta causa
> No
45) Se compro il pc ed il software è in licenza:
> posso acquistare il software pagando un ulteriore somma
v Il software non è mio.
> ho pagato e quindi anche il software è mio
46) Cosè il fascicolo telematico?
v È il fascicolo digitale del processo civile.
> Il fascicolo delle comunicazioni digitali con la pubblica amministrazione
> Il fascicolo digitale dove luniversità conserva tutti i dati dello studente
47) Si può fare una copia di un programma che si ha in licenza?
> Sì pagando unapposita royalties
> Si ma solo se pattuito allinizio del contratto
v Si ma senza commercializzarlo e per luso del programma stesso.
48) Cosa è una wireless community network?
> Un insieme di persone che sostiene il diritto alla libertà su internet
v Un insieme di persone che crea una rete di comunicazioni wireless.
> È un modo di designare gli utenti dei social network
49) Le regole di comportamento previste nella piattaforma di un social network?
> Non sono regole giuridiche
> Sono regole locali
v Sono regole contrattuali.
50) Cliccando su accetto sulliscrizione ad un social network si conclude un contratto?
v Si
> Si ma poi serve un documento scritto
> No
51) Quando sono protette le banche dati?
> Sempre se hanno carattere creativo
> Sempre se sono brevettate
v Sempre se sono rese pubbliche.
52) Cosa si intende per deterritorializzazione?
> La perdita di sovranità derivante della tecnologia informatica.
> Il fatto che tra gli stati stanno venendo meno i conflitti
> Il fatto che ognuno può installare un provider nello stato che preferisce
v Il fatto che gli stati non riescono a controllare gli illeciti compiuti in rete
53) Un nome di dominio è un bene?
v Si
> No
54) Un documento elettronico privo di firma digitale?
v Non è valido
> È valido
> È valido ma un giudice può anche ritenerlo inidoneo.
55) Un internet provider è responsabile degli insulti pubblici dai suoi utenti?
v No se svolge un ruolo meramente passivo nelle loro attività.
> No ma solo se ha messo delle regole contrattuali che li vietino
> Si
56) Cosè il trattamento dei dati personali?
> La raccolta dei dati personali di un soggetto tramite strumenti informatici
v La raccolta, lelaborazione e la conservazione dei dati personali di un soggetto tramite strumenti informatici.
> Praticamente ogni attività che coinvolga i dati personali di un soggetto
57) È legittimo prendere una decisione (es. di tipo contrattuale) automatizzata utilizzando un algoritmo?
> Si
v Si ma solo se vi è coinvolgimento umano nella decisione
> No
58) Le criptovalute sono monete?
> Si
v No, sono beni digitali.
59) Cosa si intende con dematerializzazione?
> il fatto che esistono beni immateriali
v Il fatto che sempre più beni stanno assumendo forma digitale anziché materiale.
> il fatto che nella legge si progetta la futura sostituzione di beni materiali con beni digitali
60) Cosa vuol dire che il contratto è fonte delle regole?
v Che molti rapporti digitali sono regolati quasi interamente da contratti , mancando regole specifiche.
> che il contratto fa parte delle fonti legali di regole
> che molti internet provider utilizzano regole uguali nei rapporti con gli utenti
61) Cosa si intende con / cos'è il principio di neutralità tecnologica?
> lobbligo di utilizzare una medisca tecnologia informatica
v Lobbligo di non discriminare tra diverse tecnologie.
> il divieto di discriminazione di ogni tipo tramite social network
62) Cosè il digital divide?
v La scarsa distribuzione di risorse e conoscenze informatiche.
> Lutilizzo di pc e softwares non aggiornati
> linsieme dei rischi connessi allutilizzo di strumenti informativi
63) Lacquisto di competenze digitali:
v È oggetto di leggi che lo agevolano.
> dipende solo dalla volontà di ognuno
> è affidato alle società che trattano big data
64) Si può caricare su un social network limmagine di una persona?
> si sempre ma solo se è maggiorenne
> si ma va tolta se lo chiede
v Si ma dopo aver avuto il suo consenso.
65) Il cyberbullismo:
> è una questione di maleducazione
v È un comportamento vietato dalla legge
> è un comportamento regolato dai singoli social network
66) Cosè lo SPID?
v È un sistema pubblico di identificazione di oggetti.
> è un sistema pubblico di attribuzione di posta certificata
> è un sistema pubblico per accedere a determinati servizi di trading on line
67) Cosè un domicilio digitale?
> lindirizzo pec che indica dove siamo residenti
> l'indirizzo pec che dobbiamo aver per i nostri rapporti con il fisco
v Lindirizzo pec che vale per comunicazioni aventi valore legale.

View file

@ -1 +0,0 @@
(a=100, b=false, c=true), (a=90, b=true, c=false)

View file

@ -1,20 +0,0 @@
Una Condition è una proposizione booleana, cioè una espressione con valore booleano che non può essere decomposta in espressioni boolean più semplici. Ad esempio, (x + y <= 3) è una condition.
Una Decision è una espressione booleana composta da conditions e zero o più operatori booleani. Ad esempio, sono decisions:
(x + y <= 3)
((x + y <= 3) || (x - y > 7))
Un insieme di test T soddisfa il criterio di Condition/Decision coverage se tutte le seguenti condizioni sono soddisfatte:
1) Ciascun punto di entrata ed uscita nel programma è eseguito in almeno un test;
2) Per ogni decision d nel programma, per ogni condition c in d, esiste un test in T in cui c è true ed un test in T in cui c è false.
3) Per ogni decision d nel programma, esiste in test in T in cui d è true ed un test in T in cui d è false.
Si consideri la seguente funzione:
int f(int a, bool b, bool c)
{ if ( (a == 100) && (b || c) )
{ return (1); }
else { return (2);}
}
Quale dei seguenti test set soddisfa il criterio della Condition/Decision coverage?

View file

@ -1 +0,0 @@
(a=100, b=false, c=false), (a=90, b=true, c=true)

View file

@ -1 +0,0 @@
(a=100, b=false, c=true), (a=90, b=false, c=true)

View file

@ -1 +0,0 @@
50%

View file

@ -1,57 +0,0 @@
Il branch coverage di un insieme di test cases è la percentuale di branch del programma che sono attraversati da almeno un test case.
Si consideri il seguente programma C:
-----------
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#define N 4 /* number of test cases */
int f(int x1, int x2)
{
if (x1 + x2 <= 2)
return (1);
else return (2);
}
int main() { int i, y; int x1[N], x2[N];
// define test cases
x1[0] = 5; x2[0] = -2; x1[1] = 6; x2[1] = -3; x1[2] = 7; x2[2] = -4; x1[3] = 8; x2[3] = -5;
// testing
for (i = 0; i < N; i++) {
y = f(x1[i], x2[i]); // function under testing
assert(y ==(x1[i], x2[i] <= 2) ? 1 : 2); // oracle
}
printf("All %d test cases passed\n", N);
return (0);
}
-----------
Il programma main() sopra realizza il nostro testing per la funzione f1(). I test cases sono i valori in x1[i] ed x2[i].
Quale delle seguenti è la branch coverage conseguita?

View file

@ -1 +0,0 @@
80%

View file

@ -1 +0,0 @@
100%

View file

@ -1 +0,0 @@
100%

View file

@ -1,45 +0,0 @@
Il partition coverage di un insieme di test cases è la percentuale di elementi della partition inclusi nei test cases. La partition è una partizione finita dell'insieme di input della funzione che si sta testando.
Si consideri il seguente programma C:
-----------
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#define N 5 /* number of test cases */
int f1(int x) { return (2*x); }
int main() { int i, y; int x[N];
// define test cases
x[0] = 0; x[1] = 1; x[2] = -1; x[3] = 10; x[4] = -10;
// testing
for (i = 0; i < N; i++) {
y = f1(x[i]); // function under testing
assert(y == 2*x[i]); // oracle
}
printf("All %d test cases passed\n", N);
return (0);
}
Si vuole testare la funzione f1(). A tal fine l'insieme degli interi viene partizionato come segue:
{0, {-1}, {1}, {tutti glli interi negativi diversi da -1}, {tutti glli interi positivi diversi da 1}}
Il programma main() sopra realizza il nostro testing per la funzione f1(). I test cases sono i valori in x[i].
Quale delle seguenti è la partition coverage conseguita?

View file

@ -1 +0,0 @@
80%

View file

@ -1 +0,0 @@
50%

View file

@ -1 +0,0 @@
(a=100, b=true, c=false), (a=90, b=false, c=true), (a=90, b=false, c=false)

View file

@ -1,22 +0,0 @@
Una Condition è una proposizione booleana, cioè una espressione con valore booleano che non può essere decomposta in espressioni boolean più semplici. Ad esempio, (x + y <= 3) è una condition.
Una Decision è una espressione booleana composta da conditions e zero o più operatori booleani. Ad esempio, sono decisions:
(x + y <= 3)
((x + y <= 3) || (x - y > 7))
Un insieme di test T soddisfa il criterio di Condition/Decision coverage se tutte le seguenti condizioni sono soddisfatte:
1) Ciascun punto di entrata ed uscita nel programma è eseguito in almeno un test;
2) Per ogni decision d nel programma, per ogni condition c in d, esiste un test in T in cui c è true ed un test in T in cui c è false.
3) Per ogni decision d nel programma, esiste in test in T in cui d è true ed un test in T in cui d è false.
Si consideri la seguente funzione:
int f(int a, bool b, bool c)
{ if ( (a == 100) && b )
return (1); // punto di uscita 1
else if (b || c)
then return (2); // punto di uscita 2
else return (3); // punto di uscita 3
}
Quale dei seguenti test set soddisfa il criterio della Condition/Decision coverage?

View file

@ -1 +0,0 @@
(a=100, b=true, c=false), (a=90, b=false, c=true), (a=100, b=true, c=true)

View file

@ -1 +0,0 @@
(a=100, b=true, c=false), (a=90, b=false, c=false), (a=100, b=false, c=false)

View file

@ -1 +0,0 @@
Customers should be closely involved throughout the development process.

View file

@ -1 +0,0 @@
Which of the following is an agile principle?

View file

@ -1 +0,0 @@
Customers should just provide requirements and verify them when the project is completed.

View file

@ -1 +0,0 @@
Customers should not interfere with the software development.

View file

@ -1 +0,0 @@
Testing interfaces for each component (i.e., integration of several units).

View file

@ -1 +0,0 @@
Component testing focuses on:

View file

@ -1 +0,0 @@
Testing interactions among components (i.e., integration of several units).

View file

@ -1 +0,0 @@
Testing functionalities of individual program units, object classes or methods.

View file

@ -1 +0,0 @@
Assicurarsi che un sistema che soddisfa i requisiti risolve il problema del "customer".

View file

@ -1 +0,0 @@
Quale delle seguenti frasi meglio descrive l'obiettivo del "validity check" che è parte della "requirements validation activity".

View file

@ -1 +0,0 @@
Assicurarsi che i requisiti funzionali descrivano tutte le funzionalità del sistema.

View file

@ -1 +0,0 @@
Assicurarsi che non ci siano requisiti in conflitto con altri requisiti.

View file

@ -1 +0,0 @@
Transition coverage: 40%

View file

@ -1,11 +0,0 @@
img=https://unspectacular-subdi.000webhostapp.com/0120_domanda_0.png
La transition coverage di un insieme di test cases (cioè sequenze di inputs) per uno state diagram è la percentuale di transizioni (archi nel grafo dello state diagram) percorsi almeno una volta.
Si consideri lo state diagram in figura
ed il seguente insieme di test cases:
Test case 1: act2 act1
Test case 2: act1 act0 act1 act0 act2
Test case 3: act0 act2 act2 act1
Quale delle seguenti è la migliore stima della transition coverage per i test cases di cui sopra?

View file

@ -1 +0,0 @@
Transition coverage: 30%

View file

@ -1 +0,0 @@
Transition coverage: 80%

Some files were not shown because too many files have changed in this diff Show more