Skip to content

Latest commit

 

History

History

cxx

(C) 2024 Swudu Susuwu, dual licenses: choose GPLv2 or Apache 2 (allows all uses).

Purposes

./cxx/ C++ implementations of posts

  • ./cxx/Macros.hxx is
    • macros with wrap C++ features/attributes, such as {SUSUWU_ASSUME, SUSUWU_CONSTEXPR, SUSUWU_DEFAULT, SUSUWU_DELETE, SUSUWU_EXPECTS, SUSUWU_ENSURES, SUSUWU_FINAL, SUSUWU_IF_CPLUSPLUS, SUSUWU_NOEXCEPT, SUSUWU_NORETURN, SUSUWU_NULLPTR, SUSUWU_OVERRIDE, SUSUWU_STATIC_ASSERT, SUSUWU_UNREACHABLE} which (if used on old compilers, or with options such as -std=c++11) are replaced with no-ops or alternatives which have the same use,
    • macro options (which control the macro constants/macro functions). (View Options/setup for options),
    • macro constants, such as SUSUWU_SH_<color> (color = {DEFAULT, BLACK, DARK_GRAY, RED, LIGHT_RED, GREEN, LIGHT_GREEN, BROWN, YELLOW, BLUE, LIGHT_BLUE, PURPLE, LIGHT_PURPLE, CYAN, LIGHT_CYAN, LIGHT_GRAY, WHITE}, if supported, expands to the ANSI color codes, else expands to ""),
    • macro functions, such as {SUSUWU_ERROR, SUSUWU_WARNING, SUSUWU_INFO, SUSUWU_SUCCESS, which use SUSUWU_PRINT}, SUSUWU_PRINT (if __cplusplus, uses SUSUWU_CERR, else uses SUSUWU_STDERRR),
    • macroTestsNoexcept() (unit tests, with return value for errors).
  • ./cxx/ClassObject.hxx is
  • ./cxx/ClassPortableExecutable.hxx is
    • FilePath (PortableExecutable's constructor argument), FileBytecode (classSha2's input argument), FileHash (classSha2's return value)
    • class PortableExecutable : public Object (stores file path and/or bytecode and/or hexcode. TODO; hash?)
    • class PortableExecutableBytecode : public PortableExecutable loads bytecode from path. TODO; hash?
  • ./cxx/ClassSys.hxx is
    • typedefs {ClassSysUSeconds}
    • globals {classSysArgc, classSysArgs}
    • modular functions to interact with: console (Posix /bin/sh or Windows cmd``) {classSysGetConsoleInput(), classSysSetConsoleInput()}, own process {classSysInit(), classSysGetOwnPath(), classSysFopenOwnPath(), templateCatchAll()}, strings (or streams) {classSysHexOs(), classSysHexStr(), classSysColoredParamOs(), classSysColoredParamStr()}, the OS {classSysUSecondClock(), execvesFork(), execvexFork(), execves(), execvex(), classSysHasRoot(), classSysSetRoot(), classSysKernelCallback(), classSysKernelSetHook()}. TODO: filesystem (perhaps just have cxx/ClassPortableExecutable.hxx` do this?), internet.
    • classSysTests(), or classSysTestsNoexcept() (unit tests with exceptions for errors, or return value for errors).
  • ./cxx/ClassSha2.hxx is
    • the classSha2 function pointer, which defaults to classSha256() (but you can set classSha2 = sha128; or classSha2 = sha512;), wrapped around official RFC6234 code. ./cxx/ClassResultList.hxx, ./cxx/VirusAnalysis.cxx and ./cxx/AssistantCns.cxx all use classSha2.
    • classSha2Tests(), or classSha2TestsNoexcept() (unit tests with exceptions for errors, or return value for errors).
  • ./cxx/ClassCns.hxx is class Cns : public Object (abstract neural system class with pure virtuals.) Issue #6 is to implement this class.
  • ./cxx/ClassResultList.hxx is
    • class ResultList : public Object (holds hashes, signatures, bytecodes); resultList*() functions {resultListDumpTo(), resultListProduceHashes() (virusAnalysisTests() uses this)}.
    • modular template (can use on all containers such as std::vector, std::map or std::list) list*() functions (such as listMaxSize(), listDumpTo(), listToHashes(), listIntersections(), listsIntersect(), listFindValue(), listHasValue(), listFindSubstr(), listHasSubstr(), listProduceSignature() (produceAbortListSignatures uses this), listFindSignatureOfValue(), listHasSignatureOfValue() (signatureAnalysis() uses this), explodeToList (./cxx/AssistantCns.cxx uses this), produce unique signature, compare file against list of signatures), most of which were produced for antivirus signature analysis.
    • classResultListsTests(), or classResultListsTestsNoexcept() (unit tests with exceptions for errors, or return value for errors).
  • ./cxx/VirusAnalysis.hxx is
    • modular helper functions {produceAbortListSignatures() (for signatureAnalysis() use), importedFunctionsList() (work-in-progress, staticAnalysis() uses this), straceOutputsAnalysis() (work-in-progress, sandboxAnalysis() uses this), produceAnalysisCns() (for cnsAnalysis() use), produceVirusFixCns() (for cnsVirusFix() use)},
    • kernel hook function (virusAnalysisHook()), which uses virusAnalysis() to scan new downloadss (or scan all programs which execute); work-in-progress.
    • modular scan functions {hashAnalysis(), signatureAnalysis(), staticAnalysis() (processes Executable and Linkable Format or Portable Executables, work-in-progress), sandboxAnalysis() (executes with strace + chroot, work-in-progress), cnsAnalysis() (uses ClassCns.hxx)} plus disinfection function (cnsVirusFix()) which form an antivirus program.
    • virusAnalysisTests(), or virusAnalysisTestsNoexcept() (unit tests with exceptions for errors, or return value for errors).
  • ./cxx/AssistantCns.hxx is
    • modular functions {assistantCnsDownloadHosts() (uses wget on assistantCnsDefaultHosts), assistantCnsProcessXhtml() (uses the next 2 functions to process wget's downloads: assistantCnsProcessUrls (uses boost/property_tree/xml_parser.hpp to extract new URLs), assistantCnsProcessQuestion (work-in-progress, extracts question), assistantCnsProcessResponses() (work-in-progress, extracts answers)), produceAssistantCns() (uses datasets for backpropagation), assistantCnsProcess (uses forwardpropagation to answer new questions)} which form an assistant.
    • assistantCnsTests(), or assistantCnsTestsNoexcept() (unit tests with exceptions for errors, or return value for errors).
  • ./cxx/main.hxx is SusuwuUnitTestsBitmask main() (executes all of those *TestsNoexcept() unit tests into a bitmask return value.) All have lots of issues which you can contribute to, or can request that more resources go to).