(C) 2024 Swudu Susuwu, dual licenses: choose GPLv2 or Apache 2 (allows all uses).
./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 useSUSUWU_PRINT
},SUSUWU_PRINT
(if__cplusplus
, usesSUSUWU_CERR
, else usesSUSUWU_STDERRR
), macroTestsNoexcept()
(unit tests, with return value for errors).
- macros with wrap C++ features/attributes, such as {
./cxx/ClassObject.hxx
isclass Instrumentation
(port ofjava.lang.instrument.Instrumentation
),class Class : public Instrumentation
(port ofjava.lang.Class
),class Object : public Class
(port ofjava.lang.Object
),classObjectTests()
, orclassObjectTestsNoexcept()
(unit tests with exceptions for errors, or return value for errors).
./cxx/ClassPortableExecutable.hxx
isFilePath
(PortableExecutable
's constructor argument),FileBytecode
(classSha2
's input argument),FileHash
(classSha2
's return value)class PortableExecutable : public Object
(stores filepath
and/orbytecode
and/orhex
code. TODO;hash
?)class PortableExecutableBytecode : public PortableExecutable
loadsbytecode
frompath
. TODO;hash
?
./cxx/ClassSys.hxx
is- typedefs {ClassSysUSeconds}
- globals {classSysArgc, classSysArgs}
- modular functions to interact with: console (Posix
/bin/sh
or Windowscmd``) {
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()
, orclassSysTestsNoexcept()
(unit tests with exceptions for errors, or return value for errors).
./cxx/ClassSha2.hxx
is- the
classSha2
function pointer, which defaults toclassSha256()
(but you can setclassSha2 = sha128;
orclassSha2 = sha512;
), wrapped around official RFC6234 code../cxx/ClassResultList.hxx
,./cxx/VirusAnalysis.cxx
and./cxx/AssistantCns.cxx
all useclassSha2
. classSha2Tests()
, orclassSha2TestsNoexcept()
(unit tests with exceptions for errors, or return value for errors).
- the
./cxx/ClassCns.hxx
isclass Cns : public Object
(abstract neural system class with pure virtuals.) Issue #6 is to implement this class../cxx/ClassResultList.hxx
isclass ResultList : public Object
(holdshashes
,signatures
,bytecodes
);resultList*()
functions {resultListDumpTo()
,resultListProduceHashes()
(virusAnalysisTests()
uses this)}.- modular template (can use on all containers such as
std::vector
,std::map
orstd::list
)list*()
functions (such aslistMaxSize()
,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()
, orclassResultListsTestsNoexcept()
(unit tests with exceptions for errors, or return value for errors).
./cxx/VirusAnalysis.hxx
is- modular helper functions {
produceAbortListSignatures()
(forsignatureAnalysis()
use),importedFunctionsList()
(work-in-progress,staticAnalysis()
uses this),straceOutputsAnalysis()
(work-in-progress,sandboxAnalysis()
uses this),produceAnalysisCns()
(forcnsAnalysis()
use),produceVirusFixCns()
(forcnsVirusFix()
use)}, - kernel hook function (
virusAnalysisHook()
), which usesvirusAnalysis()
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 withstrace
+chroot
, work-in-progress),cnsAnalysis()
(usesClassCns.hxx
)} plus disinfection function (cnsVirusFix()
) which form an antivirus program. virusAnalysisTests()
, orvirusAnalysisTestsNoexcept()
(unit tests with exceptions for errors, or return value for errors).
- modular helper functions {
./cxx/AssistantCns.hxx
is- modular functions {
assistantCnsDownloadHosts()
(useswget
onassistantCnsDefaultHosts
),assistantCnsProcessXhtml()
(uses the next 2 functions to processwget
's downloads:assistantCnsProcessUrls
(usesboost/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()
, orassistantCnsTestsNoexcept()
(unit tests with exceptions for errors, or return value for errors).
- modular functions {
./cxx/main.hxx
isSusuwuUnitTestsBitmask 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).