├── Driver ├── driver.sln └── driver │ ├── Driver.c │ ├── driver.inf │ ├── driver.vcxproj │ ├── driver.vcxproj.filters │ └── driver.vcxproj.user ├── KBot.sln ├── KBot ├── API.h ├── AiManager.h ├── Bytes.h ├── CMissileClient.h ├── CObjectManager.h ├── CSpellData.h ├── CSpellEntry.h ├── CSpellInfo.h ├── CSpellSlot.h ├── Config.cpp ├── Config.h ├── Definitions.h ├── DirectX.cpp ├── DirectX.h ├── Draw.cpp ├── Draw.h ├── Evade.h ├── Evade2.cpp ├── Evade2.h ├── GameData.cpp ├── GameData.h ├── Geometry.h ├── HTTP.h ├── Initialize.cpp ├── Initialize.h ├── KBot.cpp ├── KBot.vcxproj ├── KBot.vcxproj.filters ├── KBot.vcxproj.user ├── KInterface.h ├── Keyboard.cpp ├── Keyboard.h ├── LoLAPI.cpp ├── LoLAPI.h ├── Lux.cpp ├── Lux.h ├── Menu.h ├── Mouse.cpp ├── Mouse.h ├── Orbwalker.cpp ├── Orbwalker.h ├── Pantheon.cpp ├── Pantheon.h ├── Pixel.cpp ├── Pixel.h ├── RGBA.h ├── Script.h ├── ScriptUtils.h ├── SpellInfo.cpp ├── SpellInfo.h ├── Talon.cpp ├── Talon.h ├── UnitInfo.cpp ├── UnitInfo.h ├── Utils.cpp ├── Utils.h ├── Vector.cpp ├── Vector.h ├── Visuals.cpp ├── Visuals.h ├── Xerath.cpp ├── Xerath.h ├── aws-c-common.dll ├── aws-c-event-stream.dll ├── aws-checksums.dll ├── aws-cpp-sdk-core.dll ├── clipper.cpp ├── clipper.hpp ├── imconfig.h ├── imgui.cpp ├── imgui.h ├── imgui_demo.cpp ├── imgui_draw.cpp ├── imgui_impl_dx11.cpp ├── imgui_impl_dx11.h ├── imgui_impl_win32.cpp ├── imgui_impl_win32.h ├── imgui_internal.h ├── imgui_widgets.cpp ├── imstb_rectpack.h ├── imstb_textedit.h ├── imstb_truetype.h ├── include │ └── aws │ │ └── core │ │ ├── AmazonSerializableWebServiceRequest.h │ │ ├── AmazonStreamingWebServiceRequest.h │ │ ├── AmazonWebServiceRequest.h │ │ ├── AmazonWebServiceResult.h │ │ ├── Aws.h │ │ ├── Core_EXPORTS.h │ │ ├── Globals.h │ │ ├── NoResult.h │ │ ├── Region.h │ │ ├── SDKConfig.h │ │ ├── SDKConfig.h.in │ │ ├── Version.h │ │ ├── VersionConfig.h │ │ ├── VersionConfig.h.in │ │ ├── auth │ │ ├── AWSAuthSigner.h │ │ ├── AWSAuthSignerProvider.h │ │ ├── AWSCredentials.h │ │ ├── AWSCredentialsProvider.h │ │ ├── AWSCredentialsProviderChain.h │ │ └── STSCredentialsProvider.h │ │ ├── client │ │ ├── AWSClient.h │ │ ├── AWSError.h │ │ ├── AWSErrorMarshaller.h │ │ ├── AsyncCallerContext.h │ │ ├── ClientConfiguration.h │ │ ├── CoreErrors.h │ │ ├── DefaultRetryStrategy.h │ │ ├── RetryStrategy.h │ │ └── SpecifiedRetryableErrorsRetryStrategy.h │ │ ├── config │ │ └── AWSProfileConfigLoader.h │ │ ├── external │ │ ├── CommonCryptorSPI.h │ │ ├── cjson │ │ │ └── cJSON.h │ │ └── tinyxml2 │ │ │ └── tinyxml2.h │ │ ├── http │ │ ├── HttpClient.h │ │ ├── HttpClientFactory.h │ │ ├── HttpRequest.h │ │ ├── HttpResponse.h │ │ ├── HttpTypes.h │ │ ├── Scheme.h │ │ ├── URI.h │ │ ├── curl │ │ │ ├── CurlHandleContainer.h │ │ │ └── CurlHttpClient.h │ │ ├── standard │ │ │ ├── StandardHttpRequest.h │ │ │ └── StandardHttpResponse.h │ │ └── windows │ │ │ ├── IXmlHttpRequest2HttpClient.h │ │ │ ├── WinConnectionPoolMgr.h │ │ │ ├── WinHttpConnectionPoolMgr.h │ │ │ ├── WinHttpSyncHttpClient.h │ │ │ ├── WinINetConnectionPoolMgr.h │ │ │ ├── WinINetSyncHttpClient.h │ │ │ └── WinSyncHttpClient.h │ │ ├── internal │ │ └── AWSHttpResourceClient.h │ │ ├── monitoring │ │ ├── CoreMetrics.h │ │ ├── DefaultMonitoring.h │ │ ├── HttpClientMetrics.h │ │ ├── MonitoringFactory.h │ │ ├── MonitoringInterface.h │ │ └── MonitoringManager.h │ │ ├── net │ │ ├── Net.h │ │ └── SimpleUDP.h │ │ ├── platform │ │ ├── Android.h │ │ ├── Environment.h │ │ ├── FileSystem.h │ │ ├── OSVersionInfo.h │ │ ├── Platform.h │ │ ├── Security.h │ │ ├── Time.h │ │ └── refs │ │ │ └── IXmlHttpRequest2Ref.h │ │ └── utils │ │ ├── ARN.h │ │ ├── Array.h │ │ ├── Cache.h │ │ ├── ConcurrentCache.h │ │ ├── DNS.h │ │ ├── DateTime.h │ │ ├── EnumParseOverflowContainer.h │ │ ├── FileSystemUtils.h │ │ ├── GetTheLights.h │ │ ├── HashingUtils.h │ │ ├── Outcome.h │ │ ├── ResourceManager.h │ │ ├── StringUtils.h │ │ ├── UUID.h │ │ ├── UnreferencedParam.h │ │ ├── base64 │ │ └── Base64.h │ │ ├── crypto │ │ ├── Cipher.h │ │ ├── ContentCryptoMaterial.h │ │ ├── ContentCryptoScheme.h │ │ ├── CryptoBuf.h │ │ ├── CryptoStream.h │ │ ├── EncryptionMaterials.h │ │ ├── Factories.h │ │ ├── HMAC.h │ │ ├── Hash.h │ │ ├── HashResult.h │ │ ├── KeyWrapAlgorithm.h │ │ ├── MD5.h │ │ ├── SecureRandom.h │ │ ├── Sha256.h │ │ ├── Sha256HMAC.h │ │ ├── bcrypt │ │ │ └── CryptoImpl.h │ │ ├── commoncrypto │ │ │ └── CryptoImpl.h │ │ └── openssl │ │ │ └── CryptoImpl.h │ │ ├── event │ │ ├── EventDecoderStream.h │ │ ├── EventEncoderStream.h │ │ ├── EventHeader.h │ │ ├── EventMessage.h │ │ ├── EventStream.h │ │ ├── EventStreamBuf.h │ │ ├── EventStreamDecoder.h │ │ ├── EventStreamEncoder.h │ │ ├── EventStreamErrors.h │ │ └── EventStreamHandler.h │ │ ├── json │ │ └── JsonSerializer.h │ │ ├── logging │ │ ├── AWSLogging.h │ │ ├── ConsoleLogSystem.h │ │ ├── DefaultLogSystem.h │ │ ├── FormattedLogSystem.h │ │ ├── LogLevel.h │ │ ├── LogMacros.h │ │ ├── LogSystemInterface.h │ │ ├── NullLogSystem.h │ │ └── android │ │ │ └── LogcatLogSystem.h │ │ ├── memory │ │ ├── AWSMemory.h │ │ ├── MemorySystemInterface.h │ │ └── stl │ │ │ ├── AWSAllocator.h │ │ │ ├── AWSDeque.h │ │ │ ├── AWSList.h │ │ │ ├── AWSMap.h │ │ │ ├── AWSMultiMap.h │ │ │ ├── AWSQueue.h │ │ │ ├── AWSSet.h │ │ │ ├── AWSStack.h │ │ │ ├── AWSStreamFwd.h │ │ │ ├── AWSString.h │ │ │ ├── AWSStringStream.h │ │ │ ├── AWSVector.h │ │ │ └── SimpleStringStream.h │ │ ├── ratelimiter │ │ ├── DefaultRateLimiter.h │ │ └── RateLimiterInterface.h │ │ ├── stream │ │ ├── ConcurrentStreamBuf.h │ │ ├── PreallocatedStreamBuf.h │ │ ├── ResponseStream.h │ │ └── SimpleStreamBuf.h │ │ ├── threading │ │ ├── Executor.h │ │ ├── ReaderWriterLock.h │ │ ├── Semaphore.h │ │ └── ThreadTask.h │ │ └── xml │ │ └── XmlSerializer.h ├── libs │ ├── aws-cpp-sdk-core.exp │ └── aws-cpp-sdk-core.lib ├── offsets.h └── xor.h └── README.md /Driver/driver.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30406.217 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "driver", "driver\driver.vcxproj", "{B733A66A-C850-41F9-B262-5D16B9877834}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|ARM = Debug|ARM 11 | Debug|ARM64 = Debug|ARM64 12 | Debug|x64 = Debug|x64 13 | Debug|x86 = Debug|x86 14 | Release|ARM = Release|ARM 15 | Release|ARM64 = Release|ARM64 16 | Release|x64 = Release|x64 17 | Release|x86 = Release|x86 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {B733A66A-C850-41F9-B262-5D16B9877834}.Debug|ARM.ActiveCfg = Debug|ARM 21 | {B733A66A-C850-41F9-B262-5D16B9877834}.Debug|ARM.Build.0 = Debug|ARM 22 | {B733A66A-C850-41F9-B262-5D16B9877834}.Debug|ARM.Deploy.0 = Debug|ARM 23 | {B733A66A-C850-41F9-B262-5D16B9877834}.Debug|ARM64.ActiveCfg = Debug|ARM64 24 | {B733A66A-C850-41F9-B262-5D16B9877834}.Debug|ARM64.Build.0 = Debug|ARM64 25 | {B733A66A-C850-41F9-B262-5D16B9877834}.Debug|ARM64.Deploy.0 = Debug|ARM64 26 | {B733A66A-C850-41F9-B262-5D16B9877834}.Debug|x64.ActiveCfg = Debug|x64 27 | {B733A66A-C850-41F9-B262-5D16B9877834}.Debug|x64.Build.0 = Debug|x64 28 | {B733A66A-C850-41F9-B262-5D16B9877834}.Debug|x64.Deploy.0 = Debug|x64 29 | {B733A66A-C850-41F9-B262-5D16B9877834}.Debug|x86.ActiveCfg = Debug|Win32 30 | {B733A66A-C850-41F9-B262-5D16B9877834}.Debug|x86.Build.0 = Debug|Win32 31 | {B733A66A-C850-41F9-B262-5D16B9877834}.Debug|x86.Deploy.0 = Debug|Win32 32 | {B733A66A-C850-41F9-B262-5D16B9877834}.Release|ARM.ActiveCfg = Release|ARM 33 | {B733A66A-C850-41F9-B262-5D16B9877834}.Release|ARM.Build.0 = Release|ARM 34 | {B733A66A-C850-41F9-B262-5D16B9877834}.Release|ARM.Deploy.0 = Release|ARM 35 | {B733A66A-C850-41F9-B262-5D16B9877834}.Release|ARM64.ActiveCfg = Release|ARM64 36 | {B733A66A-C850-41F9-B262-5D16B9877834}.Release|ARM64.Build.0 = Release|ARM64 37 | {B733A66A-C850-41F9-B262-5D16B9877834}.Release|ARM64.Deploy.0 = Release|ARM64 38 | {B733A66A-C850-41F9-B262-5D16B9877834}.Release|x64.ActiveCfg = Release|x64 39 | {B733A66A-C850-41F9-B262-5D16B9877834}.Release|x64.Build.0 = Release|x64 40 | {B733A66A-C850-41F9-B262-5D16B9877834}.Release|x64.Deploy.0 = Release|x64 41 | {B733A66A-C850-41F9-B262-5D16B9877834}.Release|x86.ActiveCfg = Release|Win32 42 | {B733A66A-C850-41F9-B262-5D16B9877834}.Release|x86.Build.0 = Release|Win32 43 | {B733A66A-C850-41F9-B262-5D16B9877834}.Release|x86.Deploy.0 = Release|Win32 44 | EndGlobalSection 45 | GlobalSection(SolutionProperties) = preSolution 46 | HideSolutionNode = FALSE 47 | EndGlobalSection 48 | GlobalSection(ExtensibilityGlobals) = postSolution 49 | SolutionGuid = {F5D0D578-8073-42C4-9249-F31F2C0A326B} 50 | EndGlobalSection 51 | EndGlobal 52 | -------------------------------------------------------------------------------- /Driver/driver/driver.inf: -------------------------------------------------------------------------------- 1 | ; 2 | ; driver.inf 3 | ; 4 | 5 | [Version] 6 | Signature="$WINDOWS NT$" 7 | Class=Sample ; TODO: edit Class 8 | ClassGuid={78A1C341-4539-11d3-B88D-00C04FAD5171} ; TODO: edit ClassGuid 9 | Provider=%ManufacturerName% 10 | CatalogFile=driver.cat 11 | DriverVer= ; TODO: set DriverVer in stampinf property pages 12 | PnpLockDown=1 13 | 14 | [DestinationDirs] 15 | DefaultDestDir = 12 16 | driver_Device_CoInstaller_CopyFiles = 11 17 | 18 | ; ================= Class section ===================== 19 | 20 | [ClassInstall32] 21 | Addreg=SampleClassReg 22 | 23 | [SampleClassReg] 24 | HKR,,,0,%ClassName% 25 | HKR,,Icon,,-5 26 | 27 | [SourceDisksNames] 28 | 1 = %DiskName%,,,"" 29 | 30 | [SourceDisksFiles] 31 | driver.sys = 1,, 32 | WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll=1 ; make sure the number matches with SourceDisksNames 33 | 34 | ;***************************************** 35 | ; Install Section 36 | ;***************************************** 37 | 38 | [Manufacturer] 39 | %ManufacturerName%=Standard,NT$ARCH$ 40 | 41 | [Standard.NT$ARCH$] 42 | %driver.DeviceDesc%=driver_Device, Root\driver ; TODO: edit hw-id 43 | 44 | [driver_Device.NT] 45 | CopyFiles=Drivers_Dir 46 | 47 | [Drivers_Dir] 48 | driver.sys 49 | 50 | ;-------------- Service installation 51 | [driver_Device.NT.Services] 52 | AddService = driver,%SPSVCINST_ASSOCSERVICE%, driver_Service_Inst 53 | 54 | ; -------------- driver driver install sections 55 | [driver_Service_Inst] 56 | DisplayName = %driver.SVCDESC% 57 | ServiceType = 1 ; SERVICE_KERNEL_DRIVER 58 | StartType = 3 ; SERVICE_DEMAND_START 59 | ErrorControl = 1 ; SERVICE_ERROR_NORMAL 60 | ServiceBinary = %12%\driver.sys 61 | 62 | ; 63 | ;--- driver_Device Coinstaller installation ------ 64 | ; 65 | 66 | [driver_Device.NT.CoInstallers] 67 | AddReg=driver_Device_CoInstaller_AddReg 68 | CopyFiles=driver_Device_CoInstaller_CopyFiles 69 | 70 | [driver_Device_CoInstaller_AddReg] 71 | HKR,,CoInstallers32,0x00010000, "WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll,WdfCoInstaller" 72 | 73 | [driver_Device_CoInstaller_CopyFiles] 74 | WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll 75 | 76 | [driver_Device.NT.Wdf] 77 | KmdfService = driver, driver_wdfsect 78 | [driver_wdfsect] 79 | KmdfLibraryVersion = $KMDFVERSION$ 80 | 81 | [Strings] 82 | SPSVCINST_ASSOCSERVICE= 0x00000002 83 | ManufacturerName="Google" ;TODO: Replace with your manufacturer name 84 | ClassName="drivers" ; TODO: edit ClassName 85 | DiskName = "driver Installation Disk" 86 | driver.DeviceDesc = "driver Device" 87 | driver.SVCDESC = "driver Service" 88 | -------------------------------------------------------------------------------- /Driver/driver/driver.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {8E41214B-6785-4CFE-B992-037D68949A14} 18 | inf;inv;inx;mof;mc; 19 | 20 | 21 | 22 | 23 | Driver Files 24 | 25 | 26 | 27 | 28 | Source Files 29 | 30 | 31 | -------------------------------------------------------------------------------- /Driver/driver/driver.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /KBot.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.31005.135 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KBot", "KBot\KBot.vcxproj", "{C9476949-18A2-4E38-B140-4C753852B657}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {C9476949-18A2-4E38-B140-4C753852B657}.Debug|x64.ActiveCfg = Debug|x64 17 | {C9476949-18A2-4E38-B140-4C753852B657}.Debug|x64.Build.0 = Debug|x64 18 | {C9476949-18A2-4E38-B140-4C753852B657}.Debug|x86.ActiveCfg = Debug|Win32 19 | {C9476949-18A2-4E38-B140-4C753852B657}.Debug|x86.Build.0 = Debug|Win32 20 | {C9476949-18A2-4E38-B140-4C753852B657}.Release|x64.ActiveCfg = Release|x64 21 | {C9476949-18A2-4E38-B140-4C753852B657}.Release|x64.Build.0 = Release|x64 22 | {C9476949-18A2-4E38-B140-4C753852B657}.Release|x86.ActiveCfg = Release|Win32 23 | {C9476949-18A2-4E38-B140-4C753852B657}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {D302D86B-907D-446E-AEA4-A3FCF73E0A3F} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /KBot/AiManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _AIMANAGER_H_ 4 | #define _AIMANAGER_H_ 5 | 6 | #include "KInterface.h" 7 | #include "offsets.h" 8 | 9 | class AiManager 10 | { 11 | public: 12 | 13 | bool IsMoving() 14 | { 15 | return Memory.Read((DWORD)this + Offsets::oAiManagerIsMoving, sizeof(bool)); 16 | } 17 | 18 | Vector3 GetTargetPos() 19 | { 20 | return Vector3(Memory.Read((DWORD)this + Offsets::oAiManagerTargetPos, sizeof(float)), 21 | Memory.Read((DWORD)this + Offsets::oAiManagerTargetPos + 0x4, sizeof(float)), 22 | Memory.Read((DWORD)this + Offsets::oAiManagerTargetPos + 0x8, sizeof(float))); 23 | } 24 | 25 | Vector3 GetServerPos() 26 | { 27 | return Vector3(Memory.Read((DWORD)this + Offsets::oAiManagerServerPos, sizeof(float)), 28 | Memory.Read((DWORD)this + Offsets::oAiManagerServerPos + 0x4, sizeof(float)), 29 | Memory.Read((DWORD)this + Offsets::oAiManagerServerPos + 0x8, sizeof(float))); 30 | } 31 | 32 | Vector3 GetNavBegin() 33 | { 34 | return Vector3(Memory.Read((DWORD)this + Offsets::oAiManagerNavBegin, sizeof(float)), 35 | Memory.Read((DWORD)this + Offsets::oAiManagerNavBegin + 0x4, sizeof(float)), 36 | Memory.Read((DWORD)this + Offsets::oAiManagerNavBegin + 0x8, sizeof(float))); 37 | } 38 | 39 | Vector3 GetNavEnd() 40 | { 41 | return Vector3(Memory.Read((DWORD)this + Offsets::oAiManagerNavEnd, sizeof(float)), 42 | Memory.Read((DWORD)this + Offsets::oAiManagerNavEnd + 0x4, sizeof(float)), 43 | Memory.Read((DWORD)this + Offsets::oAiManagerNavEnd + 0x8, sizeof(float))); 44 | } 45 | 46 | Vector3 GetVelocity() 47 | { 48 | return Memory.Read((DWORD)this + Offsets::oAiManagerVelocity); 49 | } 50 | 51 | int GetPassedWaypoints() 52 | { 53 | return Memory.Read((DWORD)this + Offsets::oAiManagerPassedWaypoints, sizeof(int)); 54 | } 55 | 56 | bool IsDashing() 57 | { 58 | return Memory.Read((DWORD)this + Offsets::oAiManagerIsDashing, sizeof(bool)); 59 | } 60 | 61 | float GetDashSpeed() 62 | { 63 | return Memory.Read((DWORD)this + Offsets::oAiManagerDashSpeed, sizeof(float)); 64 | } 65 | }; 66 | 67 | #endif // !_AIMANAGER_H_ 68 | -------------------------------------------------------------------------------- /KBot/CMissileClient.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _CMISSILECLIENT_H_ 4 | #define _CMISSILECLIENT_H_ 5 | 6 | #include "CObjectManager.h" 7 | #include "CSpellInfo.h" 8 | 9 | class CMissileClient : public CObject 10 | { 11 | private: 12 | DWORD base = 0; 13 | DWORD dwSpellInfo = 0; 14 | 15 | Vector3 startPos, endPos; 16 | public: 17 | 18 | SpellInfo* spellInfo = GameData::UnknownSpell; 19 | 20 | CMissileClient() 21 | :base{ 0 } 22 | { 23 | CObject::base = 0; 24 | std::string temp = utils->ToLower(GetSpellInfo()->GetName()); 25 | spellInfo = GameData::GetSpellInfoByName(temp); 26 | } 27 | CMissileClient(DWORD addy) 28 | :base{ addy } 29 | { 30 | CObject::base = addy; 31 | std::string temp = utils->ToLower(GetSpellInfo()->GetName()); 32 | spellInfo = GameData::GetSpellInfoByName(temp); 33 | } 34 | DWORD Address() const 35 | { 36 | return base; 37 | } 38 | 39 | Vector3 GetMissileStartPos() 40 | { 41 | if (startPos.IsZero()) 42 | { 43 | startPos = Vector3(Memory.Read(base + Offsets::oMissileStartPos, sizeof(float)), 44 | Memory.Read(base + Offsets::oMissileStartPos + 0x4, sizeof(float)), 45 | Memory.Read(base + Offsets::oMissileStartPos + 0x8, sizeof(float))); 46 | //startPos.y += spellInfo->height; 47 | } 48 | return startPos; 49 | } 50 | 51 | Vector3 GetMissileEndPos() 52 | { 53 | if (endPos.IsZero()) 54 | { 55 | endPos = Vector3(Memory.Read(base + Offsets::oMissileEndPos, sizeof(float)), 56 | Memory.Read(base + Offsets::oMissileEndPos + 0x4, sizeof(float)), 57 | Memory.Read(base + Offsets::oMissileEndPos + 0x8, sizeof(float))); 58 | //endPos.y += spellInfo->height; 59 | } 60 | return endPos; 61 | } 62 | 63 | short GetMissileSourceIndex() 64 | { 65 | return Memory.Read(base + Offsets::oMissileSourceIndex, sizeof(short)); 66 | } 67 | 68 | CObject GetSource() 69 | { 70 | return CObjectManager::GetObjByIndex(GetMissileSourceIndex()); 71 | } 72 | 73 | short GetMissileTargetIndex() 74 | { 75 | return Memory.Read(base + Offsets::oMissileTargetIndex, sizeof(short)); 76 | } 77 | 78 | CObject GetTarget() 79 | { 80 | return CObjectManager::GetObjByIndex(GetMissileTargetIndex()); 81 | } 82 | 83 | CSpellInfo* GetSpellInfo() 84 | { 85 | if (!dwSpellInfo) 86 | { 87 | dwSpellInfo = Memory.Read(base + Offsets::oMissileSpellInfo); 88 | } 89 | if (!dwSpellInfo) 90 | return 0; 91 | return (CSpellInfo*)(dwSpellInfo); 92 | } 93 | 94 | bool HasSpellFlags(SpellFlags flags) const 95 | { 96 | return (spellInfo->flags & flags) == flags; 97 | } 98 | 99 | //void SetObjConsts() 100 | //{ 101 | // std::string temp = utils->ToLower(champ); 102 | // spellInfo = GameData::GetSpellInfoByName(temp); 103 | // // Some spells require their end position to be projected using the range of the spell 104 | // if (spellInfo != GameData::UnknownSpell && HasSpellFlags(ProjectedDestination)) { 105 | // startPos.y += spellInfo->height; 106 | 107 | // // Calculate direction vector and normalize 108 | // endPos = Vector3(endPos.x - startPos.x, 0, endPos.z - startPos.z); 109 | // endPos = endPos.Normalized(); 110 | 111 | // // Update endposition using the height of the current position 112 | // endPos.x = endPos.x * spellInfo->castRange + startPos.x; 113 | // endPos.y = startPos.y; 114 | // endPos.z = endPos.z * spellInfo->castRange + startPos.z; 115 | // } 116 | //} 117 | }; 118 | 119 | #endif // !_CMISSILECLIENT_H_ 120 | -------------------------------------------------------------------------------- /KBot/CSpellData.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _SPELLDATA_H_ 4 | #define _SPELLDATA_H_ 5 | 6 | #include "Kinterface.h" 7 | #include "offsets.h" 8 | 9 | class CSpellData 10 | { 11 | private: 12 | //todo using base instead of (DWORD)this 13 | DWORD base = 0; 14 | public: 15 | CSpellData() 16 | :base{ 0 } 17 | { 18 | } 19 | CSpellData(DWORD addr) 20 | :base{ addr } 21 | { 22 | } 23 | 24 | float GetRange() 25 | { 26 | return Memory.Read((DWORD)this + Offsets::oSpellDataRange); 27 | } 28 | 29 | float GetWidth() 30 | { 31 | return Memory.Read((DWORD)this + Offsets::oSpellDataWidth); 32 | } 33 | 34 | float GetSpeed() 35 | { 36 | return Memory.Read((DWORD)this + Offsets::oSpellDataSpeed); 37 | } 38 | 39 | float GetCastRadius() 40 | { 41 | return Memory.Read((DWORD)this + Offsets::oSpellDataCastRadius); 42 | } 43 | 44 | float GetManaCostByLevel(unsigned int level) 45 | { 46 | if (level > 4) { 47 | return 0.f; 48 | } 49 | return Memory.Read((DWORD)this + Offsets::oSpellDataMana + ((level - 1) * 0x4)); 50 | } 51 | }; 52 | 53 | #endif // !_SPELLDATA_H_ 54 | -------------------------------------------------------------------------------- /KBot/CSpellEntry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _CSPELLENTRY_H_ 4 | #define _CSPELLENTRY_H_ 5 | 6 | #include "CObjectManager.h" 7 | #include "CSpellInfo.h" 8 | #include "SpellInfo.h" 9 | 10 | //good for non missiles(karthus q, xerath w), but doesn't detect end cast pos of charged spells(xerath q, varus q) 11 | //expect chargeable spells it's usable to almost everything with little bit of work 12 | //like calculating correct endpos from spell range and making a timer so the line doesn't disappear too fast 13 | //todo 14 | class CSpellEntry 15 | { 16 | private: 17 | DWORD base = 0; 18 | DWORD dwspellinfo = 0; 19 | public: 20 | 21 | SpellInfo* spellInfo = GameData::UnknownSpell; 22 | 23 | CSpellEntry() 24 | : base{ 0 } 25 | { 26 | std::string temp = utils->ToLower(GetSpellInfo()->GetName()).c_str(); 27 | spellInfo = GameData::GetSpellInfoByName(temp); 28 | } 29 | CSpellEntry(DWORD addr) 30 | : base{ addr } 31 | { 32 | std::string temp = utils->ToLower(GetSpellInfo()->GetName()).c_str(); 33 | spellInfo = GameData::GetSpellInfoByName(temp); 34 | } 35 | DWORD Address() const 36 | { 37 | return base; 38 | } 39 | 40 | int GetIndex() 41 | { 42 | return Memory.Read(base + Offsets::oSpellEntryIndex); 43 | } 44 | 45 | CSpellInfo* GetSpellInfo() 46 | { 47 | if (!dwspellinfo) 48 | { 49 | dwspellinfo = Memory.Read(base + Offsets::oSpellEntrySpellInfo); 50 | } 51 | if (!dwspellinfo) 52 | return 0; 53 | return (CSpellInfo*)(dwspellinfo); 54 | } 55 | 56 | Vector3 GetMissileStartPos() 57 | { 58 | Vector3 startPos = Vector3(Memory.Read(base + Offsets::oSpellEntryStartPos, sizeof(float)), 59 | Memory.Read(base + Offsets::oSpellEntryStartPos + 0x4, sizeof(float)), 60 | Memory.Read(base + Offsets::oSpellEntryStartPos + 0x8, sizeof(float))); 61 | //startPos.y += spellInfo->height; 62 | return startPos; 63 | } 64 | 65 | Vector3 GetMissileEndPos() 66 | { 67 | Vector3 startPos = Vector3(Memory.Read(base + Offsets::oSpellEntryEndPos, sizeof(float)), 68 | Memory.Read(base + Offsets::oSpellEntryEndPos + 0x4, sizeof(float)), 69 | Memory.Read(base + Offsets::oSpellEntryEndPos + 0x8, sizeof(float))); 70 | //startPos.y += spellInfo->height; 71 | return startPos; 72 | } 73 | 74 | int GetSlot() 75 | { 76 | return Memory.Read(base + Offsets::oSpellEntrySlot); 77 | } 78 | 79 | bool IsBasic() 80 | { 81 | return Memory.Read(base + Offsets::oSpellEntryIsBasicAttack); 82 | } 83 | 84 | float GetWindupTime() 85 | { 86 | return Memory.Read(base + Offsets::oSpellEntryWindupTime, sizeof(float)); 87 | } 88 | 89 | float GetCastStartTime() 90 | { 91 | return Memory.Read(base + Offsets::oSpellEntryCastStartTime, sizeof(float)); 92 | } 93 | 94 | bool HasSpellFlags(SpellFlags flags) const 95 | { 96 | return (spellInfo->flags & flags) == flags; 97 | } 98 | 99 | inline bool operator ! () const 100 | { 101 | if (base == 0) 102 | return true; 103 | return false; 104 | } 105 | }; 106 | 107 | #endif // !_CSPELLENTRY_H_ 108 | -------------------------------------------------------------------------------- /KBot/CSpellInfo.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _CSPELLCASTINFO_H_ 4 | #define _CSPELLCASTINFO_H_ 5 | 6 | #include "CSpellData.h" 7 | #include "SpellInfo.h" 8 | 9 | class CSpellInfo 10 | { 11 | private: 12 | DWORD base = 0; 13 | DWORD spelldata = 0; 14 | std::string name; 15 | 16 | public: 17 | 18 | CSpellInfo() 19 | :base{ 0 } 20 | { 21 | } 22 | CSpellInfo(DWORD addy) 23 | :base{ addy } 24 | { 25 | } 26 | //DWORD Address() const 27 | //{ 28 | // return base; 29 | //} 30 | 31 | std::string GetName() 32 | { 33 | return Memory.ReadString((DWORD)this + Offsets::oSpellInfoSpellName, true); 34 | } 35 | //crashes when i try write to var spelldata 36 | CSpellData* GetSpellData() 37 | { 38 | DWORD addr = Memory.Read((DWORD)this + Offsets::oSpellInfoSpellData); 39 | 40 | return (CSpellData*)(addr); 41 | } 42 | }; 43 | 44 | #endif // !_CSPELLCASTINFO_H_ 45 | -------------------------------------------------------------------------------- /KBot/CSpellSlot.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _CSPELLSLOT_H_ 4 | #define _CSPELLSLOT_H_ 5 | 6 | #include "CSpellInfo.h" 7 | #include "Menu.h" 8 | 9 | //todo reverse ["GetSpellState", FindFuncCall("E8 ? ? ? ? 8B F8 8B CB 89")], 10 | enum class SpellState : int 11 | { 12 | //Possible flags 13 | Ready = 0, 14 | NotAvailable = 4, 15 | Surpressed = 8, 16 | NotLearned = 12, 17 | Cooldown = 32, 18 | NoMana = 64, 19 | Unknown 20 | }; 21 | 22 | class CSpellSlot 23 | { 24 | private: 25 | DWORD base = 0; 26 | public: 27 | CSpellSlot() 28 | : base{ 0 } 29 | { 30 | } 31 | 32 | CSpellSlot(DWORD addr) 33 | : base{ addr } 34 | { 35 | } 36 | bool IsReady(float mana = 99999.f) 37 | { 38 | int level = this->GetLevel(); 39 | if ((level > 0) && (this->GetCooldownExpire() - M.fGameTime + 1 < 0) 40 | && this->GetSpellInfo()->GetSpellData()->GetManaCostByLevel(level) <= mana) 41 | return true; 42 | return false; 43 | } 44 | 45 | int GetLevel() 46 | { 47 | return Memory.Read((DWORD)this + Offsets::oSpellSlotLevel); 48 | } 49 | 50 | float GetCooldownExpire() 51 | { 52 | return Memory.Read((DWORD)this + Offsets::oSpellSlotCooldownExpire); 53 | } 54 | 55 | int GetRemainingCharge() 56 | { 57 | return Memory.Read((DWORD)this + Offsets::oSpellSlotRemainingCharge); 58 | } 59 | 60 | bool IsActive() 61 | { 62 | return Memory.Read((DWORD)this + Offsets::oSpellSlotIsActive); 63 | } 64 | 65 | float GetDamage() 66 | { 67 | return Memory.Read((DWORD)this + Offsets::oSpellSlotDamage); 68 | } 69 | 70 | CSpellInfo* GetSpellInfo() 71 | { 72 | DWORD addr = Memory.Read((DWORD)this + Offsets::oSpellSlotSpellInfo); 73 | 74 | return (CSpellInfo*)(addr); 75 | } 76 | }; 77 | 78 | #endif // !_CSPELLSLOT_H_ 79 | -------------------------------------------------------------------------------- /KBot/Config.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _CONFIG_H_ 4 | #define _CONFIG_H_ 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include "Menu.h" 11 | 12 | template< typename T > 13 | class ConfigValue 14 | { 15 | public: 16 | ConfigValue(std::string category_, std::string name_, T* value_) 17 | { 18 | category = category_; 19 | name = name_; 20 | value = value_; 21 | } 22 | 23 | std::string category, name; 24 | T* value; 25 | }; 26 | 27 | class CConfig 28 | { 29 | protected: 30 | std::vector< ConfigValue< int >* > ints; 31 | std::vector< ConfigValue< bool >* > bools; 32 | std::vector< ConfigValue< float >* > floats; 33 | private: 34 | void SetupValue(int&, int, std::string, std::string); 35 | void SetupValue(bool&, bool, std::string, std::string); 36 | void SetupValue(float&, float, std::string, std::string); 37 | 38 | public: 39 | CConfig() 40 | { 41 | Setup(); 42 | } 43 | ~CConfig() = default; 44 | 45 | //sets up initial values 46 | void Setup(); 47 | 48 | //saves config to fileName.ini 49 | void Save(std::string fileName); 50 | 51 | ////loads config from fileName.ini 52 | void Load(std::string fileName); 53 | }; 54 | 55 | extern CConfig* Config; 56 | 57 | #endif // !_CONFIG_H_ -------------------------------------------------------------------------------- /KBot/GameData.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _GAMEDATA_H_ 4 | #define _GAMEDATA_H_ 5 | 6 | #include 7 | #include "UnitInfo.h" 8 | #include "SpellInfo.h" 9 | 10 | class GameData 11 | { 12 | public: 13 | static bool Load(std::string& dataFolder); 14 | static UnitInfo* GetUnitInfoByName(std::string& name); 15 | static SpellInfo* GetSpellInfoByName(std::string& name); 16 | private: 17 | static void LoadUnitData(std::string& path); 18 | static void LoadSpellData(std::string& path); 19 | 20 | public: 21 | static UnitInfo* UnknownUnit; 22 | static SpellInfo* UnknownSpell; 23 | 24 | static std::map Units; 25 | static std::map Spells; 26 | }; 27 | 28 | #endif -------------------------------------------------------------------------------- /KBot/Initialize.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _INITIALIZE_H_ 4 | #define _INITIALIZE_H_ 5 | 6 | #include 7 | #include 8 | 9 | #include "CObjectManager.h" 10 | #include "CMissileClient.h" 11 | //#include "CSpellInfo.h" 12 | //#include "CSpellEntry.h" 13 | 14 | class Initialize 15 | { 16 | public: 17 | 18 | //std::listObjList; 19 | std::vectorherolist; 20 | std::vectorturretlist; 21 | std::vectorinhiblist; 22 | //std::vectorstructurelist; 23 | 24 | std::vectorobjlisttest; 25 | 26 | bool Start(); 27 | 28 | //logs useful info to console 29 | void StartupInfo(); 30 | 31 | //populates object lists 32 | void AddObjects(); 33 | 34 | void MakeHeroList(); 35 | void MakeTurretList(); 36 | void MakeInhibList(); 37 | //void MakeStructureList(); 38 | 39 | void MakeTestList(); 40 | 41 | void SetMinimapProperties(); 42 | 43 | void SetRendererProperties(); 44 | 45 | //makes array of champions in game for GUI scoreboard 46 | void CreateChampArray(); 47 | }; 48 | 49 | extern Initialize* init; 50 | 51 | #endif // ! _INITIALIZE_H_ -------------------------------------------------------------------------------- /KBot/KBot.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /KBot/Keyboard.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _KEYBOARD_H_ 4 | #define _KEYBOARD_H_ 5 | 6 | #include "Definitions.h" 7 | #include "Windows.h" 8 | #include 9 | #include 10 | 11 | class Keyboard 12 | { 13 | private: 14 | LARGE_INTEGER frequency, startCount, endCount; // for timer 15 | int pressTime = FAST_REACTION_TIME; //how long key is pressed in milliseconds 16 | 17 | public: 18 | 19 | Keyboard() 20 | { 21 | QueryPerformanceFrequency(&frequency); 22 | QueryPerformanceCounter(&startCount); 23 | } 24 | ~Keyboard() = default; 25 | 26 | //Sets press down time 27 | void SetDelay(int ms); 28 | 29 | //presses special key, e.g arrows, shift 30 | void SpecialKeyDown(int vk); 31 | 32 | //releases special key 33 | void SpecialKeyUp(int vk); 34 | 35 | //presses scan code key 36 | void ScancodeKeyDown(int vk); 37 | 38 | //releases scan code key 39 | void ScancodeKeyUp(int vk); 40 | 41 | //expects the key (as a capital letter), whether its held down, and whether to yield a capital letter. 42 | // example sending ('A',false,false) yields 'a' 43 | // to achieve 'A', send ('A',false,true) 44 | void GenerateKey(int vk, BOOL bExtended, bool shift = false); 45 | 46 | void GenerateKeyScancode(int vk, bool shift = false); 47 | 48 | //types given text 49 | void Type(std::string phrase); 50 | 51 | // 1 = left 52 | // 2 = right 53 | // 3 = up 54 | // 4 = down 55 | void Arrow(int arrow); 56 | 57 | //hits special key e.g shift, enter, arrows 58 | void HitSpecialKey(int vk); 59 | 60 | //types a given number & presses enter. 61 | void TypeNum(int number); 62 | 63 | //hits any single key 64 | void HitKey(int vk); 65 | 66 | double GetExecutionTime(); 67 | }; 68 | 69 | extern Keyboard* keyboard; 70 | 71 | #endif // !_KEYBOARD_H_ -------------------------------------------------------------------------------- /KBot/LoLAPI.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "API.h" 4 | #include 5 | 6 | class LoLAPI 7 | { 8 | private: 9 | 10 | public: 11 | static void LoadPlayerListData(); 12 | static API::PlayerList* UnknownPlayer; 13 | static std::map Players; 14 | static API::PlayerList* GetAPIPlayerByChampName(std::string& name); 15 | static API::GameStats GetGameStats(); 16 | static std::vector GetEvents(); 17 | static API::ActivePlayer GetActivePlayer(); 18 | static API::AllGameData GetAllGameData(); 19 | }; -------------------------------------------------------------------------------- /KBot/Lux.cpp: -------------------------------------------------------------------------------- 1 | #include "Lux.h" 2 | #include "DirectX.h" 3 | 4 | void Lux::OnKeyDown(int) 5 | { 6 | } 7 | 8 | void Lux::OnKeyUp(int) 9 | { 10 | } 11 | 12 | void Lux::Harass() 13 | { 14 | } 15 | 16 | bool Lux::Evade(Vector3 evadePos) 17 | { 18 | return false; 19 | } 20 | 21 | void Lux::Tick() 22 | { 23 | } 24 | 25 | void Lux::GUI() 26 | { 27 | } -------------------------------------------------------------------------------- /KBot/Lux.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _LUX_H 4 | #define _LUX_H 5 | 6 | #include "Script.h" 7 | 8 | class Lux : public IScript { 9 | private: 10 | Champion champion; 11 | 12 | virtual void OnKeyDown(int vKey); 13 | 14 | virtual void OnKeyUp(int vKey); 15 | 16 | virtual void Harass(); 17 | 18 | virtual bool Evade(Vector3 evadePos); 19 | 20 | virtual void Tick(); 21 | 22 | virtual void GUI(); 23 | 24 | public: 25 | Lux() : champion(Champion::Lux) 26 | { 27 | } 28 | }; 29 | 30 | #endif -------------------------------------------------------------------------------- /KBot/Menu.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _MENU_H_ 4 | #define _MENU_H_ 5 | 6 | #include "Definitions.h" 7 | 8 | struct Menu 9 | { 10 | Menu() 11 | {}; 12 | 13 | //globals 14 | bool bMenuOpen = 1; 15 | bool bConsoleOpen = 0; 16 | bool bDebug = 0; 17 | 18 | bool bExitBot = 0; 19 | 20 | float fGameTime = 0; 21 | DWORD dwStartTime = 0; 22 | DirectX::XMMATRIX Matrix; 23 | 24 | std::string sServerInfo; 25 | 26 | std::string sChampion; 27 | std::pair ScoreBoard[10]; //for GUI scoreboard 28 | 29 | //minimap 30 | float fMinimapPos[2] = { 1653.f,812.f }; 31 | float fMinimapSize[2] = { 257.f,257.f }; 32 | 33 | //renderer 34 | int nRendererWidth = 1920; 35 | int nRendererHeight = 1080; 36 | 37 | int nPatch = 0; 38 | 39 | struct 40 | { 41 | int AntiLag = 1; 42 | int MenuKey = VK_INSERT; 43 | }Misc; 44 | int Configs = 0; 45 | 46 | struct 47 | { 48 | bool Master = 0; 49 | bool Missile = 0; 50 | bool Draw = 0; 51 | bool LimitRange = 0; 52 | float LR = 2500.f; 53 | bool Smooth = false; 54 | int GP = 0; 55 | int DS = 0; 56 | int DC = 0; 57 | bool OnKey = false; 58 | int EvadeKey = VK_SPACE; 59 | bool MouseBack = true; 60 | bool Force = 1; 61 | }Evade; 62 | 63 | struct 64 | { 65 | bool Master = 0; 66 | int HoldKey = 0; 67 | }Orbwalker; 68 | 69 | struct 70 | { 71 | bool Master = 0; 72 | bool Local = 0; 73 | bool Turrets = 0; 74 | int Slider[2] = { 16,10 }; 75 | float Color[4] = { 255.0f / 255.0f, 85.0f / 255.0f, 50.0f / 255.0f, 255.0f / 255.0f }; 76 | float LocalColor[4] = { 83.0f / 255.0f, 85.0f / 255.0f, 251.0f / 255.0f, 255.0f / 255.0f }; 77 | }AARange; 78 | 79 | struct 80 | { 81 | bool Master = 0; 82 | float Thickness = 1.f; 83 | }Tracers; 84 | 85 | struct 86 | { 87 | bool Master = 0; 88 | //0-text on champ 1-img on champ 2-scoreboard 89 | bool Type[3]; 90 | bool ScoreboardWnd = 0; 91 | struct 92 | { 93 | bool ShowScoreboard = 0; 94 | int Pos[2] = { 985,280 }; //x,y 95 | bool Summs = 1; 96 | bool Ults = 1; 97 | bool Exp = 1; 98 | bool Items = 0; 99 | }Scoreboard; 100 | }Cooldowns; 101 | 102 | struct 103 | { 104 | bool Master = 0; 105 | float Color[4] = { 255.0f / 255.0f, 85.0f / 255.0f, 50.0f / 255.0f, 255.0f / 255.0f }; 106 | }LastHit; 107 | 108 | struct 109 | { 110 | bool Master = 0; 111 | }GankAlerter; 112 | 113 | struct 114 | { 115 | bool Master = 0; 116 | int Slot = 1; 117 | int Mode = 0; 118 | float MouseSpeed = 1.f; 119 | }AutoSmite; 120 | 121 | struct 122 | { 123 | bool Master = 0; 124 | }Wards; 125 | 126 | struct 127 | { 128 | bool Master = 0; 129 | }Inhibs; 130 | 131 | struct 132 | { 133 | bool MouseClicks = 0; 134 | }Enemies; 135 | 136 | struct 137 | { 138 | bool Master = 0; 139 | bool DmgCalc = 0; 140 | bool Jumps = 0; 141 | int JumpsKey = VK_LSHIFT; 142 | //0-drake 1-blue raptors 2-botlane 3-toplane 4-red raptors 143 | bool JumpsType[5]; 144 | }Talon; 145 | 146 | struct 147 | { 148 | bool DrawExecute = 0; 149 | }Pantheon; 150 | }; 151 | 152 | extern Menu M; 153 | 154 | #endif //!_MENU_H_ -------------------------------------------------------------------------------- /KBot/Orbwalker.cpp: -------------------------------------------------------------------------------- 1 | #include "Orbwalker.h" 2 | #include "DirectX.h" 3 | #include "Mouse.h" 4 | #include "Keyboard.h" 5 | 6 | Orbwalker::Orbwalker() 7 | { 8 | windupTime = Local.unitInfo->basicAttackWindup; 9 | missileTime = Local.unitInfo->basicAttackMissileSpeed / (Local.GetAARange() / 2); 10 | startPos = mouse->GetWorldPos(); 11 | } 12 | 13 | float Orbwalker::GetAttackDelay() 14 | { 15 | return (int)(1000.0f / Local.GetAS()); 16 | } 17 | 18 | bool Orbwalker::CanAttack() 19 | { 20 | return (lastAATick + GetAttackDelay() + (M.Evade.GP / 2)) < GetTickCount(); 21 | } 22 | 23 | float Orbwalker::GetWindupTime() 24 | { 25 | return (1 / Local.GetAS() * 1000) * windupTime; 26 | } 27 | 28 | bool Orbwalker::CanMove() 29 | { 30 | return lastTick < GetTickCount(); 31 | } 32 | 33 | void Orbwalker::Tick() 34 | { 35 | MyHeroPos = Local.GetPosition(); 36 | std::vectorcanAttack; 37 | 38 | // Get players in aa range 39 | for (auto& hero : init->herolist) 40 | { 41 | if (hero == Local || hero.IsDead() || !hero.IsVisible()) 42 | continue; 43 | if (hero.GetDistTo(Local) <= Local.GetBoundingRadius() + Local.GetAARange()) 44 | { 45 | canAttack.emplace_back(hero); 46 | } 47 | } 48 | // Sort so closest player is first 49 | if (canAttack.size() > 1) 50 | { 51 | std::sort(canAttack.begin(), canAttack.end(), [&](CObject& a, CObject& b) 52 | { 53 | return MyHeroPos.Distance(a.GetPosition()) < MyHeroPos.DistanceSquared(b.GetPosition()); 54 | }); 55 | } 56 | 57 | if (!PressedKey(M.Orbwalker.HoldKey)) 58 | return; 59 | 60 | if (Local.CheckState(CharacterState::CanAttack) && !canAttack.empty() && CanAttack()) 61 | { 62 | Vector3 pos = canAttack.front().GetPosition(); 63 | pos.y += 25; 64 | ImVec2 RealPos = Direct3D9.WorldToScreen(pos); 65 | ImVec2 OldPos = Direct3D9.WorldToScreen(startPos); 66 | if (RealPos.x != 0 && RealPos.y != 0) 67 | { 68 | mouse->MouseMoveInstant(RealPos.x, RealPos.y); 69 | mouse->RightClick(); 70 | //keyboard->GenerateKeyScancode(DIK_A); 71 | //mouse->LeftClick(); 72 | std::this_thread::sleep_for(std::chrono::milliseconds(5)); 73 | while (!mouse->MouseMoveInstant(OldPos.x, OldPos.y)) 74 | { 75 | } 76 | 77 | lastAATick = GetTickCount() - (int)(1000.f / missileTime) + 35; 78 | lastTick = GetTickCount() + GetWindupTime() + 35; 79 | } 80 | } 81 | else if (CanMove()) 82 | { 83 | startPos = mouse->GetWorldPos(); 84 | mouse->RightClick(); 85 | lastTick = GetTickCount() + RandomInt(50, 80); 86 | } 87 | } -------------------------------------------------------------------------------- /KBot/Orbwalker.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "Vector.h" 4 | 5 | class Orbwalker 6 | { 7 | private: 8 | Vector3 MyHeroPos; 9 | DWORD lastTick = 0; 10 | DWORD lastAATick = 0; 11 | float windupTime; 12 | float missileTime; 13 | Vector3 startPos; 14 | 15 | public: 16 | Orbwalker(); 17 | 18 | ~Orbwalker() 19 | { 20 | } 21 | 22 | void Tick(); 23 | 24 | bool CanAttack(); 25 | 26 | float GetAttackDelay(); 27 | 28 | float GetWindupTime(); 29 | 30 | bool CanMove(); 31 | }; 32 | -------------------------------------------------------------------------------- /KBot/Pantheon.cpp: -------------------------------------------------------------------------------- 1 | #include "Pantheon.h" 2 | #include "DirectX.h" 3 | 4 | void Pantheon::OnKeyDown(int) 5 | { 6 | } 7 | 8 | void Pantheon::OnKeyUp(int) 9 | { 10 | } 11 | 12 | void Pantheon::Harass() 13 | { 14 | } 15 | 16 | bool Pantheon::Evade(Vector3 evadePos) 17 | { 18 | return false; 19 | } 20 | 21 | void Pantheon::Tick() 22 | { 23 | if (M.Pantheon.DrawExecute) 24 | { 25 | for (auto& hero : init->herolist) 26 | { 27 | if (hero.IsDead() || !hero.IsVisible() || (Local.GetTeam() == hero.GetTeam())) 28 | continue; 29 | ImVec2 p = Direct3D9.GetHpBarPos(hero); 30 | p.y -= 25; 31 | //-47 is start of hp bar +58 is end of hp bar, +12 is bottom height 32 | //hp bar is 105 pixels width, so 20% is at 21th pixel, -47+21 33 | draw->Line(ImVec2(p.x - 26, p.y), ImVec2(p.x - 26, p.y + 12), RGBA(200, 0, 255), 3.f); 34 | } 35 | /*for (auto minion : g_MinionList) 36 | { 37 | ImVec2 p = Direct3D9.GetHpBarPos(minion); 38 | draw->Line(ImVec2(p.x - 34, p.y),ImVec2(p.x + 32, p.y + 12), RGBA(200, 0, 255), 3.f); 39 | }*/ 40 | } 41 | } 42 | 43 | void Pantheon::GUI() 44 | { 45 | ImGui::Checkbox("Draw 20% hp threshold", &M.Pantheon.DrawExecute); 46 | } -------------------------------------------------------------------------------- /KBot/Pantheon.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _PANTHEON_H 4 | #define _PANTHEON_H 5 | 6 | #include "Script.h" 7 | 8 | class Pantheon : public IScript { 9 | private: 10 | Champion champion; 11 | 12 | virtual void OnKeyDown(int vKey); 13 | 14 | virtual void OnKeyUp(int vKey); 15 | 16 | virtual void Harass(); 17 | 18 | virtual bool Evade(Vector3 evadePos); 19 | 20 | virtual void Tick(); 21 | 22 | virtual void GUI(); 23 | 24 | public: 25 | Pantheon() : champion(Champion::Pantheon) 26 | { 27 | } 28 | }; 29 | 30 | #endif -------------------------------------------------------------------------------- /KBot/Script.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _SCRIPT_H_ 4 | 5 | #include "Vector.h" 6 | 7 | enum class Champion { 8 | Aatrox, 9 | Ahri, 10 | Akali, 11 | Alistar, 12 | Amumu, 13 | Anivia, 14 | Annie, 15 | Aphelios, 16 | Ashe, 17 | AurelionSol, 18 | Azir, 19 | Bard, 20 | Blitzcrank, 21 | Brand, 22 | Braum, 23 | Caitlyn, 24 | Camille, 25 | Cassiopeia, 26 | ChoGath, 27 | Corki, 28 | Darius, 29 | Diana, 30 | DrMundo, 31 | Draven, 32 | Ekko, 33 | Elise, 34 | Evelynn, 35 | Ezreal, 36 | Fiddlesticks, 37 | Fiora, 38 | Fizz, 39 | Galio, 40 | Gangplank, 41 | Garen, 42 | Gnar, 43 | Gragas, 44 | Graves, 45 | Hecarim, 46 | Heimerdinger, 47 | Illaoi, 48 | Irelia, 49 | Ivern, 50 | Janna, 51 | JarvanIV, 52 | Jax, 53 | Jayce, 54 | Jhin, 55 | Jinx, 56 | KaiSa, 57 | Kalista, 58 | Karma, 59 | Karthus, 60 | Kassadin, 61 | Katarina, 62 | Kayle, 63 | Kayn, 64 | Kennen, 65 | KhaZix, 66 | Kindred, 67 | Kled, 68 | KogMaw, 69 | LeBlanc, 70 | LeeSin, 71 | Leona, 72 | Lillia, 73 | Lissandra, 74 | Lucian, 75 | Lulu, 76 | Lux, 77 | Malphite, 78 | Malzahar, 79 | Maokai, 80 | MasterYi, 81 | MissFortune, 82 | Mordekaiser, 83 | Morgana, 84 | Nami, 85 | Nasus, 86 | Nautilus, 87 | Neeko, 88 | Nidalee, 89 | Nocturne, 90 | Olaf, 91 | Orianna, 92 | Ornn, 93 | Pantheon, 94 | Poppy, 95 | Pyke, 96 | Qiyana, 97 | Quinn, 98 | Rakan, 99 | Rammus, 100 | RekSai, 101 | Rell, 102 | Renekton, 103 | Rengar, 104 | Riven, 105 | Rumble, 106 | Ryze, 107 | Samira, 108 | Sejuani, 109 | Senna, 110 | Seraphine, 111 | Sett, 112 | Shaco, 113 | Shen, 114 | Shyvana, 115 | Singed, 116 | Sion, 117 | Sivir, 118 | Skarner, 119 | Sona, 120 | Soraka, 121 | Swain, 122 | Sylas, 123 | Syndra, 124 | TahmKench, 125 | Taliyah, 126 | Talon, 127 | Taric, 128 | Teemo, 129 | Thresh, 130 | Tristana, 131 | Trundle, 132 | Tryndamere, 133 | TwistedFate, 134 | Twitch, 135 | Udyr, 136 | Urgot, 137 | Varus, 138 | Vayne, 139 | Veigar, 140 | VelKoz, 141 | Vi, 142 | Viktor, 143 | Vladimir, 144 | Volibear, 145 | Warwick, 146 | Wukong, 147 | Xayah, 148 | Xerath, 149 | XinZhao, 150 | Yasuo, 151 | Yone, 152 | Yorick, 153 | Yuumi, 154 | Zac, 155 | Zed, 156 | Ziggs, 157 | Zilean, 158 | Zoe, 159 | Zyra 160 | }; 161 | 162 | class IScript 163 | { 164 | private: 165 | public: 166 | virtual ~IScript() {} 167 | virtual void OnKeyDown(int vKey) = 0; 168 | virtual void OnKeyUp(int vKey) = 0; 169 | virtual void Harass() = 0; 170 | virtual bool Evade(Vector3 evadePos) = 0; 171 | virtual void Tick() = 0; 172 | virtual void GUI() = 0; 173 | }; 174 | 175 | extern IScript* championScript; 176 | 177 | #endif // !_SCRIPT_H_ 178 | -------------------------------------------------------------------------------- /KBot/ScriptUtils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _SCRIPTUTILS_H_ 4 | 5 | #include 6 | 7 | #include "Talon.h" 8 | #include "Lux.h" 9 | #include "Xerath.h" 10 | #include "Pantheon.h" 11 | 12 | #include "Menu.h" 13 | 14 | class ScriptUtils { 15 | public: 16 | static IScript* GetScriptByChampionName(std::string championName) 17 | { 18 | if (championName == "Talon") 19 | { 20 | M.Talon.Master = true; 21 | return new Talon(); 22 | } 23 | else if (championName == "Lux") 24 | { 25 | return new Lux(); 26 | } 27 | else if (championName == "Xerath") 28 | { 29 | return new Xerath(); 30 | } 31 | else if (championName == "Pantheon") 32 | { 33 | return new Pantheon(); 34 | } 35 | 36 | return nullptr; 37 | } 38 | }; 39 | 40 | #endif // !_SCRIPTUTILS_H_ 41 | -------------------------------------------------------------------------------- /KBot/SpellInfo.cpp: -------------------------------------------------------------------------------- 1 | #include "SpellInfo.h" 2 | 3 | SpellInfo* SpellInfo::AddFlags(SpellFlags flags) 4 | { 5 | this->flags = (SpellFlags)(this->flags | flags); 6 | return this; 7 | } -------------------------------------------------------------------------------- /KBot/SpellInfo.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include "Definitions.h" 5 | 6 | /// Flags of a spell/missile (they are the same thing anyway) 7 | enum SpellFlags { 8 | // Flags from the game data files 9 | AffectAllyChampion = 1, 10 | AffectEnemyChampion = 1 << 1, 11 | AffectAllyLaneMinion = 1 << 2, 12 | AffectEnemyLaneMinion = 1 << 3, 13 | AffectAllyWard = 1 << 4, 14 | AffectEnemyWard = 1 << 5, 15 | AffectAllyTurret = 1 << 6, 16 | AffectEnemyTurret = 1 << 7, 17 | AffectAllyInhibs = 1 << 8, 18 | AffectEnemyInhibs = 1 << 9, 19 | AffectAllyNonLaneMinion = 1 << 10, 20 | AffectJungleMonster = 1 << 11, 21 | AffectEnemyNonLaneMinion = 1 << 12, 22 | AffectAlwaysSelf = 1 << 13, 23 | AffectNeverSelf = 1 << 14, 24 | 25 | // Custom flags set by us. These flags cant be unpacked from the game files (exception Targeted flag). 26 | ProjectedDestination = 1 << 22, 27 | 28 | AffectAllyMob = AffectAllyLaneMinion | AffectAllyNonLaneMinion, 29 | AffectEnemyMob = AffectEnemyLaneMinion | AffectEnemyNonLaneMinion | AffectJungleMonster, 30 | AffectAllyGeneric = AffectAllyMob | AffectAllyChampion, 31 | AffectEnemyGeneric = AffectEnemyMob | AffectEnemyChampion, 32 | }; 33 | 34 | enum SpellType 35 | { 36 | linear, 37 | polygon, 38 | circular, 39 | conic, 40 | rectangular, 41 | threeway, 42 | }; 43 | 44 | /// Static data of a spell that we load from disk 45 | class SpellInfo { 46 | public: 47 | SpellInfo* AddFlags(SpellFlags flags); 48 | public: 49 | // Values from game's data files 50 | std::string name; 51 | std::string icon; 52 | 53 | SpellFlags flags; 54 | float delay; 55 | float castRange; 56 | float castRadius; 57 | float width; 58 | float height; 59 | float speed; 60 | float travelTime; 61 | }; -------------------------------------------------------------------------------- /KBot/Talon.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _TALON_H 4 | #define _TALON_H 5 | 6 | #include "Script.h" 7 | 8 | class Talon : public IScript { 9 | private: 10 | Champion champion; 11 | 12 | virtual void OnKeyDown(int vKey); 13 | 14 | virtual void OnKeyUp(int vKey); 15 | 16 | virtual void Harass(); 17 | 18 | virtual bool Evade(Vector3 evadePos); 19 | 20 | virtual void Tick(); 21 | 22 | virtual void GUI(); 23 | 24 | public: 25 | Talon() : champion(Champion::Talon) 26 | { 27 | } 28 | }; 29 | 30 | #endif -------------------------------------------------------------------------------- /KBot/UnitInfo.cpp: -------------------------------------------------------------------------------- 1 | #include "UnitInfo.h" 2 | 3 | std::map UnitInfo::TagMapping = 4 | { 5 | {std::string("Unit_"), Unit_}, 6 | {std::string("Unit_Champion"), Unit_Champion}, 7 | {std::string("Unit_Champion_Clone"), Unit_Champion_Clone}, 8 | {std::string("Unit_IsolationNonImpacting"), Unit_IsolationNonImpacting}, 9 | {std::string("Unit_KingPoro"), Unit_KingPoro}, 10 | {std::string("Unit_Minion"), Unit_Minion}, 11 | {std::string("Unit_Minion_Lane"), Unit_Minion_Lane}, 12 | {std::string("Unit_Minion_Lane_Melee"), Unit_Minion_Lane_Melee}, 13 | {std::string("Unit_Minion_Lane_Ranged"), Unit_Minion_Lane_Ranged}, 14 | {std::string("Unit_Minion_Lane_Siege"), Unit_Minion_Lane_Siege}, 15 | {std::string("Unit_Minion_Lane_Super"), Unit_Minion_Lane_Super}, 16 | {std::string("Unit_Minion_Summon"), Unit_Minion_Summon}, 17 | {std::string("Unit_Minion_SummonName_game_character_displayname_ZyraSeed"), Unit_Minion_SummonName_game_character_displayname_ZyraSeed}, 18 | {std::string("Unit_Minion_Summon_Large"), Unit_Minion_Summon_Large}, 19 | {std::string("Unit_Monster"), Unit_Monster}, 20 | {std::string("Unit_Monster_Blue"), Unit_Monster_Blue}, 21 | {std::string("Unit_Monster_Buff"), Unit_Monster_Buff}, 22 | {std::string("Unit_Monster_Camp"), Unit_Monster_Camp}, 23 | {std::string("Unit_Monster_Crab"), Unit_Monster_Crab}, 24 | {std::string("Unit_Monster_Dragon"), Unit_Monster_Dragon}, 25 | {std::string("Unit_Monster_Epic"), Unit_Monster_Epic}, 26 | {std::string("Unit_Monster_Gromp"), Unit_Monster_Gromp}, 27 | {std::string("Unit_Monster_Krug"), Unit_Monster_Krug}, 28 | {std::string("Unit_Monster_Large"), Unit_Monster_Large}, 29 | {std::string("Unit_Monster_Medium"), Unit_Monster_Medium}, 30 | {std::string("Unit_Monster_Raptor"), Unit_Monster_Raptor}, 31 | {std::string("Unit_Monster_Red"), Unit_Monster_Red}, 32 | {std::string("Unit_Monster_Wolf"), Unit_Monster_Wolf}, 33 | {std::string("Unit_Plant"), Unit_Plant}, 34 | {std::string("Unit_Special"), Unit_Special}, 35 | {std::string("Unit_Special_AzirR"), Unit_Special_AzirR}, 36 | {std::string("Unit_Special_AzirW"), Unit_Special_AzirW}, 37 | {std::string("Unit_Special_CorkiBomb"), Unit_Special_CorkiBomb}, 38 | {std::string("Unit_Special_EpicMonsterIgnores"), Unit_Special_EpicMonsterIgnores}, 39 | {std::string("Unit_Special_KPMinion"), Unit_Special_KPMinion}, 40 | {std::string("Unit_Special_MonsterIgnores"), Unit_Special_MonsterIgnores}, 41 | {std::string("Unit_Special_Peaceful"), Unit_Special_Peaceful}, 42 | {std::string("Unit_Special_SyndraSphere"), Unit_Special_SyndraSphere}, 43 | {std::string("Unit_Special_TeleportTarget"), Unit_Special_TeleportTarget}, 44 | {std::string("Unit_Special_Trap"), Unit_Special_Trap}, 45 | {std::string("Unit_Special_Tunnel"), Unit_Special_Tunnel}, 46 | {std::string("Unit_Special_TurretIgnores"), Unit_Special_TurretIgnores}, 47 | {std::string("Unit_Special_UntargetableBySpells"), Unit_Special_UntargetableBySpells}, 48 | {std::string("Unit_Special_Void"), Unit_Special_Void}, 49 | {std::string("Unit_Special_YorickW"), Unit_Special_YorickW}, 50 | {std::string("Unit_Structure"), Unit_Structure}, 51 | {std::string("Unit_Structure_Inhibitor"), Unit_Structure_Inhibitor}, 52 | {std::string("Unit_Structure_Nexus"), Unit_Structure_Nexus}, 53 | {std::string("Unit_Structure_Turret"), Unit_Structure_Turret}, 54 | {std::string("Unit_Structure_Turret_Inhib"), Unit_Structure_Turret_Inhib}, 55 | {std::string("Unit_Structure_Turret_Inner"), Unit_Structure_Turret_Inner}, 56 | {std::string("Unit_Structure_Turret_Nexus"), Unit_Structure_Turret_Nexus}, 57 | {std::string("Unit_Structure_Turret_Outer"), Unit_Structure_Turret_Outer}, 58 | {std::string("Unit_Structure_Turret_Shrine"), Unit_Structure_Turret_Shrine}, 59 | {std::string("Unit_Ward"), Unit_Ward}, 60 | }; 61 | 62 | void UnitInfo::SetTag(const char* tagStr) 63 | { 64 | tags.set(TagMapping[std::string(tagStr)]); 65 | } -------------------------------------------------------------------------------- /KBot/UnitInfo.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _UNITINFO_H_ 4 | #define _UNITINFO_H_ 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | enum UnitTag 12 | { 13 | Unit_ = 1, 14 | Unit_Champion = 2, 15 | Unit_Champion_Clone = 3, 16 | Unit_IsolationNonImpacting = 4, 17 | Unit_KingPoro = 5, 18 | Unit_Minion = 6, 19 | Unit_Minion_Lane = 7, 20 | Unit_Minion_Lane_Melee = 8, 21 | Unit_Minion_Lane_Ranged = 9, 22 | Unit_Minion_Lane_Siege = 10, 23 | Unit_Minion_Lane_Super = 11, 24 | Unit_Minion_Summon = 12, 25 | Unit_Minion_SummonName_game_character_displayname_ZyraSeed = 13, 26 | Unit_Minion_Summon_Large = 14, 27 | Unit_Monster = 15, 28 | Unit_Monster_Blue = 16, 29 | Unit_Monster_Buff = 17, 30 | Unit_Monster_Camp = 18, 31 | Unit_Monster_Crab = 19, 32 | Unit_Monster_Dragon = 20, 33 | Unit_Monster_Epic = 21, 34 | Unit_Monster_Gromp = 22, 35 | Unit_Monster_Krug = 23, 36 | Unit_Monster_Large = 24, 37 | Unit_Monster_Medium = 25, 38 | Unit_Monster_Raptor = 26, 39 | Unit_Monster_Red = 27, 40 | Unit_Monster_Wolf = 28, 41 | Unit_Plant = 29, 42 | Unit_Special = 30, 43 | Unit_Special_AzirR = 31, 44 | Unit_Special_AzirW = 32, 45 | Unit_Special_CorkiBomb = 33, 46 | Unit_Special_EpicMonsterIgnores = 34, 47 | Unit_Special_KPMinion = 35, 48 | Unit_Special_MonsterIgnores = 36, 49 | Unit_Special_Peaceful = 37, 50 | Unit_Special_SyndraSphere = 38, 51 | Unit_Special_TeleportTarget = 39, 52 | Unit_Special_Trap = 40, 53 | Unit_Special_Tunnel = 41, 54 | Unit_Special_TurretIgnores = 42, 55 | Unit_Special_UntargetableBySpells = 43, 56 | Unit_Special_Void = 44, 57 | Unit_Special_YorickW = 45, 58 | Unit_Structure = 46, 59 | Unit_Structure_Inhibitor = 47, 60 | Unit_Structure_Nexus = 48, 61 | Unit_Structure_Turret = 49, 62 | Unit_Structure_Turret_Inhib = 50, 63 | Unit_Structure_Turret_Inner = 51, 64 | Unit_Structure_Turret_Nexus = 52, 65 | Unit_Structure_Turret_Outer = 53, 66 | Unit_Structure_Turret_Shrine = 54, 67 | Unit_Ward = 55, 68 | }; 69 | 70 | /// Static data for game units 71 | struct UnitInfo 72 | { 73 | public: 74 | std::string name; 75 | float healthBarHeight; 76 | float baseMovementSpeed; 77 | float baseAttackRange; 78 | float baseAttackSpeed; 79 | float attackSpeedRatio; 80 | 81 | float acquisitionRange; 82 | float selectionRadius; 83 | float pathRadius; 84 | float gameplayRadius; 85 | 86 | float basicAttackMissileSpeed; 87 | float basicAttackWindup; 88 | 89 | std::bitset<128> tags; 90 | 91 | public: 92 | void SetTag(const char* tagStr); 93 | private: 94 | static std::map TagMapping; 95 | }; 96 | 97 | #endif -------------------------------------------------------------------------------- /KBot/Utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _UTILS_H_ 4 | #define _UTILS_H_ 5 | 6 | #include "Definitions.h" 7 | #include "Pixel.h" 8 | #include 9 | 10 | //URLDownloadToFileA 11 | #include 12 | #pragma comment(lib, "urlmon.lib") 13 | 14 | class Utils 15 | { 16 | private: 17 | 18 | public: 19 | 20 | Utils() 21 | { 22 | } 23 | 24 | ~Utils() = default; 25 | 26 | //returns an Area struct including a box of radius R around x and y 27 | Area areaBox(int x, int y, int r); 28 | 29 | //Overload 30 | Area areaBox(POINT p, int r); 31 | 32 | //returns an Area struct including a box with differing heights and widths around x and y 33 | Area areaBox(int x, int y, int height, int width); 34 | 35 | //returns an Area struct including a box with differing heights and widths around x and y 36 | Area areaBox(POINT p, int height, int width); 37 | 38 | //Given three pixels, checks the environment to see if those pixels are where they should be 39 | bool CheckLocation(Pixel pix1, Pixel pix2, Pixel pix3); 40 | 41 | //returns an Area struct with screen size 42 | Area GetDesktopArea() const; 43 | 44 | //returns an Area struct with foreground window size 45 | Area GetForegroundWindowArea() const; 46 | 47 | //converts whole string to lowercase 48 | std::string ToLower(std::string str); 49 | std::wstring ToLower(std::wstring str); 50 | 51 | //converts whole string to uppercase 52 | std::string ToUpper(std::string str); 53 | 54 | //check if strA contains strB 55 | bool StringContains(std::string strA, std::string strB, bool ignore_case = false); 56 | bool StringContains(std::wstring strA, std::wstring strB, bool ignore_case = false); 57 | 58 | //string to wstring 59 | std::wstring StringToWstring(std::string str); 60 | 61 | std::string WstringToString(std::wstring wstr); 62 | 63 | std::string RandomString(int size); 64 | 65 | std::string FormatString(const char* c, const char* args...); 66 | 67 | void CopyToClipboard(std::string text); 68 | 69 | bool DownloadFile(std::string fileName, std::string directory = "Data", std::string url = "https://raw.githubusercontent.com/y3541599/test/main/"); 70 | 71 | bool ContainsOnlyASCII(std::string buff); 72 | 73 | //bool IsLeagueForeGround() 74 | //{ 75 | // HWND handle = GetForegroundWindow(); 76 | // DWORD pid; 77 | // GetWindowThreadProcessId(handle, &pid); 78 | // if (Memory.Process() != pid) 79 | // { 80 | // // CloseHandle(handle); 81 | // return false; 82 | // } 83 | // //CloseHandle(handle); 84 | // return true; 85 | //} 86 | //bool IsScriptForeGround() 87 | //{ 88 | // HWND handle = GetForegroundWindow(); 89 | // DWORD pid; 90 | // GetWindowThreadProcessId(handle, &pid); 91 | // if (GetCurrentProcessId() != pid) 92 | // { 93 | // // CloseHandle(handle); 94 | // return false; 95 | // } 96 | // //CloseHandle(handle); 97 | // return true; 98 | //} 99 | }; 100 | 101 | extern Utils* utils; 102 | 103 | #endif 104 | -------------------------------------------------------------------------------- /KBot/Vector.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _Vector3_H 4 | #define _Vector3_H 5 | 6 | #include 7 | #include 8 | 9 | #ifndef M_PI 10 | #define M_PI 3.14159265358979323846f 11 | #define M_PI_F (float)M_PI 12 | #endif 13 | 14 | struct ProjectionInfo; 15 | struct IntersectionResult; 16 | 17 | struct Vector4 18 | { 19 | float x, y, z, w; 20 | Vector4() { x = y = z = w = 0.0f; } 21 | Vector4(float _x, float _y, float _z, float _w) { x = _x; y = _y; z = _z; w = _w; } 22 | }; 23 | 24 | class Vector3 25 | { 26 | public: 27 | float x, y, z; 28 | 29 | Vector3(); 30 | Vector3(float x, float y, float z = 0); 31 | Vector3(float xyz); 32 | 33 | ~Vector3(); 34 | 35 | bool IsValid() const; 36 | 37 | bool operator==(Vector3 const& other) const; 38 | bool operator!=(Vector3 const& other) const; 39 | bool IsZero(float tolerance = 0.01f) const; 40 | 41 | Vector3& operator*=(const Vector3& v); 42 | Vector3& operator*=(float s); 43 | 44 | Vector3& operator/=(const Vector3& v); 45 | Vector3& operator/=(float s); 46 | 47 | Vector3& operator+=(const Vector3& v); 48 | Vector3& operator+=(float fl); 49 | 50 | Vector3& operator-=(const Vector3& v); 51 | Vector3& operator-=(float fl); 52 | 53 | Vector3 operator-(const Vector3& v) const; 54 | Vector3 operator-(float mod) const; 55 | Vector3 operator+(const Vector3& v) const; 56 | Vector3 operator+(float mod) const; 57 | 58 | Vector3 operator/(const Vector3& v) const; 59 | Vector3 operator/(float mod) const; 60 | Vector3 operator*(const Vector3& v) const; 61 | Vector3 operator*(float mod) const; 62 | 63 | Vector3& operator=(const Vector3& v); 64 | 65 | Vector3& SwitchYZ(); 66 | Vector3& Negate(); 67 | 68 | float Length() const; 69 | float LengthSquared() const; 70 | 71 | Vector3 Normalized() const; 72 | float NormalizeInPlace() const; 73 | 74 | float Distance(Vector3 const& to) const; 75 | float Distance(Vector3 const& segment_start, Vector3 const& segment_end, bool only_if_on_segment = false, bool squared = false) const; 76 | float DistanceSquared(Vector3 const& to) const; 77 | 78 | float DotProduct(Vector3 const& other) const; 79 | float CrossProduct(Vector3 const& other) const; 80 | float Polar() const; 81 | float AngleBetween(Vector3 const& other) const; 82 | 83 | bool Close(float a, float b, float eps) const; 84 | 85 | Vector3 Rotated(float angle) const; 86 | Vector3 Perpendicular() const; 87 | Vector3 Perpendicular2() const; 88 | Vector3 Extend(Vector3 const& to, float distance) const; 89 | 90 | Vector3 Append(Vector3 pos1, Vector3 pos2, float dist) const; 91 | 92 | ProjectionInfo ProjectOn(Vector3 const& segment_start, Vector3 const& segment_end) const; 93 | IntersectionResult Intersection(Vector3 const& line_segment_end, Vector3 const& line_segment2_start, Vector3 const& line_segment2_end) const; 94 | 95 | Vector3 Scale(float s) 96 | { 97 | return Vector3(x * s, y * s, z * s); 98 | } 99 | 100 | Vector3 Rotate(Vector3 startPos, float theta) 101 | { 102 | float dx = this->x - startPos.x; 103 | float dz = this->z - startPos.z; 104 | 105 | float px = dx * cos(theta) - dz * sin(theta); 106 | float pz = dx * sin(theta) + dz * cos(theta); 107 | return { px + startPos.x, this->y, pz + startPos.z }; 108 | } 109 | }; 110 | 111 | struct ProjectionInfo 112 | { 113 | bool IsOnSegment; 114 | Vector3 LinePoint; 115 | Vector3 SegmentPoint; 116 | 117 | ProjectionInfo(bool is_on_segment, Vector3 const& segment_point, Vector3 const& line_point); 118 | }; 119 | 120 | struct IntersectionResult 121 | { 122 | bool Intersects; 123 | Vector3 Point; 124 | 125 | IntersectionResult(bool intersects = false, Vector3 const& point = Vector3()); 126 | }; 127 | 128 | #endif // !_Vector3_H 129 | -------------------------------------------------------------------------------- /KBot/Visuals.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _VISUALS_H_ 4 | #define _VISUALS_H_ 5 | 6 | #include "Draw.h" 7 | 8 | class Visuals 9 | { 10 | private: 11 | //std::string getSpellImg(std::string name); 12 | //LPDIRECT3DTEXTURE9 GetSpellImg(std::string name); 13 | 14 | public: 15 | 16 | void CooldownTimers(CObject obj); 17 | 18 | void ScoreBoard(CObject obj); 19 | 20 | void DrawAARanges(CObject obj, int points, float thickness, RGBA color, bool local, RGBA localcolor, bool turret); 21 | 22 | void DrawTracers(CObject obj, float thickness); 23 | 24 | void AutoSmite(CObject obj, int slot, int mode, float mouseSpeed); 25 | 26 | void LastHit(CObject obj, RGBA color); 27 | 28 | void InhibTimers(CObject obj); 29 | 30 | void WardsRange(CObject obj); 31 | 32 | void GankAlerter(CObject obj); 33 | 34 | void TalonDamageCalc(CObject obj); 35 | }; 36 | 37 | #endif // ! _VISUALS_H_ 38 | -------------------------------------------------------------------------------- /KBot/Xerath.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _XERATH_H 4 | #define _XERATH_H 5 | 6 | #include "Script.h" 7 | #include 8 | 9 | class Xerath : public IScript { 10 | private: 11 | Champion champion; 12 | 13 | virtual void OnKeyDown(int vKey); 14 | 15 | virtual void OnKeyUp(int vKey); 16 | 17 | virtual void Harass(); 18 | 19 | virtual bool Evade(Vector3 evadePos); 20 | 21 | virtual void Tick(); 22 | 23 | virtual void GUI(); 24 | 25 | public: 26 | 27 | bool chargeQ = false; 28 | DWORD qTick; 29 | float qRange = 0; 30 | 31 | Xerath() : champion(Champion::Xerath) 32 | { 33 | } 34 | }; 35 | 36 | #endif -------------------------------------------------------------------------------- /KBot/aws-c-common.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KebsCS/KBot/d512106467167f679b8718ff02b25aae1bb2a085/KBot/aws-c-common.dll -------------------------------------------------------------------------------- /KBot/aws-c-event-stream.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KebsCS/KBot/d512106467167f679b8718ff02b25aae1bb2a085/KBot/aws-c-event-stream.dll -------------------------------------------------------------------------------- /KBot/aws-checksums.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KebsCS/KBot/d512106467167f679b8718ff02b25aae1bb2a085/KBot/aws-checksums.dll -------------------------------------------------------------------------------- /KBot/aws-cpp-sdk-core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KebsCS/KBot/d512106467167f679b8718ff02b25aae1bb2a085/KBot/aws-cpp-sdk-core.dll -------------------------------------------------------------------------------- /KBot/imgui_impl_dx11.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer Backend for DirectX11 2 | // This needs to be used along with a Platform Backend (e.g. Win32) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID! 6 | // [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices. 7 | 8 | // You can copy and use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 9 | // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp. 10 | // Read online: https://github.com/ocornut/imgui/tree/master/docs 11 | 12 | #pragma once 13 | #include "imgui.h" // IMGUI_IMPL_API 14 | 15 | struct ID3D11Device; 16 | struct ID3D11DeviceContext; 17 | 18 | IMGUI_IMPL_API bool ImGui_ImplDX11_Init(ID3D11Device* device, ID3D11DeviceContext* device_context); 19 | IMGUI_IMPL_API void ImGui_ImplDX11_Shutdown(); 20 | IMGUI_IMPL_API void ImGui_ImplDX11_NewFrame(); 21 | IMGUI_IMPL_API void ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data); 22 | 23 | // Use if you want to reset your rendering device without losing Dear ImGui state. 24 | IMGUI_IMPL_API void ImGui_ImplDX11_InvalidateDeviceObjects(); 25 | IMGUI_IMPL_API bool ImGui_ImplDX11_CreateDeviceObjects(); 26 | -------------------------------------------------------------------------------- /KBot/imgui_impl_win32.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Platform Backend for Windows (standard windows API for 32 and 64 bits applications) 2 | // This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..) 3 | 4 | // Implemented features: 5 | // [X] Platform: Clipboard support (for Win32 this is actually part of core dear imgui) 6 | // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. 7 | // [X] Platform: Keyboard arrays indexed using VK_* Virtual Key Codes, e.g. ImGui::IsKeyPressed(VK_SPACE). 8 | // [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'. 9 | 10 | // You can copy and use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 11 | // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp. 12 | // Read online: https://github.com/ocornut/imgui/tree/master/docs 13 | 14 | #pragma once 15 | #include "imgui.h" // IMGUI_IMPL_API 16 | 17 | IMGUI_IMPL_API bool ImGui_ImplWin32_Init(void* hwnd); 18 | IMGUI_IMPL_API void ImGui_ImplWin32_Shutdown(); 19 | IMGUI_IMPL_API void ImGui_ImplWin32_NewFrame(); 20 | 21 | // Configuration 22 | // - Disable gamepad support or linking with xinput.lib 23 | #define IMGUI_IMPL_WIN32_DISABLE_GAMEPAD 24 | #define IMGUI_IMPL_WIN32_DISABLE_LINKING_XINPUT 25 | 26 | // Win32 message handler your application need to call. 27 | // - Intentionally commented out in a '#if 0' block to avoid dragging dependencies on from this helper. 28 | // - You should COPY the line below into your .cpp code to forward declare the function and then you can call it. 29 | #if 0 30 | extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); 31 | #endif 32 | 33 | // DPI-related helpers (optional) 34 | // - Use to enable DPI awareness without having to create an application manifest. 35 | // - Your own app may already do this via a manifest or explicit calls. This is mostly useful for our examples/ apps. 36 | // - In theory we could call simple functions from Windows SDK such as SetProcessDPIAware(), SetProcessDpiAwareness(), etc. 37 | // but most of the functions provided by Microsoft require Windows 8.1/10+ SDK at compile time and Windows 8/10+ at runtime, 38 | // neither we want to require the user to have. So we dynamically select and load those functions to avoid dependencies. 39 | //IMGUI_IMPL_API void ImGui_ImplWin32_EnableDpiAwareness(); 40 | //IMGUI_IMPL_API float ImGui_ImplWin32_GetDpiScaleForHwnd(void* hwnd); // HWND hwnd 41 | //IMGUI_IMPL_API float ImGui_ImplWin32_GetDpiScaleForMonitor(void* monitor); // HMONITOR monitor 42 | -------------------------------------------------------------------------------- /KBot/include/aws/core/AmazonSerializableWebServiceRequest.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | namespace Aws 16 | { 17 | static const char JSON_CONTENT_TYPE[] = "application/json"; 18 | static const char AMZN_JSON_CONTENT_TYPE_1_0[] = "application/x-amz-json-1.0"; 19 | static const char AMZN_JSON_CONTENT_TYPE_1_1[] = "application/x-amz-json-1.1"; 20 | static const char FORM_CONTENT_TYPE[] = "application/x-www-form-urlencoded"; 21 | static const char AMZN_XML_CONTENT_TYPE[] = "application/xml"; 22 | static const char AMZN_EVENTSTREAM_CONTENT_TYPE[] = "application/vnd.amazon.eventstream"; 23 | 24 | /** 25 | * High-level abstraction over AWS requests. GetBody() calls SerializePayload() and uses a stringbuf under the hood. 26 | * This is for payloads such as query, xml, or json 27 | */ 28 | class AWS_CORE_API AmazonSerializableWebServiceRequest : public AmazonWebServiceRequest 29 | { 30 | public: 31 | AmazonSerializableWebServiceRequest() 32 | { 33 | //prevent unreferenced var warnings 34 | //for these values. 35 | AWS_UNREFERENCED_PARAM(JSON_CONTENT_TYPE); 36 | AWS_UNREFERENCED_PARAM(AMZN_JSON_CONTENT_TYPE_1_0); 37 | AWS_UNREFERENCED_PARAM(AMZN_JSON_CONTENT_TYPE_1_1); 38 | AWS_UNREFERENCED_PARAM(FORM_CONTENT_TYPE); 39 | AWS_UNREFERENCED_PARAM(AMZN_XML_CONTENT_TYPE); 40 | } 41 | 42 | virtual ~AmazonSerializableWebServiceRequest() {} 43 | 44 | /** 45 | * Convert payload into String. 46 | */ 47 | virtual Aws::String SerializePayload() const = 0; 48 | 49 | /** 50 | * Loads serialized payload into string buf and returns the stream 51 | */ 52 | std::shared_ptr GetBody() const override; 53 | }; 54 | 55 | } // namespace Aws 56 | 57 | -------------------------------------------------------------------------------- /KBot/include/aws/core/AmazonStreamingWebServiceRequest.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | namespace Aws 18 | { 19 | static const char* DEFAULT_CONTENT_TYPE = "binary/octet-stream"; 20 | 21 | /** 22 | * High-level abstraction over AWS requests that don't have well formed payloads. GetBody() uses an underlying stream that has been set by a call to SetBody() 23 | * Also supports request specific headers such as in rest protocols. 24 | */ 25 | class AWS_CORE_API AmazonStreamingWebServiceRequest : public AmazonWebServiceRequest 26 | { 27 | public: 28 | /** 29 | * Initializes members to defaults 30 | */ 31 | AmazonStreamingWebServiceRequest() : m_contentType(DEFAULT_CONTENT_TYPE) 32 | { 33 | } 34 | 35 | virtual ~AmazonStreamingWebServiceRequest(); 36 | 37 | /** 38 | * Get the user set stream 39 | */ 40 | inline std::shared_ptr GetBody() const override { return m_bodyStream; } 41 | /** 42 | * Set the body stream to use for the request. 43 | */ 44 | inline void SetBody(const std::shared_ptr& body) { m_bodyStream = body; } 45 | /** 46 | * Gets all headers that will be needed in the request. Calls GetRequestSpecificHeaders(), which is the chance for subclasses to add 47 | * headers from their modeled data. 48 | */ 49 | inline Aws::Http::HeaderValueCollection GetHeaders() const override 50 | { 51 | auto headers = GetRequestSpecificHeaders(); 52 | headers.insert(Aws::Http::HeaderValuePair(Aws::Http::CONTENT_TYPE_HEADER, GetContentType())); 53 | 54 | return headers; 55 | } 56 | 57 | /** 58 | * AmazonStreamingWebServiceRequest always returns true. 59 | */ 60 | bool IsStreaming() const override { return true; } 61 | 62 | /** 63 | * Get the user set contentType. Defaults to binary/octet-stream 64 | */ 65 | const Aws::String& GetContentType() const { return m_contentType; } 66 | /** 67 | * Set the content type. 68 | */ 69 | void SetContentType(const Aws::String& contentType) { m_contentType = contentType; } 70 | 71 | protected: 72 | /** 73 | * Override this method to put data members from a subclass into the headers collection. 74 | */ 75 | virtual Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const { return Aws::Http::HeaderValueCollection(); }; 76 | 77 | private: 78 | std::shared_ptr m_bodyStream; 79 | Aws::String m_contentType; 80 | }; 81 | 82 | } // namespace Aws 83 | 84 | -------------------------------------------------------------------------------- /KBot/include/aws/core/AmazonWebServiceResult.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | namespace Aws 13 | { 14 | /** 15 | * Container for web response to an AWS Request. 16 | */ 17 | template 18 | class AmazonWebServiceResult 19 | { 20 | public: 21 | AmazonWebServiceResult() : m_responseCode(Http::HttpResponseCode::REQUEST_NOT_MADE) {} 22 | 23 | /** 24 | * Sets payload, header collection and a response code. 25 | */ 26 | AmazonWebServiceResult(const PAYLOAD_TYPE& payload, const Http::HeaderValueCollection& headers, Http::HttpResponseCode responseCode = Http::HttpResponseCode::OK) : 27 | m_payload(payload), 28 | m_responseHeaders(headers), 29 | m_responseCode(responseCode) 30 | {} 31 | 32 | /** 33 | * Sets payload, header collection and a response code, but transfers ownership of payload and headers (for move only operations). 34 | */ 35 | AmazonWebServiceResult(PAYLOAD_TYPE&& payload, Http::HeaderValueCollection&& headers, Http::HttpResponseCode responseCode = Http::HttpResponseCode::OK) : 36 | m_payload(std::forward(payload)), 37 | m_responseHeaders(std::forward(headers)), 38 | m_responseCode(responseCode) 39 | {} 40 | 41 | AmazonWebServiceResult(const AmazonWebServiceResult& result) : 42 | m_payload(result.m_payload), 43 | m_responseHeaders(result.m_responseHeaders), 44 | m_responseCode(result.m_responseCode) 45 | {} 46 | 47 | AmazonWebServiceResult(AmazonWebServiceResult&& result) : 48 | m_payload(std::move(result.m_payload)), 49 | m_responseHeaders(std::move(result.m_responseHeaders)), 50 | m_responseCode(result.m_responseCode) 51 | {} 52 | 53 | /** 54 | * Get the payload from the response 55 | */ 56 | inline const PAYLOAD_TYPE& GetPayload() const { return m_payload; } 57 | /** 58 | * Get the payload from the response and take ownership of it. 59 | */ 60 | inline PAYLOAD_TYPE TakeOwnershipOfPayload() { return std::move(m_payload); } 61 | /** 62 | * Get the headers from the response 63 | */ 64 | inline const Http::HeaderValueCollection& GetHeaderValueCollection() const { return m_responseHeaders; } 65 | /** 66 | * Get the http response code from the response 67 | */ 68 | inline Http::HttpResponseCode GetResponseCode() const { return m_responseCode; } 69 | 70 | private: 71 | PAYLOAD_TYPE m_payload; 72 | Http::HeaderValueCollection m_responseHeaders; 73 | Http::HttpResponseCode m_responseCode; 74 | }; 75 | 76 | 77 | } 78 | -------------------------------------------------------------------------------- /KBot/include/aws/core/Globals.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | namespace Aws 11 | { 12 | namespace Utils 13 | { 14 | class EnumParseOverflowContainer; 15 | } 16 | /** 17 | * This is used to handle the Enum round tripping problem 18 | * for when a service updates their enumerations, but the user does not 19 | * have an up to date client. This container will be initialized during Aws::InitAPI 20 | * and will be cleaned on Aws::ShutdownAPI. 21 | */ 22 | AWS_CORE_API Utils::EnumParseOverflowContainer* GetEnumOverflowContainer(); 23 | 24 | /** 25 | * Initializes a global overflow container to a new instance. 26 | * This should only be called once from within Aws::InitAPI 27 | */ 28 | void InitializeEnumOverflowContainer(); 29 | 30 | /** 31 | * Destroys the global overflow container instance. 32 | * This should only be called once from within Aws::ShutdownAPI 33 | */ 34 | void CleanupEnumOverflowContainer(); 35 | } 36 | -------------------------------------------------------------------------------- /KBot/include/aws/core/NoResult.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | namespace Aws 11 | { 12 | namespace Utils 13 | { 14 | namespace Xml 15 | { 16 | class XmlDocument; 17 | } 18 | namespace Json 19 | { 20 | class JsonValue; 21 | } 22 | } // namespace Utils 23 | 24 | class AWS_CORE_API NoResult 25 | { 26 | public: 27 | NoResult() {}; 28 | NoResult(const Aws::AmazonWebServiceResult&) {}; 29 | NoResult(const Aws::AmazonWebServiceResult&) {}; 30 | }; 31 | 32 | } // namespace Aws 33 | -------------------------------------------------------------------------------- /KBot/include/aws/core/Region.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | 12 | namespace Aws 13 | { 14 | /** 15 | * AWS Regions 16 | */ 17 | namespace Region 18 | { 19 | // AWS_GLOBAL is a pseudo region that can be used to tell SDK to use the service global endpoint if there is any. 20 | // You can specify this region to corresponding environment variable, config file item and in your code. 21 | // For services without global region, the request will be directed to us-east-1 22 | static const char AWS_GLOBAL[] = "aws-global"; 23 | static const char US_EAST_1[] = "us-east-1"; 24 | static const char US_EAST_2[] = "us-east-2"; 25 | static const char US_WEST_1[] = "us-west-1"; 26 | static const char US_WEST_2[] = "us-west-2"; 27 | static const char AF_SOUTH_1[] = "af-south-1"; 28 | static const char EU_WEST_1[] = "eu-west-1"; 29 | static const char EU_WEST_2[] = "eu-west-2"; 30 | static const char EU_WEST_3[] = "eu-west-3"; 31 | static const char EU_CENTRAL_1[] = "eu-central-1"; 32 | static const char EU_NORTH_1[] = "eu-north-1"; 33 | static const char AP_EAST_1[] = "ap-east-1"; 34 | static const char AP_SOUTH_1[] = "ap-south-1"; 35 | static const char AP_SOUTHEAST_1[] = "ap-southeast-1"; 36 | static const char AP_SOUTHEAST_2[] = "ap-southeast-2"; 37 | static const char AP_NORTHEAST_1[] = "ap-northeast-1"; 38 | static const char AP_NORTHEAST_2[] = "ap-northeast-2"; 39 | static const char AP_NORTHEAST_3[] = "ap-northeast-3"; 40 | static const char SA_EAST_1[] = "sa-east-1"; 41 | static const char CA_CENTRAL_1[] = "ca-central-1"; 42 | static const char CN_NORTH_1[] = "cn-north-1"; 43 | static const char CN_NORTHWEST_1[] = "cn-northwest-1"; 44 | static const char ME_SOUTH_1[] = "me-south-1"; 45 | static const char US_GOV_WEST_1[] = "us-gov-west-1"; 46 | static const char US_GOV_EAST_1[] = "us-gov-east-1"; 47 | 48 | // If a pseudo region, for example, aws-global or us-east-1-fips is provided, it should be converted to the region name used for signing. 49 | Aws::String AWS_CORE_API ComputeSignerRegion(const Aws::String& region); 50 | } 51 | 52 | } // namespace Aws 53 | 54 | -------------------------------------------------------------------------------- /KBot/include/aws/core/SDKConfig.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #define USE_AWS_MEMORY_MANAGEMENT 7 | 8 | -------------------------------------------------------------------------------- /KBot/include/aws/core/SDKConfig.h.in: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #cmakedefine USE_AWS_MEMORY_MANAGEMENT 7 | 8 | -------------------------------------------------------------------------------- /KBot/include/aws/core/Version.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #include 7 | #include 8 | 9 | namespace Aws 10 | { 11 | namespace Version 12 | { 13 | AWS_CORE_API const char* GetVersionString(); 14 | AWS_CORE_API unsigned GetVersionMajor(); 15 | AWS_CORE_API unsigned GetVersionMinor(); 16 | AWS_CORE_API unsigned GetVersionPatch(); 17 | AWS_CORE_API const char* GetCompilerVersionString(); 18 | } //namespace Version 19 | } //namespace Aws 20 | -------------------------------------------------------------------------------- /KBot/include/aws/core/VersionConfig.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #define AWS_SDK_VERSION_STRING "1.8.128" 7 | -------------------------------------------------------------------------------- /KBot/include/aws/core/VersionConfig.h.in: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #define AWS_SDK_VERSION_STRING "@AWSSDK_VERSION_STRING@" 7 | -------------------------------------------------------------------------------- /KBot/include/aws/core/auth/AWSAuthSignerProvider.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | 7 | #pragma once 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | 15 | namespace Aws 16 | { 17 | namespace Client 18 | { 19 | class AWSAuthSigner; 20 | } 21 | namespace Auth 22 | { 23 | class AWSCredentialsProvider; 24 | 25 | class AWS_CORE_API AWSAuthSignerProvider 26 | { 27 | public: 28 | virtual std::shared_ptr GetSigner(const Aws::String& signerName) const = 0; 29 | virtual void AddSigner(std::shared_ptr& signer) = 0; 30 | virtual ~AWSAuthSignerProvider() = default; 31 | }; 32 | 33 | class AWS_CORE_API DefaultAuthSignerProvider : public AWSAuthSignerProvider 34 | { 35 | public: 36 | /** 37 | * Creates a Signature-V4 signer provider that supports the different implementations of Signature-V4 38 | * used for standard and event-stream requests. 39 | * 40 | * @param credentialsProvider A provider to retrieve the access/secret key used to derive the signing 41 | * @param serviceName The canonical name of the AWS service to be used in the signature 42 | * @param region The AWS region in which the requests will be made. 43 | */ 44 | DefaultAuthSignerProvider(const std::shared_ptr& credentialsProvider, 45 | const Aws::String& serviceName, const Aws::String& region); 46 | explicit DefaultAuthSignerProvider(const std::shared_ptr& signer); 47 | void AddSigner(std::shared_ptr& signer) override; 48 | std::shared_ptr GetSigner(const Aws::String& signerName) const override; 49 | private: 50 | Aws::Vector> m_signers; 51 | }; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /KBot/include/aws/core/auth/AWSCredentialsProviderChain.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | namespace Aws 14 | { 15 | namespace Auth 16 | { 17 | /** 18 | * Abstract class for providing chains of credentials providers. When a credentials provider in the chain returns empty credentials, 19 | * We go on to the next provider until we have either exhausted the installed providers in the chain or something returns non-empty credentials. 20 | */ 21 | class AWS_CORE_API AWSCredentialsProviderChain : public AWSCredentialsProvider 22 | { 23 | public: 24 | virtual ~AWSCredentialsProviderChain() = default; 25 | 26 | /** 27 | * When a credentials provider in the chain returns empty credentials, 28 | * We go on to the next provider until we have either exhausted the installed providers in the chain or something returns non-empty credentials. 29 | */ 30 | virtual AWSCredentials GetAWSCredentials(); 31 | 32 | /** 33 | * Gets all providers stored in this chain. 34 | */ 35 | const Aws::Vector>& GetProviders() { return m_providerChain; } 36 | 37 | protected: 38 | /** 39 | * This class is only allowed to be initialized by subclasses. 40 | */ 41 | AWSCredentialsProviderChain() = default; 42 | 43 | /** 44 | * Adds a provider to the back of the chain. 45 | */ 46 | void AddProvider(const std::shared_ptr& provider) { m_providerChain.push_back(provider); } 47 | 48 | 49 | private: 50 | Aws::Vector > m_providerChain; 51 | }; 52 | 53 | /** 54 | * Creates an AWSCredentialsProviderChain which uses in order EnvironmentAWSCredentialsProvider, ProfileConfigFileAWSCredentialsProvider, 55 | * and InstanceProfileCredentialsProvider. 56 | */ 57 | class AWS_CORE_API DefaultAWSCredentialsProviderChain : public AWSCredentialsProviderChain 58 | { 59 | public: 60 | /** 61 | * Initializes the provider chain with EnvironmentAWSCredentialsProvider, ProfileConfigFileAWSCredentialsProvider, 62 | * and InstanceProfileCredentialsProvider in that order. 63 | */ 64 | DefaultAWSCredentialsProviderChain(); 65 | }; 66 | 67 | } // namespace Auth 68 | } // namespace Aws 69 | -------------------------------------------------------------------------------- /KBot/include/aws/core/auth/STSCredentialsProvider.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | 7 | #pragma once 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | namespace Aws 17 | { 18 | namespace Auth 19 | { 20 | /** 21 | * To support retrieving credentials of STS AssumeRole with web identity. 22 | * Note that STS accepts request with protocol of queryxml. Calling GetAWSCredentials() will trigger (if expired) 23 | * a query request using AWSHttpResourceClient under the hood. 24 | */ 25 | class AWS_CORE_API STSAssumeRoleWebIdentityCredentialsProvider : public AWSCredentialsProvider 26 | { 27 | public: 28 | STSAssumeRoleWebIdentityCredentialsProvider(); 29 | 30 | /** 31 | * Retrieves the credentials if found, otherwise returns empty credential set. 32 | */ 33 | AWSCredentials GetAWSCredentials() override; 34 | 35 | protected: 36 | void Reload() override; 37 | 38 | private: 39 | void RefreshIfExpired(); 40 | Aws::String CalculateQueryString() const; 41 | 42 | Aws::UniquePtr m_client; 43 | Aws::Auth::AWSCredentials m_credentials; 44 | Aws::String m_roleArn; 45 | Aws::String m_tokenFile; 46 | Aws::String m_sessionName; 47 | Aws::String m_token; 48 | bool m_initialized; 49 | }; 50 | } // namespace Auth 51 | } // namespace Aws 52 | -------------------------------------------------------------------------------- /KBot/include/aws/core/client/AWSErrorMarshaller.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | 11 | namespace Aws 12 | { 13 | namespace Http 14 | { 15 | class HttpResponse; 16 | enum class HttpResponseCode; 17 | } 18 | 19 | namespace Utils 20 | { 21 | namespace Xml 22 | { 23 | class XmlDocument; 24 | } 25 | namespace Json 26 | { 27 | class JsonValue; 28 | } 29 | } 30 | 31 | namespace Client 32 | { 33 | enum class CoreErrors; 34 | 35 | template 36 | class AWSError; 37 | 38 | /** 39 | * Marshaller for core error types. 40 | */ 41 | class AWS_CORE_API AWSErrorMarshaller 42 | { 43 | public: 44 | virtual ~AWSErrorMarshaller() {} 45 | 46 | /** 47 | * Converts an exceptionName and message into an Error object, if it can be parsed. Otherwise, it returns 48 | * and AWSError with CoreErrors::UNKNOWN as the error type. 49 | */ 50 | virtual AWSError Marshall(const Aws::Http::HttpResponse& response) const = 0; 51 | /** 52 | * Attempts to finds an error code by the exception name. Otherwise returns CoreErrors::UNKNOWN as the error type. 53 | */ 54 | virtual AWSError FindErrorByName(const char* exceptionName) const; 55 | virtual AWSError FindErrorByHttpResponseCode(Aws::Http::HttpResponseCode code) const; 56 | /** 57 | * Attempts to extract region from error. 58 | */ 59 | virtual Aws::String ExtractRegion(const AWSError&) const { return {}; } 60 | /** 61 | * Attempts to extract endpoint from error. 62 | */ 63 | virtual Aws::String ExtractEndpoint(const AWSError&) const { return {}; } 64 | protected: 65 | AWSError Marshall(const Aws::String& exceptionName, const Aws::String& message) const; 66 | }; 67 | 68 | class AWS_CORE_API JsonErrorMarshaller : public AWSErrorMarshaller 69 | { 70 | using AWSErrorMarshaller::Marshall; 71 | public: 72 | /** 73 | * Converts an exceptionName and message into an Error object, if it can be parsed. Otherwise, it returns 74 | * and AWSError with CoreErrors::UNKNOWN as the error type. 75 | */ 76 | AWSError Marshall(const Aws::Http::HttpResponse& response) const override; 77 | 78 | protected: 79 | const Aws::Utils::Json::JsonValue& GetJsonPayloadFromError(const AWSError&) const; 80 | }; 81 | 82 | class AWS_CORE_API XmlErrorMarshaller : public AWSErrorMarshaller 83 | { 84 | using AWSErrorMarshaller::Marshall; 85 | public: 86 | /** 87 | * Converts an exceptionName and message into an Error object, if it can be parsed. Otherwise, it returns 88 | * and AWSError with CoreErrors::UNKNOWN as the error type. 89 | */ 90 | AWSError Marshall(const Aws::Http::HttpResponse& response) const override; 91 | 92 | protected: 93 | const Aws::Utils::Xml::XmlDocument& GetXmlPayloadFromError(const AWSError&) const; 94 | }; 95 | 96 | } // namespace Client 97 | } // namespace Aws 98 | -------------------------------------------------------------------------------- /KBot/include/aws/core/client/AsyncCallerContext.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | namespace Aws 11 | { 12 | namespace Client 13 | { 14 | /** 15 | * Call-back context for all async client methods. This allows you to pass a context to your callbacks so that you can identify your requests. 16 | * It is entirely intended that you override this class in-lieu of using a void* for the user context. The base class just gives you the ability to 17 | * pass a uuid for your context. 18 | */ 19 | class AWS_CORE_API AsyncCallerContext 20 | { 21 | public: 22 | /** 23 | * Initializes object with generated UUID 24 | */ 25 | AsyncCallerContext(); 26 | 27 | /** 28 | * Initializes object with UUID 29 | */ 30 | AsyncCallerContext(const Aws::String& uuid) : m_uuid(uuid) {} 31 | 32 | /** 33 | * Initializes object with UUID 34 | */ 35 | AsyncCallerContext(const char* uuid) : m_uuid(uuid) {} 36 | 37 | virtual ~AsyncCallerContext() {} 38 | 39 | /** 40 | * Gets underlying UUID 41 | */ 42 | inline const Aws::String& GetUUID() const { return m_uuid; } 43 | 44 | /** 45 | * Sets underlying UUID 46 | */ 47 | inline void SetUUID(const Aws::String& value) { m_uuid = value; } 48 | 49 | /** 50 | * Sets underlying UUID 51 | */ 52 | inline void SetUUID(const char* value) { m_uuid.assign(value); } 53 | 54 | private: 55 | Aws::String m_uuid; 56 | }; 57 | } 58 | } 59 | 60 | -------------------------------------------------------------------------------- /KBot/include/aws/core/client/CoreErrors.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | #pragma once 6 | 7 | #include "aws/core/Core_EXPORTS.h" 8 | 9 | namespace Aws 10 | { 11 | namespace Http 12 | { 13 | enum class HttpResponseCode; 14 | } 15 | namespace Client 16 | { 17 | template 18 | class AWSError; 19 | 20 | enum class CoreErrors 21 | { 22 | INCOMPLETE_SIGNATURE = 0, 23 | INTERNAL_FAILURE = 1, 24 | INVALID_ACTION = 2, 25 | INVALID_CLIENT_TOKEN_ID = 3, 26 | INVALID_PARAMETER_COMBINATION = 4, 27 | INVALID_QUERY_PARAMETER = 5, 28 | INVALID_PARAMETER_VALUE = 6, 29 | MISSING_ACTION = 7, // SDK should never allow 30 | MISSING_AUTHENTICATION_TOKEN = 8, // SDK should never allow 31 | MISSING_PARAMETER = 9, // SDK should never allow 32 | OPT_IN_REQUIRED = 10, 33 | REQUEST_EXPIRED = 11, 34 | SERVICE_UNAVAILABLE = 12, 35 | THROTTLING = 13, 36 | VALIDATION = 14, 37 | ACCESS_DENIED = 15, 38 | RESOURCE_NOT_FOUND = 16, // Shared with multiple services 39 | UNRECOGNIZED_CLIENT = 17, // Most likely caused by an invalid access key or secret key 40 | MALFORMED_QUERY_STRING = 18, // Where does this come from? (cognito identity uses it) 41 | SLOW_DOWN = 19, 42 | REQUEST_TIME_TOO_SKEWED = 20, 43 | INVALID_SIGNATURE = 21, 44 | SIGNATURE_DOES_NOT_MATCH = 22, 45 | INVALID_ACCESS_KEY_ID = 23, 46 | REQUEST_TIMEOUT = 24, 47 | 48 | NETWORK_CONNECTION = 99, // General failure to send message to service 49 | 50 | // These are needed for logical reasons 51 | UNKNOWN = 100, // Unknown to the SDK 52 | CLIENT_SIGNING_FAILURE = 101, // Client failed to sign the request 53 | USER_CANCELLED = 102, // User cancelled the request 54 | SERVICE_EXTENSION_START_RANGE = 128 55 | }; 56 | 57 | namespace CoreErrorsMapper 58 | { 59 | /** 60 | * Finds a CoreErrors member if possible. Otherwise, returns UNKNOWN 61 | */ 62 | AWS_CORE_API AWSError GetErrorForName(const char* errorName); 63 | 64 | /** 65 | * Build the mapping between predefined exception names and Aws CoreErrors using Aws::Map. 66 | */ 67 | AWS_CORE_API void InitCoreErrorsMapper(); 68 | 69 | /** 70 | * Cleanup memory allocated for Aws::Map used by AWS CoreError Mapper. 71 | */ 72 | AWS_CORE_API void CleanupCoreErrorsMapper(); 73 | /** 74 | * Finds a CoreErrors member if possible by HTTP response code 75 | */ 76 | AWS_CORE_API AWSError GetErrorForHttpResponseCode(Aws::Http::HttpResponseCode code); 77 | } // namespace CoreErrorsMapper 78 | } // namespace Client 79 | } // namespace Aws 80 | -------------------------------------------------------------------------------- /KBot/include/aws/core/client/DefaultRetryStrategy.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | 11 | namespace Aws 12 | { 13 | namespace Client 14 | { 15 | 16 | class AWS_CORE_API DefaultRetryStrategy : public RetryStrategy 17 | { 18 | public: 19 | 20 | DefaultRetryStrategy(long maxRetries = 10, long scaleFactor = 25) : 21 | m_scaleFactor(scaleFactor), m_maxRetries(maxRetries) 22 | {} 23 | 24 | bool ShouldRetry(const AWSError& error, long attemptedRetries) const override; 25 | 26 | long CalculateDelayBeforeNextRetry(const AWSError& error, long attemptedRetries) const override; 27 | 28 | virtual long GetMaxAttempts() const override { return m_maxRetries + 1; } 29 | 30 | protected: 31 | long m_scaleFactor; 32 | long m_maxRetries; 33 | }; 34 | 35 | } // namespace Client 36 | } // namespace Aws 37 | -------------------------------------------------------------------------------- /KBot/include/aws/core/client/SpecifiedRetryableErrorsRetryStrategy.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include 11 | namespace Aws 12 | { 13 | namespace Client 14 | { 15 | 16 | /** 17 | * @brief This retry strategy is almost identical to DefaultRetryStrategy, except it accepts a vector of error or exception names 18 | * that you want to retry anyway (bypass the retryable definition of the error instance itself) if the retry attempts is less than maxRetries. 19 | */ 20 | class AWS_CORE_API SpecifiedRetryableErrorsRetryStrategy : public DefaultRetryStrategy 21 | { 22 | public: 23 | SpecifiedRetryableErrorsRetryStrategy(const Aws::Vector& specifiedRetryableErrors, long maxRetries = 10, long scaleFactor = 25) : 24 | DefaultRetryStrategy(maxRetries, scaleFactor), m_specifiedRetryableErrors(specifiedRetryableErrors) 25 | {} 26 | 27 | bool ShouldRetry(const AWSError& error, long attemptedRetries) const override; 28 | 29 | private: 30 | Aws::Vector m_specifiedRetryableErrors; 31 | }; 32 | 33 | } // namespace Client 34 | } // namespace Aws 35 | -------------------------------------------------------------------------------- /KBot/include/aws/core/http/HttpClient.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | namespace Aws 16 | { 17 | namespace Utils 18 | { 19 | namespace RateLimits 20 | { 21 | class RateLimiterInterface; 22 | } // namespace RateLimits 23 | } // namespace Utils 24 | 25 | namespace Http 26 | { 27 | class HttpRequest; 28 | class HttpResponse; 29 | 30 | /** 31 | * Abstract HttpClient. All it does is make HttpRequests and return their response. 32 | */ 33 | class AWS_CORE_API HttpClient 34 | { 35 | public: 36 | HttpClient(); 37 | virtual ~HttpClient() {} 38 | 39 | /** 40 | * Takes an http request, makes it, and returns the newly allocated HttpResponse. 41 | */ 42 | virtual std::shared_ptr MakeRequest(const std::shared_ptr& request, 43 | Aws::Utils::RateLimits::RateLimiterInterface* readLimiter = nullptr, 44 | Aws::Utils::RateLimits::RateLimiterInterface* writeLimiter = nullptr) const = 0; 45 | 46 | /** 47 | * If yes, the http client supports transfer-encoding:chunked. 48 | */ 49 | virtual bool SupportsChunkedTransferEncoding() const { return true; } 50 | 51 | /** 52 | * Stops all requests in progress and prevents any others from initiating. 53 | */ 54 | void DisableRequestProcessing(); 55 | /** 56 | * Enables/ReEnables request processing. 57 | */ 58 | void EnableRequestProcessing(); 59 | /** 60 | * Returns true if request processing is enabled. 61 | */ 62 | bool IsRequestProcessingEnabled() const; 63 | /** 64 | * Sleeps current thread for sleepTime. 65 | */ 66 | void RetryRequestSleep(std::chrono::milliseconds sleepTime); 67 | 68 | bool ContinueRequest(const Aws::Http::HttpRequest&) const; 69 | 70 | private: 71 | 72 | std::atomic< bool > m_disableRequestProcessing; 73 | 74 | std::mutex m_requestProcessingSignalLock; 75 | std::condition_variable m_requestProcessingSignal; 76 | }; 77 | 78 | } // namespace Http 79 | } // namespace Aws 80 | 81 | 82 | -------------------------------------------------------------------------------- /KBot/include/aws/core/http/HttpClientFactory.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | namespace Aws 14 | { 15 | namespace Client 16 | { 17 | struct ClientConfiguration; 18 | } // namespace Client 19 | namespace Http 20 | { 21 | class URI; 22 | class HttpClient; 23 | class HttpRequest; 24 | 25 | /** 26 | * Interface and default implementation of client for Http stack 27 | */ 28 | class AWS_CORE_API HttpClientFactory 29 | { 30 | public: 31 | virtual ~HttpClientFactory() {} 32 | 33 | /** 34 | * Creates a shared_ptr of HttpClient with the relevant settings from clientConfiguration 35 | */ 36 | virtual std::shared_ptr CreateHttpClient(const Aws::Client::ClientConfiguration& clientConfiguration) const = 0; 37 | /** 38 | * Creates a shared_ptr of HttpRequest with uri, method, and closure for how to create a response stream. 39 | */ 40 | virtual std::shared_ptr CreateHttpRequest(const Aws::String& uri, HttpMethod method, const Aws::IOStreamFactory& streamFactory) const = 0; 41 | /** 42 | * Creates a shared_ptr of HttpRequest with uri, method, and closure for how to create a response stream. 43 | */ 44 | virtual std::shared_ptr CreateHttpRequest(const URI& uri, HttpMethod method, const Aws::IOStreamFactory& streamFactory) const = 0; 45 | 46 | virtual void InitStaticState() {} 47 | virtual void CleanupStaticState() {} 48 | }; 49 | 50 | /** 51 | * libCurl infects everything with its global state. If it is being used then we automatically initialize and clean it up. 52 | * If this is a problem for you, set this to false. If you manually initialize libcurl please add the option CURL_GLOBAL_ALL to your init call. 53 | */ 54 | AWS_CORE_API void SetInitCleanupCurlFlag(bool initCleanupFlag); 55 | AWS_CORE_API void SetInstallSigPipeHandlerFlag(bool installHandler); 56 | AWS_CORE_API void InitHttp(); 57 | AWS_CORE_API void CleanupHttp(); 58 | AWS_CORE_API void SetHttpClientFactory(const std::shared_ptr& factory); 59 | AWS_CORE_API std::shared_ptr CreateHttpClient(const Aws::Client::ClientConfiguration& clientConfiguration); 60 | AWS_CORE_API std::shared_ptr CreateHttpRequest(const Aws::String& uri, HttpMethod method, const Aws::IOStreamFactory& streamFactory); 61 | AWS_CORE_API std::shared_ptr CreateHttpRequest(const URI& uri, HttpMethod method, const Aws::IOStreamFactory& streamFactory); 62 | 63 | } // namespace Http 64 | } // namespace Aws 65 | 66 | -------------------------------------------------------------------------------- /KBot/include/aws/core/http/HttpTypes.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | #include 15 | 16 | namespace Aws 17 | { 18 | namespace Http 19 | { 20 | /** 21 | * Models Http methods. 22 | */ 23 | enum class HttpMethod 24 | { 25 | HTTP_GET, 26 | HTTP_POST, 27 | HTTP_DELETE, 28 | HTTP_PUT, 29 | HTTP_HEAD, 30 | HTTP_PATCH 31 | }; 32 | 33 | /** 34 | * Possible default http factory vended http client implementations. 35 | */ 36 | enum class TransferLibType 37 | { 38 | DEFAULT_CLIENT = 0, 39 | CURL_CLIENT, 40 | WIN_INET_CLIENT, 41 | WIN_HTTP_CLIENT 42 | }; 43 | 44 | namespace HttpMethodMapper 45 | { 46 | /** 47 | * Gets the string value of an httpMethod. 48 | */ 49 | AWS_CORE_API const char* GetNameForHttpMethod(HttpMethod httpMethod); 50 | } // namespace HttpMethodMapper 51 | 52 | typedef std::pair HeaderValuePair; 53 | typedef Aws::Map HeaderValueCollection; 54 | 55 | } // namespace Http 56 | } // namespace Aws 57 | 58 | -------------------------------------------------------------------------------- /KBot/include/aws/core/http/Scheme.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | 12 | namespace Aws 13 | { 14 | namespace Http 15 | { 16 | /** 17 | * Enum representing URI scheme. 18 | */ 19 | enum class Scheme 20 | { 21 | HTTP, 22 | HTTPS 23 | }; 24 | 25 | namespace SchemeMapper 26 | { 27 | /** 28 | * Converts a Scheme instance to a String. 29 | */ 30 | AWS_CORE_API const char* ToString(Scheme scheme); 31 | /** 32 | * Converts a string instance to a Scheme. Defaults to https. 33 | */ 34 | AWS_CORE_API Scheme FromString(const char* name); 35 | } // namespace SchemeMapper 36 | } // namespace Http 37 | } // namespace Aws 38 | 39 | -------------------------------------------------------------------------------- /KBot/include/aws/core/http/curl/CurlHandleContainer.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | namespace Aws 14 | { 15 | namespace Http 16 | { 17 | 18 | /** 19 | * Simple Connection pool manager for Curl. It maintains connections in a thread safe manner. You 20 | * can call into acquire a handle, then put it back when finished. It is assumed that reusing an already 21 | * initialized handle is preferable (especially for synchronous clients). The pool doubles in capacity as 22 | * needed up to the maximum amount of connections. 23 | */ 24 | class CurlHandleContainer 25 | { 26 | public: 27 | /** 28 | * Initializes an empty stack of CURL handles. If you are only making synchronous calls via your http client 29 | * then a small size is best. For async support, a good value would be 6 * number of Processors. * 30 | */ 31 | CurlHandleContainer(unsigned maxSize = 50, long httpRequestTimeout = 0, long connectTimeout = 1000, bool tcpKeepAlive = true, 32 | unsigned long tcpKeepAliveIntervalMs = 30000, long lowSpeedTime = 3000, unsigned long lowSpeedLimit = 1); 33 | ~CurlHandleContainer(); 34 | 35 | /** 36 | * Blocks until a curl handle from the pool is available for use. 37 | */ 38 | CURL* AcquireCurlHandle(); 39 | /** 40 | * Returns a handle to the pool for reuse. It is imperative that this is called 41 | * after you are finished with the handle. 42 | */ 43 | void ReleaseCurlHandle(CURL* handle); 44 | 45 | /** 46 | * When the handle has bad DNS entries, problematic live connections, we need to destory the handle from pool. 47 | */ 48 | void DestroyCurlHandle(CURL* handle); 49 | 50 | private: 51 | CurlHandleContainer(const CurlHandleContainer&) = delete; 52 | const CurlHandleContainer& operator = (const CurlHandleContainer&) = delete; 53 | CurlHandleContainer(const CurlHandleContainer&&) = delete; 54 | const CurlHandleContainer& operator = (const CurlHandleContainer&&) = delete; 55 | 56 | CURL* CreateCurlHandleInPool(); 57 | bool CheckAndGrowPool(); 58 | void SetDefaultOptionsOnHandle(CURL* handle); 59 | 60 | Aws::Utils::ExclusiveOwnershipResourceManager m_handleContainer; 61 | unsigned m_maxPoolSize; 62 | unsigned long m_httpRequestTimeout; 63 | unsigned long m_connectTimeout; 64 | bool m_enableTcpKeepAlive; 65 | unsigned long m_tcpKeepAliveIntervalMs; 66 | unsigned long m_lowSpeedTime; 67 | unsigned long m_lowSpeedLimit; 68 | unsigned m_poolSize; 69 | std::mutex m_containerLock; 70 | }; 71 | 72 | } // namespace Http 73 | } // namespace Aws 74 | 75 | -------------------------------------------------------------------------------- /KBot/include/aws/core/http/curl/CurlHttpClient.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | 7 | #pragma once 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | namespace Aws 17 | { 18 | namespace Http 19 | { 20 | namespace Standard 21 | { 22 | class StandardHttpResponse; 23 | } 24 | 25 | //Curl implementation of an http client. Right now it is only synchronous. 26 | class AWS_CORE_API CurlHttpClient: public HttpClient 27 | { 28 | public: 29 | 30 | using Base = HttpClient; 31 | 32 | //Creates client, initializes curl handle if it hasn't been created already. 33 | CurlHttpClient(const Aws::Client::ClientConfiguration& clientConfig); 34 | 35 | //Makes request and receives response synchronously 36 | std::shared_ptr MakeRequest(const std::shared_ptr& request, 37 | Aws::Utils::RateLimits::RateLimiterInterface* readLimiter = nullptr, 38 | Aws::Utils::RateLimits::RateLimiterInterface* writeLimiter = nullptr) const override; 39 | 40 | static void InitGlobalState(); 41 | static void CleanupGlobalState(); 42 | 43 | protected: 44 | /** 45 | * Override any configuration on CURL handle for each request before sending. 46 | * The usage is to have a subclass of CurlHttpClient and have your own implementation of this function to configure whatever you want on CURL handle. 47 | */ 48 | virtual void OverrideOptionsOnConnectionHandle(CURL*) const {} 49 | 50 | private: 51 | mutable CurlHandleContainer m_curlHandleContainer; 52 | bool m_isUsingProxy; 53 | Aws::String m_proxyUserName; 54 | Aws::String m_proxyPassword; 55 | Aws::String m_proxyScheme; 56 | Aws::String m_proxyHost; 57 | Aws::String m_proxySSLCertPath; 58 | Aws::String m_proxySSLCertType; 59 | Aws::String m_proxySSLKeyPath; 60 | Aws::String m_proxySSLKeyType; 61 | Aws::String m_proxyKeyPasswd; 62 | unsigned m_proxyPort; 63 | bool m_verifySSL; 64 | Aws::String m_caPath; 65 | Aws::String m_caFile; 66 | bool m_disableExpectHeader; 67 | bool m_allowRedirects; 68 | static std::atomic isInit; 69 | }; 70 | 71 | using PlatformHttpClient = CurlHttpClient; 72 | 73 | } // namespace Http 74 | } // namespace Aws 75 | 76 | -------------------------------------------------------------------------------- /KBot/include/aws/core/http/standard/StandardHttpResponse.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | namespace Aws 16 | { 17 | namespace Http 18 | { 19 | namespace Standard 20 | { 21 | /** 22 | * Simple STL representation an Http Response, implements HttpResponse. 23 | */ 24 | class AWS_CORE_API StandardHttpResponse : public HttpResponse 25 | { 26 | public: 27 | /** 28 | * Initializes an http response with the originalRequest and the response code. 29 | */ 30 | StandardHttpResponse(const std::shared_ptr& originatingRequest) : 31 | HttpResponse(originatingRequest), 32 | bodyStream(originatingRequest->GetResponseStreamFactory()) 33 | {} 34 | 35 | ~StandardHttpResponse() = default; 36 | 37 | /** 38 | * Get the headers from this response 39 | */ 40 | HeaderValueCollection GetHeaders() const; 41 | /** 42 | * Returns true if the response contains a header by headerName 43 | */ 44 | bool HasHeader(const char* headerName) const; 45 | /** 46 | * Returns the value for a header at headerName if it exists. 47 | */ 48 | const Aws::String& GetHeader(const Aws::String&) const; 49 | /** 50 | * Gets the response body of the response. 51 | */ 52 | inline Aws::IOStream& GetResponseBody() const { return bodyStream.GetUnderlyingStream(); } 53 | /** 54 | * Gives full control of the memory of the ResponseBody over to the caller. At this point, it is the caller's 55 | * responsibility to clean up this object. 56 | */ 57 | inline Utils::Stream::ResponseStream&& SwapResponseStreamOwnership() { return std::move(bodyStream); } 58 | /** 59 | * Adds a header to the http response object. 60 | */ 61 | void AddHeader(const Aws::String&, const Aws::String&); 62 | 63 | private: 64 | StandardHttpResponse(const StandardHttpResponse&); 65 | 66 | Aws::Map headerMap; 67 | Utils::Stream::ResponseStream bodyStream; 68 | }; 69 | 70 | } // namespace Standard 71 | } // namespace Http 72 | } // namespace Aws 73 | 74 | 75 | -------------------------------------------------------------------------------- /KBot/include/aws/core/http/windows/IXmlHttpRequest2HttpClient.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | 15 | struct IXMLHTTPRequest2; 16 | 17 | namespace Aws 18 | { 19 | namespace Http 20 | { 21 | typedef Microsoft::WRL::ComPtr HttpRequestComHandle; 22 | 23 | /** 24 | * COM-based http client. To use this client see the CMake option USE_IXML_HTTP_REQUEST_2. 25 | * Note this client is written for compatibility with windows versions that do not ship with winhttp, and will only work 26 | * on windows versions > 8.1. WinHttp should still be the default client for windows when possible. This client will run the IXMLHttpRequest2 27 | * COM module in CLSCTX_SERVER mode. 28 | */ 29 | class AWS_CORE_API IXmlHttpRequest2HttpClient : public HttpClient 30 | { 31 | public: 32 | /** 33 | * Initialize client based on clientConfiguration. This will create a connection pool and configure client 34 | * wide parameters. 35 | */ 36 | IXmlHttpRequest2HttpClient(const Aws::Client::ClientConfiguration& clientConfiguration); 37 | virtual ~IXmlHttpRequest2HttpClient(); 38 | 39 | /** 40 | * Makes http request, returns http response. 41 | */ 42 | virtual std::shared_ptr MakeRequest(const std::shared_ptr& request, 43 | Aws::Utils::RateLimits::RateLimiterInterface* readLimiter = nullptr, 44 | Aws::Utils::RateLimits::RateLimiterInterface* writeLimiter = nullptr) const override; 45 | 46 | /** 47 | * You must call this method before making any calls to the constructor, unless you have already 48 | * called CoInit elsewhere in your system. 49 | */ 50 | static void InitCOM(); 51 | 52 | /** 53 | * IXMLHTTPRequest2 doesn't support transfer-encoding:chunked 54 | */ 55 | virtual bool SupportsChunkedTransferEncoding() const override { return false; } 56 | 57 | protected: 58 | /** 59 | * Override any configuration on request handle. 60 | * The usage is override this function in the subclass to configure whatever you want on request handle. 61 | */ 62 | virtual void OverrideOptionsOnRequestHandle(const HttpRequestComHandle&) const {} 63 | 64 | private: 65 | void FillClientSettings(const HttpRequestComHandle&) const; 66 | 67 | //we can't reuse these com objects like we do in other http clients, just put a new one back into the resource manager. 68 | void ReturnHandleToResourceManager() const; 69 | 70 | mutable Aws::Utils::ExclusiveOwnershipResourceManager m_resourceManager; 71 | Aws::String m_proxyUserName; 72 | Aws::String m_proxyPassword; 73 | size_t m_poolSize; 74 | bool m_followRedirects; 75 | bool m_verifySSL; 76 | size_t m_totalTimeoutMs; 77 | }; 78 | } 79 | } 80 | 81 | -------------------------------------------------------------------------------- /KBot/include/aws/core/http/windows/WinHttpConnectionPoolMgr.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | 12 | namespace Aws 13 | { 14 | namespace Http 15 | { 16 | 17 | /** 18 | * Connection pool manager for winhttp api. This is the default windows http implementation. 19 | * It is more efficient and performant than WinINet. 20 | */ 21 | class AWS_CORE_API WinHttpConnectionPoolMgr : public WinConnectionPoolMgr 22 | { 23 | public: 24 | /** 25 | * Initializes the connection pool with the passedin iOpen handle from earlier winHttp init calls. 26 | * configures connect calls with the timeouts. MaxConnectionsPerHost sets the queue sizes for each endpoint. 27 | */ 28 | WinHttpConnectionPoolMgr(void* iOpenHandle, unsigned maxConnectionsPerHost, long requestTimeout, long connectTimeout); 29 | WinHttpConnectionPoolMgr(void* iOpenHandle, unsigned maxConnectionsPerHost, long requestTimeout, long connectTimeout, 30 | bool enableTcpKeepAlive, unsigned long tcpKeepAliveInterval); 31 | 32 | virtual ~WinHttpConnectionPoolMgr(); 33 | 34 | /** 35 | * Gets the log tag to use for logging in the base class. 36 | */ 37 | const char* GetLogTag() const { return "WinHttpConnectionPoolMgr"; } 38 | 39 | private: 40 | virtual void DoCloseHandle(void* handle) const override; 41 | virtual void* CreateNewConnection(const Aws::String& host, HostConnectionContainer& connectionContainer) const override; 42 | 43 | WinHttpConnectionPoolMgr(const WinHttpConnectionPoolMgr&) = delete; 44 | const WinHttpConnectionPoolMgr& operator = (const WinHttpConnectionPoolMgr&) = delete; 45 | WinHttpConnectionPoolMgr(const WinHttpConnectionPoolMgr&&) = delete; 46 | const WinHttpConnectionPoolMgr& operator = (const WinHttpConnectionPoolMgr&&) = delete; 47 | 48 | }; 49 | 50 | } // namespace Http 51 | } // namespace Aws 52 | -------------------------------------------------------------------------------- /KBot/include/aws/core/http/windows/WinHttpSyncHttpClient.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | namespace Aws 14 | { 15 | namespace Client 16 | { 17 | struct ClientConfiguration; 18 | } // namespace Client 19 | 20 | namespace Http 21 | { 22 | 23 | class WinHttpConnectionPoolMgr; 24 | 25 | /** 26 | * WinHttp implementation of an http client 27 | */ 28 | class AWS_CORE_API WinHttpSyncHttpClient : public WinSyncHttpClient 29 | { 30 | public: 31 | using Base = WinSyncHttpClient; 32 | 33 | /** 34 | * Initializes the client with relevant parameters from clientConfig. 35 | */ 36 | WinHttpSyncHttpClient(const Aws::Client::ClientConfiguration& clientConfig); 37 | ~WinHttpSyncHttpClient(); 38 | 39 | /** 40 | * Log tag for use in base class. 41 | */ 42 | const char* GetLogTag() const override { return "WinHttpSyncHttpClient"; } 43 | 44 | private: 45 | // WinHttp specific implementations 46 | void* OpenRequest(const std::shared_ptr& request, void* connection, const Aws::StringStream& ss) const override; 47 | void DoAddHeaders(void* httpRequest, Aws::String& headerStr) const override; 48 | uint64_t DoWriteData(void* httpRequest, char* streamBuffer, uint64_t bytesRead, bool isChunked) const override; 49 | uint64_t FinalizeWriteData(void* hHttpRequest) const override; 50 | bool DoReceiveResponse(void* httpRequest) const override; 51 | bool DoQueryHeaders(void* httpRequest, std::shared_ptr& response, Aws::StringStream& ss, uint64_t& read) const override; 52 | bool DoSendRequest(void* httpRequest) const override; 53 | bool DoReadData(void* hHttpRequest, char* body, uint64_t size, uint64_t& read) const override; 54 | void* GetClientModule() const override; 55 | 56 | bool m_usingProxy; 57 | bool m_verifySSL; 58 | Aws::WString m_proxyUserName; 59 | Aws::WString m_proxyPassword; 60 | }; 61 | 62 | } // namespace Http 63 | } // namespace Aws 64 | 65 | -------------------------------------------------------------------------------- /KBot/include/aws/core/http/windows/WinINetConnectionPoolMgr.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | 12 | namespace Aws 13 | { 14 | namespace Http 15 | { 16 | 17 | /** 18 | * Connection pool manager for wininet api. 19 | */ 20 | class AWS_CORE_API WinINetConnectionPoolMgr : public WinConnectionPoolMgr 21 | { 22 | public: 23 | /** 24 | * Initializes the connection pool with the passedin iOpen handle from earlier wininet init calls. 25 | * configures connect calls with the timeouts. MaxConnectionsPerHost sets the queue sizes for each endpoint. 26 | */ 27 | WinINetConnectionPoolMgr(void* iOpenHandle, unsigned maxConnectionsPerHost, long requestTimeout, long connectTimeout); 28 | WinINetConnectionPoolMgr(void* iOpenHandle, unsigned maxConnectionsPerHost, long requestTimeout, long connectTimeout, 29 | bool enableTcpKeepAlive, unsigned long tcpKeepAliveIntervalMs); 30 | 31 | virtual ~WinINetConnectionPoolMgr(); 32 | 33 | /** 34 | * Gets log tag for use in logging in the base class. 35 | */ 36 | const char* GetLogTag() const override { return "WinInetConnectionPoolMgr"; } 37 | 38 | private: 39 | virtual void DoCloseHandle(void* handle) const override; 40 | 41 | virtual void* CreateNewConnection(const Aws::String& host, HostConnectionContainer& connectionContainer) const override; 42 | 43 | WinINetConnectionPoolMgr(const WinINetConnectionPoolMgr&) = delete; 44 | const WinINetConnectionPoolMgr& operator = (const WinINetConnectionPoolMgr&) = delete; 45 | WinINetConnectionPoolMgr(const WinINetConnectionPoolMgr&&) = delete; 46 | const WinINetConnectionPoolMgr& operator = (const WinINetConnectionPoolMgr&&) = delete; 47 | 48 | }; 49 | 50 | } // namespace Http 51 | } // namespace Aws 52 | -------------------------------------------------------------------------------- /KBot/include/aws/core/http/windows/WinINetSyncHttpClient.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | namespace Aws 14 | { 15 | namespace Client 16 | { 17 | struct ClientConfiguration; 18 | } // namespace Client 19 | 20 | namespace Http 21 | { 22 | class WinINetConnectionPoolMgr; 23 | 24 | /** 25 | *WinInet implementation of an http client. 26 | */ 27 | class AWS_CORE_API WinINetSyncHttpClient : public WinSyncHttpClient 28 | { 29 | public: 30 | using Base = WinSyncHttpClient; 31 | 32 | /** 33 | * Initializes the client with relevant parameters from clientConfig. 34 | */ 35 | WinINetSyncHttpClient(const Aws::Client::ClientConfiguration& clientConfig); 36 | ~WinINetSyncHttpClient(); 37 | 38 | /** 39 | * Gets log tag for use in logging in the base class. 40 | */ 41 | const char* GetLogTag() const override { return "WinInetSyncHttpClient"; } 42 | private: 43 | 44 | // WinHttp specific implementations 45 | void* OpenRequest(const std::shared_ptr& request, void* connection, const Aws::StringStream& ss) const override; 46 | void DoAddHeaders(void* hHttpRequest, Aws::String& headerStr) const override; 47 | uint64_t DoWriteData(void* hHttpRequest, char* streamBuffer, uint64_t bytesRead, bool isChunked) const override; 48 | uint64_t FinalizeWriteData(void* hHttpRequest) const override; 49 | bool DoReceiveResponse(void* hHttpRequest) const override; 50 | bool DoQueryHeaders(void* hHttpRequest, std::shared_ptr& response, Aws::StringStream& ss, uint64_t& read) const override; 51 | bool DoSendRequest(void* hHttpRequest) const override; 52 | bool DoReadData(void* hHttpRequest, char* body, uint64_t size, uint64_t& read) const override; 53 | void* GetClientModule() const override; 54 | 55 | WinINetSyncHttpClient &operator =(const WinINetSyncHttpClient &rhs); 56 | 57 | bool m_usingProxy; 58 | Aws::String m_proxyUserName; 59 | Aws::String m_proxyPassword; 60 | }; 61 | 62 | } // namespace Http 63 | } // namespace Aws 64 | 65 | -------------------------------------------------------------------------------- /KBot/include/aws/core/monitoring/CoreMetrics.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | #include 8 | #include 9 | 10 | namespace Aws 11 | { 12 | namespace Monitoring 13 | { 14 | /** 15 | * Metrics collected from AWS SDK Core include Http Client Metrics and other types of metrics. 16 | */ 17 | struct AWS_CORE_API CoreMetricsCollection 18 | { 19 | /** 20 | * Metrics collected from underlying http client during execution of a request 21 | */ 22 | HttpClientMetricsCollection httpClientMetrics; 23 | 24 | // Add Other types of metrics here. 25 | }; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /KBot/include/aws/core/monitoring/MonitoringFactory.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | #include 8 | 9 | namespace Aws 10 | { 11 | namespace Monitoring 12 | { 13 | class MonitoringInterface; 14 | 15 | /** 16 | * Factory to create monitoring instance. 17 | */ 18 | class AWS_CORE_API MonitoringFactory 19 | { 20 | public: 21 | virtual ~MonitoringFactory() = default; 22 | virtual Aws::UniquePtr CreateMonitoringInstance() const = 0; 23 | }; 24 | 25 | } // namespace Monitoring 26 | } // namespace Aws 27 | -------------------------------------------------------------------------------- /KBot/include/aws/core/monitoring/MonitoringManager.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * SPDX-License-Identifier: Apache-2.0. 5 | */ 6 | 7 | #pragma once 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | namespace Aws 15 | { 16 | namespace Monitoring 17 | { 18 | class MonitoringFactory; 19 | /** 20 | * Wrapper function of OnRequestStarted defined by all monitoring instances 21 | */ 22 | Aws::Vector OnRequestStarted(const Aws::String& serviceName, const Aws::String& requestName, 23 | const std::shared_ptr& request); 24 | 25 | /** 26 | * Wrapper function of OnRequestSucceeded defined by all monitoring instances 27 | */ 28 | void OnRequestSucceeded(const Aws::String& serviceName, const Aws::String& requestName, const std::shared_ptr& request, 29 | const Aws::Client::HttpResponseOutcome& outcome, const CoreMetricsCollection& metricsFromCore, const Aws::Vector& contexts); 30 | 31 | /** 32 | * Wrapper function of OnRequestFailed defined by all monitoring instances 33 | */ 34 | void OnRequestFailed(const Aws::String& serviceName, const Aws::String& requestName, const std::shared_ptr& request, 35 | const Aws::Client::HttpResponseOutcome& outcome, const CoreMetricsCollection& metricsFromCore, const Aws::Vector& contexts); 36 | 37 | /** 38 | * Wrapper function of OnRequestRetry defined by all monitoring instances 39 | */ 40 | void OnRequestRetry(const Aws::String& serviceName, const Aws::String& requestName, 41 | const std::shared_ptr& request, const Aws::Vector& contexts); 42 | 43 | /** 44 | * Wrapper function of OnFinish defined by all monitoring instances 45 | */ 46 | void OnFinish(const Aws::String& serviceName, const Aws::String& requestName, 47 | const std::shared_ptr& request, const Aws::Vector& contexts); 48 | 49 | typedef std::function()> MonitoringFactoryCreateFunction; 50 | 51 | /** 52 | * Init monitoring using supplied factories, monitoring can support multiple instances. 53 | * We will try to (based on config resolution result) create a default client side monitoring listener instance defined in AWS SDK Core module. 54 | * and create other instances from these factories. 55 | * This function will be called during Aws::InitAPI call, argument is acquired from Aws::SDKOptions->MonitoringOptions 56 | */ 57 | AWS_CORE_API void InitMonitoring(const std::vector& monitoringFactoryCreateFunctions); 58 | 59 | /** 60 | * Clean up monitoring related global variables 61 | */ 62 | AWS_CORE_API void CleanupMonitoring(); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /KBot/include/aws/core/net/Net.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | namespace Aws 11 | { 12 | namespace Net 13 | { 14 | // Has network stack been initiated. 15 | bool IsNetworkInitiated(); 16 | 17 | // Initiate network stack. 18 | void InitNetwork(); 19 | 20 | // Cleanup network stack. 21 | void CleanupNetwork(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /KBot/include/aws/core/platform/Android.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #ifdef __ANDROID__ 7 | 8 | #include 9 | 10 | #include 11 | 12 | #include 13 | 14 | namespace Aws 15 | { 16 | namespace Platform 17 | { 18 | 19 | // must be called before any other native SDK functions when running on Android 20 | AWS_CORE_API void InitAndroid(JNIEnv* env, jobject context); 21 | 22 | // helper functions for functionality requiring JNI calls; not valid until InitAndroid has been called 23 | AWS_CORE_API JavaVM* GetJavaVM(); 24 | AWS_CORE_API const char* GetCacheDirectory(); 25 | 26 | } //namespace Platform 27 | } //namespace Aws 28 | 29 | #endif // __ANDROID__ 30 | -------------------------------------------------------------------------------- /KBot/include/aws/core/platform/Environment.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | 11 | namespace Aws 12 | { 13 | namespace Environment 14 | { 15 | /** 16 | * shim for getenv 17 | */ 18 | AWS_CORE_API Aws::String GetEnv(const char* name); 19 | 20 | } // namespace Environment 21 | } // namespace Aws 22 | 23 | -------------------------------------------------------------------------------- /KBot/include/aws/core/platform/OSVersionInfo.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | 11 | namespace Aws 12 | { 13 | namespace OSVersionInfo 14 | { 15 | /** 16 | * computing the version string for the current running operating system. 17 | */ 18 | AWS_CORE_API Aws::String ComputeOSVersionString(); 19 | 20 | /** 21 | * runs a (shell) command string and returns the output; not needed on windows currently 22 | */ 23 | AWS_CORE_API Aws::String GetSysCommandOutput(const char* command); 24 | 25 | } // namespace OSVersionInfo 26 | } // namespace Aws 27 | 28 | -------------------------------------------------------------------------------- /KBot/include/aws/core/platform/Platform.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #include 7 | 8 | #include 9 | 10 | -------------------------------------------------------------------------------- /KBot/include/aws/core/platform/Security.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | 12 | namespace Aws 13 | { 14 | namespace Security 15 | { 16 | 17 | /* 18 | * Securely clears a block of memory 19 | */ 20 | AWS_CORE_API void SecureMemClear(unsigned char *data, size_t length); 21 | 22 | } // namespace Security 23 | } // namespace Aws 24 | 25 | -------------------------------------------------------------------------------- /KBot/include/aws/core/platform/Time.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | 11 | namespace Aws 12 | { 13 | namespace Time 14 | { 15 | 16 | /* 17 | * A platform-agnostic implementation of the timegm function from gnu extensions 18 | */ 19 | AWS_CORE_API time_t TimeGM(tm* const t); 20 | 21 | /* 22 | * Converts from a time value of std::time_t type to a C tm structure for easier date analysis 23 | */ 24 | AWS_CORE_API void LocalTime(tm* t, std::time_t time); 25 | 26 | /* 27 | * Converts from a time value of std::time_t type to a C tm structure for easier date analysis 28 | */ 29 | AWS_CORE_API void GMTime(tm* t, std::time_t time); 30 | 31 | } // namespace Time 32 | } // namespace Aws 33 | -------------------------------------------------------------------------------- /KBot/include/aws/core/platform/refs/IXmlHttpRequest2Ref.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/ARN.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | 11 | namespace Aws 12 | { 13 | namespace Utils 14 | { 15 | /** 16 | * ARN (Amazon Resource Name) is used to identify an unique resource on AWS. 17 | * A full qualified ARN has two forms: 18 | * 1. arn:partition:service:region:account-id:resource-type:resource-id:qualifier 19 | * 2. arn:partition:service:region:account-id:resource-type/resource-id/qualifier 20 | * Different services have different resource definition, here we treat anything 21 | * after "[account-id]:" as resource. Service should have their own resource parser. 22 | */ 23 | class AWS_CORE_API ARN 24 | { 25 | public: 26 | ARN(const Aws::String& arnString); 27 | /** 28 | * return if the ARN is valid after construction. 29 | */ 30 | explicit operator bool() const { return m_valid; } 31 | 32 | /** 33 | * Get the originating arn string. 34 | */ 35 | const Aws::String& GetARNString() const { return m_arnString; } 36 | 37 | const Aws::String& GetPartition() const { return m_partition; } 38 | 39 | const Aws::String& GetService() const { return m_service; } 40 | 41 | const Aws::String& GetRegion() const { return m_region; } 42 | 43 | const Aws::String& GetAccountId() const { return m_accountId; } 44 | 45 | const Aws::String& GetResource() const { return m_resource; } 46 | 47 | private: 48 | Aws::String m_arnString; 49 | Aws::String m_partition; 50 | Aws::String m_service; 51 | Aws::String m_region; 52 | Aws::String m_accountId; 53 | Aws::String m_resource; 54 | 55 | bool m_valid; 56 | }; 57 | } 58 | } -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/ConcurrentCache.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | namespace Aws 13 | { 14 | namespace Utils 15 | { 16 | template 17 | class ConcurrentCache 18 | { 19 | public: 20 | explicit ConcurrentCache(size_t size = 1000) : m_cache(size) { } 21 | 22 | bool Get(const TKey& key, TValue& value) const 23 | { 24 | Aws::Utils::Threading::ReaderLockGuard g(m_rwlock); 25 | return m_cache.Get(key, value); 26 | } 27 | 28 | template 29 | void Put(const TKey& key, UValue&& val, std::chrono::milliseconds duration) 30 | { 31 | Aws::Utils::Threading::WriterLockGuard g(m_rwlock); 32 | m_cache.Put(key, std::forward(val), duration); 33 | } 34 | 35 | template 36 | void Put(TKey&& key, UValue&& val, std::chrono::milliseconds duration) 37 | { 38 | Aws::Utils::Threading::WriterLockGuard g(m_rwlock); 39 | m_cache.Put(std::move(key), std::forward(val), duration); 40 | } 41 | 42 | private: 43 | Aws::Utils::Cache m_cache; 44 | mutable Aws::Utils::Threading::ReaderWriterLock m_rwlock; 45 | }; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/DNS.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | namespace Aws 11 | { 12 | namespace Utils 13 | { 14 | AWS_CORE_API bool IsValidDnsLabel(const Aws::String& label); 15 | 16 | AWS_CORE_API bool IsValidHost(const Aws::String& host); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/EnumParseOverflowContainer.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | namespace Aws 14 | { 15 | namespace Utils 16 | { 17 | /** 18 | * This container is for storing unknown enum values that are encountered during parsing. 19 | * This is to work around the round-tripping enums problem. It's really just a simple thread-safe 20 | * hashmap. 21 | */ 22 | class AWS_CORE_API EnumParseOverflowContainer 23 | { 24 | public: 25 | const Aws::String& RetrieveOverflow(int hashCode) const; 26 | void StoreOverflow(int hashCode, const Aws::String& value); 27 | 28 | private: 29 | mutable Aws::Utils::Threading::ReaderWriterLock m_overflowLock; 30 | Aws::Map m_overflowMap; 31 | Aws::String m_emptyString; 32 | }; 33 | } 34 | } 35 | 36 | 37 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/FileSystemUtils.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | #pragma once 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | namespace Aws 14 | { 15 | namespace Utils 16 | { 17 | 18 | class AWS_CORE_API FStreamWithFileName : public Aws::FStream 19 | { 20 | public: 21 | FStreamWithFileName(const Aws::String& fileName, std::ios_base::openmode openFlags) : 22 | Aws::FStream(fileName.c_str(), openFlags), m_fileName(fileName) {} 23 | 24 | virtual ~FStreamWithFileName() = default; 25 | 26 | const Aws::String& GetFileName() const { return m_fileName; } 27 | protected: 28 | Aws::String m_fileName; 29 | }; 30 | 31 | /** 32 | * Provides a fstream around a temporary file. This file gets deleted upon an instance of this class's destructor being called. 33 | */ 34 | class AWS_CORE_API TempFile : public Aws::Utils::FStreamWithFileName 35 | { 36 | public: 37 | /** 38 | * Creates a temporary file with [prefix][temp name][suffix] e.g. 39 | * prefix of "foo" and suffix of ".bar" will generate foo[some random string].bar 40 | */ 41 | TempFile(const char* prefix, const char* suffix, std::ios_base::openmode openFlags); 42 | /** 43 | * Creates a temporary file with [prefix][temp name] e.g. 44 | * prefix of "foo" will generate foo[some random string] 45 | */ 46 | TempFile(const char* prefix, std::ios_base::openmode openFlags); 47 | /** 48 | * Creates a temporary file with a randome string for the name. 49 | */ 50 | TempFile(std::ios_base::openmode openFlags); 51 | 52 | ~TempFile(); 53 | }; 54 | 55 | class AWS_CORE_API PathUtils 56 | { 57 | public: 58 | 59 | /** 60 | * Get file name from it's full path, e.g get "file1" from "/path/to/file1.ext"; get "file2" from "/path/to/file2" 61 | */ 62 | static Aws::String GetFileNameFromPathWithoutExt(const Aws::String& path); 63 | 64 | /** 65 | * Get file name from it's full path, e.g get "file1.ext" from "/path/to/file1.ext"; get "file2" from "/path/to/file2" 66 | */ 67 | static Aws::String GetFileNameFromPathWithExt(const Aws::String& path); 68 | }; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/GetTheLights.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | namespace Aws 14 | { 15 | namespace Utils 16 | { 17 | /** 18 | * Make initialization and cleanup of shared resources less painful. 19 | * If you have this problem. Create a static instance of GetTheLights, 20 | * have each actor call Enter the room with your callable. 21 | * 22 | * When you are finished with the shared resources call LeaveRoom(). The last caller will 23 | * have its callable executed. 24 | */ 25 | class AWS_CORE_API GetTheLights 26 | { 27 | public: 28 | GetTheLights(); 29 | void EnterRoom(std::function&&); 30 | void LeaveRoom(std::function&&); 31 | private: 32 | std::atomic m_value; 33 | }; 34 | } 35 | } -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/HashingUtils.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | namespace Aws 15 | { 16 | namespace Utils 17 | { 18 | 19 | /** 20 | * Generic utils for hashing strings 21 | */ 22 | class AWS_CORE_API HashingUtils 23 | { 24 | public: 25 | /** 26 | * Base64 encodes string 27 | */ 28 | static Aws::String Base64Encode(const ByteBuffer& byteBuffer); 29 | 30 | /** 31 | * Base64 decodes string 32 | */ 33 | static ByteBuffer Base64Decode(const Aws::String&); 34 | 35 | /** 36 | * Hex encodes string 37 | */ 38 | static Aws::String HexEncode(const ByteBuffer& byteBuffer); 39 | 40 | /** 41 | * Hex encodes string 42 | */ 43 | static ByteBuffer HexDecode(const Aws::String& str); 44 | 45 | /** 46 | * Calculates a SHA256 HMAC digest (not hex encoded) 47 | */ 48 | static ByteBuffer CalculateSHA256HMAC(const ByteBuffer& toSign, const ByteBuffer& secret); 49 | 50 | /** 51 | * Calculates a SHA256 Hash digest (not hex encoded) 52 | */ 53 | static ByteBuffer CalculateSHA256(const Aws::String& str); 54 | 55 | /** 56 | * Calculates a SHA256 Hash digest on a stream (the entire stream is read, not hex encoded.) 57 | */ 58 | static ByteBuffer CalculateSHA256(Aws::IOStream& stream); 59 | 60 | /** 61 | * Calculates a SHA256 Tree Hash digest (not hex encoded, see tree hash definition: http://docs.aws.amazon.com/amazonglacier/latest/dev/checksum-calculations.html) 62 | */ 63 | static ByteBuffer CalculateSHA256TreeHash(const Aws::String& str); 64 | 65 | /** 66 | * Calculates a SHA256 Tree Hash digest on a stream (the entire stream is read, not hex encoded.) 67 | */ 68 | static ByteBuffer CalculateSHA256TreeHash(Aws::IOStream& stream); 69 | 70 | /** 71 | * Calculates a MD5 Hash value 72 | */ 73 | static ByteBuffer CalculateMD5(const Aws::String& str); 74 | 75 | /** 76 | * Calculates a MD5 Hash value 77 | */ 78 | static ByteBuffer CalculateMD5(Aws::IOStream& stream); 79 | 80 | static int HashString(const char* strToHash); 81 | 82 | }; 83 | 84 | } // namespace Utils 85 | } // namespace Aws 86 | 87 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/UUID.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | namespace Aws 13 | { 14 | namespace Utils 15 | { 16 | static const size_t UUID_BINARY_SIZE = 0x10; 17 | 18 | /** 19 | * Class encapsulating a UUID. This is platform dependent. The method you are most likely interested in is RandomUUID(). 20 | */ 21 | class AWS_CORE_API UUID 22 | { 23 | public: 24 | /** 25 | * Parses a GUID string into the raw data. 26 | */ 27 | UUID(const Aws::String&); 28 | /** 29 | * Sets the raw uuid data 30 | */ 31 | UUID(const unsigned char uuid[UUID_BINARY_SIZE]); 32 | 33 | /** 34 | * Returns the current UUID as a GUID string 35 | */ 36 | operator Aws::String() const; 37 | /** 38 | * Returns a copy of the raw uuid 39 | */ 40 | inline operator ByteBuffer() const { return ByteBuffer(m_uuid, sizeof(m_uuid)); } 41 | 42 | /** 43 | * Generates a UUID. It will always try to prefer a random implementation from the entropy source on the machine. If none, is available, it will 44 | * fallback to the mac address and timestamp implementation. 45 | */ 46 | static UUID RandomUUID(); 47 | 48 | private: 49 | unsigned char m_uuid[UUID_BINARY_SIZE]; 50 | }; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/UnreferencedParam.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | // taken from http://stackoverflow.com/questions/3020584/avoid-warning-unreferenced-formal-parameter, ugly but avoids having to #include the definition of an unreferenced struct/class 9 | 10 | #if defined (_MSC_VER) 11 | 12 | #define AWS_UNREFERENCED_PARAM(x) (&reinterpret_cast(x)) 13 | 14 | #else 15 | 16 | #define AWS_UNREFERENCED_PARAM(x) ((void)(x)) 17 | 18 | #endif // _MSC_VER 19 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/base64/Base64.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #ifdef __APPLE__ 9 | 10 | #ifdef __clang__ 11 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 12 | #endif // __clang__ 13 | 14 | #ifdef __GNUC__ 15 | #pragma GCC diagnostic ignored "-Wdeprecated-declarations" 16 | #endif // __GNUC__ 17 | 18 | #endif // __APPLE__ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | namespace Aws 25 | { 26 | namespace Utils 27 | { 28 | namespace Base64 29 | { 30 | 31 | /** 32 | * interface for platform specific Base64 encoding/decoding. 33 | */ 34 | class AWS_CORE_API Base64 35 | { 36 | public: 37 | Base64(const char *encodingTable = nullptr); 38 | 39 | /** 40 | * Encode a byte buffer into a base64 stream. 41 | * 42 | * throws Base64Exception if encoding fails. 43 | */ 44 | Aws::String Encode(const ByteBuffer&) const; 45 | 46 | /** 47 | * Decode a base64 string into a byte buffer. 48 | */ 49 | ByteBuffer Decode(const Aws::String&) const; 50 | 51 | /** 52 | * Calculates the required length of a base64 buffer after decoding the 53 | * input string. 54 | */ 55 | static size_t CalculateBase64DecodedLength(const Aws::String& b64input); 56 | /** 57 | * Calculates the length of an encoded base64 string based on the buffer being encoded 58 | */ 59 | static size_t CalculateBase64EncodedLength(const ByteBuffer& buffer); 60 | 61 | private: 62 | char m_mimeBase64EncodingTable[64]; 63 | uint8_t m_mimeBase64DecodingTable[256]; 64 | 65 | }; 66 | 67 | } // namespace Base64 68 | } // namespace Utils 69 | } // namespace Aws 70 | 71 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/crypto/ContentCryptoScheme.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | #pragma once 6 | #include 7 | #include 8 | 9 | namespace Aws 10 | { 11 | namespace Utils 12 | { 13 | namespace Crypto 14 | { 15 | enum class ContentCryptoScheme 16 | { 17 | CBC, 18 | CTR, 19 | GCM, 20 | NONE 21 | }; 22 | 23 | namespace ContentCryptoSchemeMapper 24 | { 25 | AWS_CORE_API ContentCryptoScheme GetContentCryptoSchemeForName(const Aws::String& name); 26 | 27 | AWS_CORE_API Aws::String GetNameForContentCryptoScheme(ContentCryptoScheme enumValue); 28 | } 29 | } //namespace Crypto 30 | 31 | }//namespace Utils 32 | }//namespace Aws -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/crypto/EncryptionMaterials.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | #pragma once 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | namespace Aws 15 | { 16 | namespace Utils 17 | { 18 | namespace Crypto 19 | { 20 | enum class CryptoErrors 21 | { 22 | ENCRYPT_CONTENT_ENCRYPTION_KEY_FAILED, 23 | DECRYPT_CONTENT_ENCRYPTION_KEY_FAILED, 24 | GENERATE_CONTENT_ENCRYPTION_KEY_FAILED 25 | }; 26 | 27 | typedef Outcome> CryptoOutcome; 28 | 29 | class AWS_CORE_API EncryptionMaterials 30 | { 31 | public: 32 | virtual ~EncryptionMaterials(); 33 | 34 | /* 35 | * Override this method to control how to encrypt the content encryption key (CEK). This occurs in place. 36 | */ 37 | virtual CryptoOutcome EncryptCEK(ContentCryptoMaterial& contentCryptoMaterial) = 0; 38 | 39 | /* 40 | * Override this method to control how to decrypt the content encryption key (CEK). This occurs in place. 41 | */ 42 | virtual CryptoOutcome DecryptCEK(ContentCryptoMaterial& contentCryptoMaterial) = 0; 43 | }; 44 | }//namespace Crypto 45 | }//namespace Utils 46 | }//namespace Aws 47 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/crypto/HMAC.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | /* 7 | * Interface for Sha256 encryptor and hmac 8 | */ 9 | #pragma once 10 | 11 | #include 12 | 13 | #include 14 | #include 15 | 16 | namespace Aws 17 | { 18 | namespace Utils 19 | { 20 | namespace Crypto 21 | { 22 | /** 23 | * Interface for HMAC hash providers. To implement an HMAC provider, inherit from this class and override Calculate. 24 | */ 25 | class AWS_CORE_API HMAC 26 | { 27 | public: 28 | HMAC() {}; 29 | virtual ~HMAC() {}; 30 | 31 | /** 32 | * Calculates an HMAC digest 33 | */ 34 | virtual HashResult Calculate(const Aws::Utils::ByteBuffer& toSign, const Aws::Utils::ByteBuffer& secret) = 0; 35 | 36 | }; 37 | 38 | /** 39 | * Simple abstract factory interface. Subclass this and create a factory if you want to control 40 | * how HMAC Hash objects are created. 41 | */ 42 | class AWS_CORE_API HMACFactory 43 | { 44 | public: 45 | virtual ~HMACFactory() {} 46 | 47 | /** 48 | * Factory method. Returns hmac hash implementation. 49 | */ 50 | virtual std::shared_ptr CreateImplementation() const = 0; 51 | 52 | /** 53 | * Opportunity to make any static initialization calls you need to make. 54 | * Will only be called once. 55 | */ 56 | virtual void InitStaticState() {} 57 | 58 | /** 59 | * Opportunity to make any static cleanup calls you need to make. 60 | * will only be called at the end of the application. 61 | */ 62 | virtual void CleanupStaticState() {} 63 | }; 64 | 65 | } // namespace Crypto 66 | } // namespace Utils 67 | } // namespace Aws 68 | 69 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/crypto/Hash.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | namespace Aws 14 | { 15 | namespace Utils 16 | { 17 | namespace Crypto 18 | { 19 | /** 20 | * Interface for computing hash codes using various hash algorithms 21 | */ 22 | class AWS_CORE_API Hash 23 | { 24 | public: 25 | 26 | Hash() {} 27 | virtual ~Hash() {} 28 | 29 | /** 30 | * Calculates a Hash digest 31 | */ 32 | virtual HashResult Calculate(const Aws::String& str) = 0; 33 | 34 | /** 35 | * Calculates a Hash digest on a stream (the entire stream is read) 36 | */ 37 | virtual HashResult Calculate(Aws::IStream& stream) = 0; 38 | 39 | // when hashing streams, this is the size of our internal buffer we read the stream into 40 | static const uint32_t INTERNAL_HASH_STREAM_BUFFER_SIZE = 8192; 41 | }; 42 | 43 | /** 44 | * Simple abstract factory interface. Subclass this and create a factory if you want to control 45 | * how Hash objects are created. 46 | */ 47 | class AWS_CORE_API HashFactory 48 | { 49 | public: 50 | virtual ~HashFactory() {} 51 | 52 | /** 53 | * Factory method. Returns hash implementation. 54 | */ 55 | virtual std::shared_ptr CreateImplementation() const = 0; 56 | 57 | /** 58 | * Opportunity to make any static initialization calls you need to make. 59 | * Will only be called once. 60 | */ 61 | virtual void InitStaticState() {} 62 | 63 | /** 64 | * Opportunity to make any static cleanup calls you need to make. 65 | * will only be called at the end of the application. 66 | */ 67 | virtual void CleanupStaticState() {} 68 | }; 69 | 70 | } // namespace Crypto 71 | } // namespace Utils 72 | } // namespace Aws 73 | 74 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/crypto/HashResult.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | 11 | namespace Aws 12 | { 13 | namespace Utils 14 | { 15 | 16 | template< typename R, typename E > class Outcome; 17 | 18 | namespace Crypto 19 | { 20 | using HashResult = Outcome< ByteBuffer, bool >; 21 | 22 | } // namespace Crypto 23 | } // namespace Utils 24 | } // namespace Aws 25 | 26 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/crypto/KeyWrapAlgorithm.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | #pragma once 6 | #include 7 | #include 8 | 9 | namespace Aws 10 | { 11 | namespace Utils 12 | { 13 | namespace Crypto 14 | { 15 | enum class KeyWrapAlgorithm 16 | { 17 | KMS, // Deprecated 18 | KMS_CONTEXT, 19 | AES_KEY_WRAP, // Deprecated 20 | AES_GCM, 21 | NONE 22 | }; 23 | 24 | namespace KeyWrapAlgorithmMapper 25 | { 26 | AWS_CORE_API KeyWrapAlgorithm GetKeyWrapAlgorithmForName(const Aws::String& name); 27 | 28 | AWS_CORE_API Aws::String GetNameForKeyWrapAlgorithm(KeyWrapAlgorithm enumValue); 29 | } 30 | } //namespace Crypto 31 | 32 | }//namespace Utils 33 | }//namespace Aws 34 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/crypto/MD5.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | /* 7 | * Interface for Sha256 encryptor and hmac 8 | */ 9 | #pragma once 10 | 11 | #ifdef __APPLE__ 12 | 13 | #ifdef __clang__ 14 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 15 | #endif // __clang__ 16 | 17 | #ifdef __GNUC__ 18 | #pragma GCC diagnostic ignored "-Wdeprecated-declarations" 19 | #endif // __GNUC__ 20 | 21 | #endif // __APPLE__ 22 | 23 | #include 24 | 25 | #include 26 | #include 27 | 28 | namespace Aws 29 | { 30 | namespace Utils 31 | { 32 | namespace Crypto 33 | { 34 | class WindowsHashImpl; 35 | 36 | /** 37 | * Md5 hash implementation 38 | */ 39 | class AWS_CORE_API MD5 : public Hash 40 | { 41 | public: 42 | /** 43 | * Initializes platform crypto libs for md5 44 | */ 45 | MD5(); 46 | virtual ~MD5(); 47 | 48 | /** 49 | * Calculates an MD5 hash 50 | */ 51 | virtual HashResult Calculate(const Aws::String& str) override; 52 | 53 | /** 54 | * Calculates a Hash digest on a stream (the entire stream is read) 55 | */ 56 | virtual HashResult Calculate(Aws::IStream& stream) override; 57 | 58 | private: 59 | 60 | std::shared_ptr m_hashImpl; 61 | }; 62 | 63 | } // namespace Crypto 64 | } // namespace Utils 65 | } // namespace Aws 66 | 67 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/crypto/Sha256.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | /* 7 | * Interface for Sha256 encryptor and hmac 8 | */ 9 | #pragma once 10 | 11 | #ifdef __APPLE__ 12 | 13 | #ifdef __clang__ 14 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 15 | #endif // __clang__ 16 | 17 | #ifdef __GNUC__ 18 | #pragma GCC diagnostic ignored "-Wdeprecated-declarations" 19 | #endif // __GNUC__ 20 | 21 | #endif // __APPLE__ 22 | 23 | #include 24 | 25 | #include 26 | 27 | namespace Aws 28 | { 29 | namespace Utils 30 | { 31 | namespace Crypto 32 | { 33 | class WindowsHashImpl; 34 | 35 | /** 36 | * Sha256 hash implementation. 37 | */ 38 | class AWS_CORE_API Sha256 : public Hash 39 | { 40 | public: 41 | /** 42 | * Initializes platform crypto libs. 43 | */ 44 | Sha256(); 45 | virtual ~Sha256(); 46 | 47 | /** 48 | * Calculates a SHA256 Hash digest (not hex encoded) 49 | */ 50 | virtual HashResult Calculate(const Aws::String& str) override; 51 | 52 | /** 53 | * Calculates a Hash digest on a stream (the entire stream is read) 54 | */ 55 | virtual HashResult Calculate(Aws::IStream& stream) override; 56 | 57 | private: 58 | 59 | std::shared_ptr< Hash > m_hashImpl; 60 | }; 61 | 62 | } // namespace Crypto 63 | } // namespace Utils 64 | } // namespace Aws 65 | 66 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/crypto/Sha256HMAC.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | /* 7 | * Interface for Sha256 encryptor and hmac 8 | */ 9 | #pragma once 10 | 11 | #ifdef __APPLE__ 12 | 13 | #ifdef __clang__ 14 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 15 | #endif // __clang__ 16 | 17 | #ifdef __GNUC__ 18 | #pragma GCC diagnostic ignored "-Wdeprecated-declarations" 19 | #endif // __GNUC__ 20 | 21 | #endif // __APPLE__ 22 | 23 | #include 24 | 25 | #include 26 | #include 27 | 28 | namespace Aws 29 | { 30 | namespace Utils 31 | { 32 | namespace Crypto 33 | { 34 | /** 35 | * Sha256 HMAC implementation 36 | */ 37 | class AWS_CORE_API Sha256HMAC : public HMAC 38 | { 39 | public: 40 | /** 41 | * initializes platform specific libs. 42 | */ 43 | Sha256HMAC(); 44 | virtual ~Sha256HMAC(); 45 | 46 | /** 47 | * Calculates a SHA256 HMAC digest (not hex encoded) 48 | */ 49 | virtual HashResult Calculate(const Aws::Utils::ByteBuffer& toSign, const Aws::Utils::ByteBuffer& secret) override; 50 | 51 | private: 52 | 53 | std::shared_ptr< HMAC > m_hmacImpl; 54 | }; 55 | 56 | } // namespace Sha256 57 | } // namespace Utils 58 | } // namespace Aws 59 | 60 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/event/EventDecoderStream.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | #include 8 | #include 9 | #include 10 | 11 | namespace Aws 12 | { 13 | namespace Utils 14 | { 15 | namespace Event 16 | { 17 | extern AWS_CORE_API const size_t DEFAULT_BUF_SIZE; 18 | 19 | /** 20 | * A buffered I/O stream that binary-decodes the bits written to it according to the AWS event-stream spec. 21 | * The decoding process will result in invoking callbacks on the handler assigned to the decoder parameter. 22 | */ 23 | class AWS_CORE_API EventDecoderStream : public Aws::IOStream 24 | { 25 | public: 26 | /** 27 | * Creates a stream for decoding events sent by the service. 28 | * @param decoder decodes the stream from server side, so as to invoke related callback functions. 29 | * @param eventStreamBufLength The length of the underlying buffer. 30 | */ 31 | EventDecoderStream(EventStreamDecoder& decoder, size_t bufferSize = DEFAULT_BUF_SIZE); 32 | 33 | private: 34 | EventDecoderStream(const EventDecoderStream&) = delete; 35 | EventDecoderStream(EventDecoderStream&&) = delete; 36 | EventDecoderStream& operator=(const EventDecoderStream&) = delete; 37 | EventDecoderStream& operator=(EventDecoderStream&&) = delete; 38 | 39 | EventStreamBuf m_eventStreamBuf; 40 | }; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/event/EventEncoderStream.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | namespace Aws 13 | { 14 | namespace Client 15 | { 16 | class AWSAuthSigner; 17 | } 18 | 19 | namespace Utils 20 | { 21 | namespace Event 22 | { 23 | extern AWS_CORE_API const size_t DEFAULT_BUF_SIZE; 24 | 25 | /** 26 | * A buffered I/O stream that binary-encodes the bits written to it according to the AWS event-stream spec. 27 | */ 28 | class AWS_CORE_API EventEncoderStream : public Aws::IOStream 29 | { 30 | public: 31 | 32 | /** 33 | * Creates a stream for encoding events sent by the client. 34 | * @param bufferSize The length of the underlying buffer. 35 | */ 36 | explicit EventEncoderStream(size_t bufferSize = DEFAULT_BUF_SIZE); 37 | 38 | /** 39 | * Sets the signature seed used by event-stream events. 40 | * Every event uses its previous event's signature to calculate its own signature. 41 | * Setting this value affects the signature calculation of the first event. 42 | */ 43 | void SetSignatureSeed(const Aws::String& seed) { m_encoder.SetSignatureSeed(seed); } 44 | 45 | /** 46 | * Writes an event-stream message to the underlying buffer. 47 | */ 48 | EventEncoderStream& WriteEvent(const Aws::Utils::Event::Message& msg); 49 | 50 | /** 51 | * Sets the signer implementation used for every event. 52 | */ 53 | void SetSigner(Aws::Client::AWSAuthSigner* signer) { m_encoder.SetSigner(signer); } 54 | 55 | /** 56 | * Allows a stream writer to communicate the end of the stream to a stream reader. 57 | * 58 | * Any writes to the stream after this call are not guaranteed to be read by another concurrent 59 | * read thread. 60 | */ 61 | void Close() { m_streambuf.SetEof(); setstate(eofbit); } 62 | 63 | private: 64 | Stream::ConcurrentStreamBuf m_streambuf; 65 | EventStreamEncoder m_encoder; 66 | }; 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/event/EventStream.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | #pragma once 6 | 7 | #include 8 | #include 9 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/event/EventStreamBuf.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | #pragma once 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | namespace Aws 13 | { 14 | namespace Utils 15 | { 16 | namespace Event 17 | { 18 | extern AWS_CORE_API const size_t DEFAULT_BUF_SIZE; 19 | 20 | /** 21 | * Derived from std::streambuf, used as the underlying buffer for EventStream. 22 | * Handle the payload from server side and pass data to underlying decoder. 23 | */ 24 | class AWS_CORE_API EventStreamBuf : public std::streambuf 25 | { 26 | public: 27 | /** 28 | * @param decoder decodes the stream from server side, so as to invoke related callback functions. 29 | * @param bufferSize The length of buffer, will be 1024 bytes by default. 30 | */ 31 | EventStreamBuf(EventStreamDecoder& decoder, size_t bufferLength = DEFAULT_BUF_SIZE); 32 | virtual ~EventStreamBuf(); 33 | 34 | protected: 35 | std::streampos seekoff(std::streamoff off, std::ios_base::seekdir dir, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out) override; 36 | std::streampos seekpos(std::streampos pos, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out) override; 37 | 38 | int underflow() override; 39 | int overflow(int ch) override; 40 | int sync() override; 41 | 42 | private: 43 | void writeToDecoder(); 44 | 45 | ByteBuffer m_byteBuffer; 46 | size_t m_bufferLength; 47 | Aws::StringStream m_err; 48 | EventStreamDecoder& m_decoder; 49 | }; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/event/EventStreamEncoder.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | namespace Aws 13 | { 14 | namespace Client 15 | { 16 | class AWSAuthSigner; 17 | } 18 | 19 | namespace Utils 20 | { 21 | namespace Event 22 | { 23 | /** 24 | * Utility class that wraps the logic of translating event messages to their binary format according to the 25 | * AWS streaming specification. 26 | * This class is _not_ thread-safe. 27 | */ 28 | class AWS_CORE_API EventStreamEncoder 29 | { 30 | public: 31 | EventStreamEncoder(Aws::Client::AWSAuthSigner* signer = nullptr); 32 | 33 | 34 | void SetSignatureSeed(const Aws::String& seed) { m_signatureSeed = seed; } 35 | 36 | void SetSigner(Aws::Client::AWSAuthSigner* signer) { m_signer = signer; } 37 | 38 | /** 39 | * Encodes the input message in the event-stream binary format and signs the resulting bits. 40 | * The signing is done via the signer member. 41 | */ 42 | Aws::Vector EncodeAndSign(const Aws::Utils::Event::Message& msg); 43 | private: 44 | aws_event_stream_message Encode(const Aws::Utils::Event::Message& msg); 45 | aws_event_stream_message Sign(aws_event_stream_message* msg); 46 | Aws::Client::AWSAuthSigner* m_signer; 47 | Aws::String m_signatureSeed; 48 | }; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/event/EventStreamErrors.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | namespace Aws 11 | { 12 | namespace Utils 13 | { 14 | namespace Event 15 | { 16 | /** 17 | * Errors encountered in event stream. 18 | * These errors are associated with those in aws-c-event-stream library. 19 | */ 20 | enum class EventStreamErrors 21 | { 22 | EVENT_STREAM_NO_ERROR = 0, 23 | EVENT_STREAM_BUFFER_LENGTH_MISMATCH = 0x1000, 24 | EVENT_STREAM_INSUFFICIENT_BUFFER_LEN, 25 | EVENT_STREAM_MESSAGE_FIELD_SIZE_EXCEEDED, 26 | EVENT_STREAM_PRELUDE_CHECKSUM_FAILURE, 27 | EVENT_STREAM_MESSAGE_CHECKSUM_FAILURE, 28 | EVENT_STREAM_MESSAGE_INVALID_HEADERS_LEN, 29 | EVENT_STREAM_MESSAGE_UNKNOWN_HEADER_TYPE, 30 | EVENT_STREAM_MESSAGE_PARSER_ILLEGAL_STATE, 31 | EVENT_STREAM_UNKNOWN_ERROR 32 | }; 33 | 34 | namespace EventStreamErrorsMapper 35 | { 36 | /** 37 | * Get name by its error type in event stream. 38 | */ 39 | AWS_CORE_API const char* GetNameForError(Event::EventStreamErrors error); 40 | /** 41 | * Get AWSError by EventStreamError. The Error type will always be CoreErrors::UNKNOWN as an internal error in Event Stream, and it's always not retryable. 42 | */ 43 | AWS_CORE_API Aws::Client::AWSError GetAwsErrorForEventStreamError(Event::EventStreamErrors error); 44 | } // namespace EventStreamErrorsMapper 45 | } // namespace Event 46 | } // namespace Utils 47 | } // namespace Aws -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/logging/AWSLogging.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | 11 | namespace Aws 12 | { 13 | namespace Utils 14 | { 15 | namespace Logging 16 | { 17 | class LogSystemInterface; 18 | 19 | // Standard interface 20 | 21 | /** 22 | * Call this at the beginning of your program, prior to any AWS calls. 23 | */ 24 | AWS_CORE_API void InitializeAWSLogging(const std::shared_ptr& logSystem); 25 | 26 | /** 27 | * Call this at the exit point of your program, after all calls have finished. 28 | */ 29 | AWS_CORE_API void ShutdownAWSLogging(void); 30 | 31 | /** 32 | * Get currently configured log system instance. 33 | */ 34 | AWS_CORE_API LogSystemInterface* GetLogSystem(); 35 | 36 | // Testing interface 37 | 38 | /** 39 | * Replaces the current logger with a new one, while pushing the old one onto a 1-deep stack; primarily for testing 40 | */ 41 | AWS_CORE_API void PushLogger(const std::shared_ptr &logSystem); 42 | 43 | /** 44 | * Pops the logger off the logger stack and replaces the current logger with it. Disables logging if the top logger is actually a nullptr 45 | */ 46 | AWS_CORE_API void PopLogger(); 47 | 48 | } // namespace Logging 49 | } // namespace Utils 50 | } // namespace Aws 51 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/logging/ConsoleLogSystem.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | 12 | namespace Aws 13 | { 14 | namespace Utils 15 | { 16 | namespace Logging 17 | { 18 | /** 19 | * Log system interface that logs to std::cout 20 | */ 21 | class AWS_CORE_API ConsoleLogSystem : public FormattedLogSystem 22 | { 23 | public: 24 | 25 | using Base = FormattedLogSystem; 26 | 27 | ConsoleLogSystem(LogLevel logLevel) : 28 | Base(logLevel) 29 | {} 30 | 31 | virtual ~ConsoleLogSystem() {} 32 | 33 | /** 34 | * Flushes buffered messages to stdout. 35 | */ 36 | void Flush() override; 37 | 38 | protected: 39 | 40 | virtual void ProcessFormattedStatement(Aws::String&& statement) override; 41 | }; 42 | 43 | } // namespace Logging 44 | } // namespace Utils 45 | } // namespace Aws 46 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/logging/DefaultLogSystem.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | namespace Aws 23 | { 24 | namespace Utils 25 | { 26 | namespace Logging 27 | { 28 | /** 29 | * Default behavior logger. It has a background thread that reads a log queue and prints the messages 30 | * out to file as quickly as possible. This implementation also rolls the file every hour. 31 | */ 32 | class AWS_CORE_API DefaultLogSystem : public FormattedLogSystem 33 | { 34 | public: 35 | using Base = FormattedLogSystem; 36 | 37 | /** 38 | * Initialize the logging system to write to the supplied logfile output. Creates logging thread on construction. 39 | */ 40 | DefaultLogSystem(LogLevel logLevel, const std::shared_ptr& logFile); 41 | /** 42 | * Initialize the logging system to write to a computed file path filenamePrefix + "timestamp.log". Creates logging thread 43 | * on construction. 44 | */ 45 | DefaultLogSystem(LogLevel logLevel, const Aws::String& filenamePrefix); 46 | 47 | virtual ~DefaultLogSystem(); 48 | 49 | /** 50 | * Flushes buffered messages to the file system. 51 | * This method is thread-safe. 52 | */ 53 | void Flush() override; 54 | 55 | /** 56 | * Structure containing semaphores, queue etc... 57 | */ 58 | struct LogSynchronizationData 59 | { 60 | public: 61 | LogSynchronizationData() : m_stopLogging(false) {} 62 | 63 | std::mutex m_logQueueMutex; 64 | std::condition_variable m_queueSignal; 65 | Aws::Vector m_queuedLogMessages; 66 | bool m_stopLogging; 67 | 68 | private: 69 | LogSynchronizationData(const LogSynchronizationData& rhs) = delete; 70 | LogSynchronizationData& operator =(const LogSynchronizationData& rhs) = delete; 71 | }; 72 | 73 | protected: 74 | /** 75 | * Pushes log onto the queue and notifies the background thread. 76 | */ 77 | virtual void ProcessFormattedStatement(Aws::String&& statement) override; 78 | 79 | private: 80 | DefaultLogSystem(const DefaultLogSystem& rhs) = delete; 81 | DefaultLogSystem& operator =(const DefaultLogSystem& rhs) = delete; 82 | 83 | LogSynchronizationData m_syncData; 84 | 85 | std::thread m_loggingThread; 86 | }; 87 | 88 | } // namespace Logging 89 | } // namespace Utils 90 | } // namespace Aws 91 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/logging/FormattedLogSystem.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #include 13 | 14 | namespace Aws 15 | { 16 | namespace Utils 17 | { 18 | namespace Logging 19 | { 20 | /** 21 | * Logger that formats log messages into [LEVEL] timestamp [threadid] message 22 | */ 23 | class AWS_CORE_API FormattedLogSystem : public LogSystemInterface 24 | { 25 | public: 26 | using Base = LogSystemInterface; 27 | 28 | /** 29 | * Initializes log system with logLevel 30 | */ 31 | FormattedLogSystem(LogLevel logLevel); 32 | virtual ~FormattedLogSystem() = default; 33 | 34 | /** 35 | * Gets the currently configured log level. 36 | */ 37 | virtual LogLevel GetLogLevel(void) const override { return m_logLevel; } 38 | /** 39 | * Set a new log level. This has the immediate effect of changing the log output to the new level. 40 | */ 41 | void SetLogLevel(LogLevel logLevel) { m_logLevel.store(logLevel); } 42 | 43 | /** 44 | * Does a printf style output to ProcessFormattedStatement. Don't use this, it's unsafe. See LogStream 45 | */ 46 | virtual void Log(LogLevel logLevel, const char* tag, const char* formatStr, ...) override; 47 | 48 | /** 49 | * Writes the stream to ProcessFormattedStatement. 50 | */ 51 | virtual void LogStream(LogLevel logLevel, const char* tag, const Aws::OStringStream &messageStream) override; 52 | 53 | protected: 54 | /** 55 | * This is the method that most logger implementations will want to override. 56 | * At this point the message is formatted and is ready to go to the output stream 57 | */ 58 | virtual void ProcessFormattedStatement(Aws::String&& statement) = 0; 59 | 60 | private: 61 | std::atomic m_logLevel; 62 | }; 63 | 64 | } // namespace Logging 65 | } // namespace Utils 66 | } // namespace Aws 67 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/logging/LogLevel.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | 12 | namespace Aws 13 | { 14 | namespace Utils 15 | { 16 | namespace Logging 17 | { 18 | 19 | /** 20 | * LogLevel used to control verbosity of logging system. 21 | */ 22 | enum class LogLevel : int 23 | { 24 | Off = 0, 25 | Fatal = 1, 26 | Error = 2, 27 | Warn = 3, 28 | Info = 4, 29 | Debug = 5, 30 | Trace = 6 31 | }; 32 | 33 | AWS_CORE_API Aws::String GetLogLevelName(LogLevel logLevel); 34 | 35 | } // namespace Logging 36 | } // namespace Utils 37 | } // namespace Aws 38 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/logging/LogSystemInterface.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | namespace Aws 14 | { 15 | namespace Utils 16 | { 17 | namespace Logging 18 | { 19 | enum class LogLevel : int; 20 | 21 | /** 22 | * Interface for logging implementations. If you want to write your own logger, you can start here, though you may have more 23 | * luck going down one more level to FormattedLogSystem. It does a bit more of the work for you and still gives you the ability 24 | * to override the IO portion. 25 | */ 26 | class AWS_CORE_API LogSystemInterface 27 | { 28 | public: 29 | virtual ~LogSystemInterface() = default; 30 | 31 | /** 32 | * Gets the currently configured log level for this logger. 33 | */ 34 | virtual LogLevel GetLogLevel(void) const = 0; 35 | /** 36 | * Does a printf style output to the output stream. Don't use this, it's unsafe. See LogStream 37 | */ 38 | virtual void Log(LogLevel logLevel, const char* tag, const char* formatStr, ...) = 0; 39 | /** 40 | * Writes the stream to the output stream. 41 | */ 42 | virtual void LogStream(LogLevel logLevel, const char* tag, const Aws::OStringStream &messageStream) = 0; 43 | /** 44 | * Writes any buffered messages to the underlying device if the logger supports buffering. 45 | */ 46 | virtual void Flush() = 0; 47 | }; 48 | 49 | } // namespace Logging 50 | } // namespace Utils 51 | } // namespace Aws 52 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/logging/NullLogSystem.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | namespace Aws 15 | { 16 | namespace Utils 17 | { 18 | namespace Logging 19 | { 20 | /** 21 | * Do nothing logger. 22 | */ 23 | class AWS_CORE_API NullLogSystem : public LogSystemInterface 24 | { 25 | public: 26 | 27 | NullLogSystem() {} 28 | virtual ~NullLogSystem() {} 29 | 30 | virtual LogLevel GetLogLevel(void) const override { return LogLevel::Off; } 31 | 32 | virtual void Log(LogLevel logLevel, const char* tag, const char* formatStr, ...) override 33 | { 34 | AWS_UNREFERENCED_PARAM(logLevel); 35 | AWS_UNREFERENCED_PARAM(tag); 36 | AWS_UNREFERENCED_PARAM(formatStr); 37 | } 38 | 39 | virtual void LogStream(LogLevel logLevel, const char* tag, const Aws::OStringStream &messageStream) override 40 | { 41 | AWS_UNREFERENCED_PARAM(logLevel); 42 | AWS_UNREFERENCED_PARAM(tag); 43 | AWS_UNREFERENCED_PARAM(messageStream); 44 | } 45 | }; 46 | 47 | } // namespace Logging 48 | } // namespace Utils 49 | } // namespace Aws 50 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/logging/android/LogcatLogSystem.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | 12 | namespace Aws 13 | { 14 | namespace Utils 15 | { 16 | namespace Logging 17 | { 18 | 19 | class AWS_CORE_API LogcatLogSystem : public FormattedLogSystem 20 | { 21 | public: 22 | 23 | using Base = FormattedLogSystem; 24 | 25 | LogcatLogSystem(LogLevel logLevel) : Base(logLevel) {} 26 | 27 | virtual ~LogcatLogSystem() {} 28 | 29 | void Flush() override { /* no-op android NDK does not have a flush api */ } 30 | 31 | protected: 32 | 33 | virtual void ProcessFormattedStatement(Aws::String&& statement) override; 34 | }; 35 | 36 | } // namespace Logging 37 | } // namespace Utils 38 | } // namespace Aws 39 | 40 | 41 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/memory/MemorySystemInterface.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | 12 | namespace Aws 13 | { 14 | namespace Utils 15 | { 16 | namespace Memory 17 | { 18 | /** 19 | * Central interface for memory management customizations. To create a custom memory manager, implement this interface and then 20 | * call InitializeAWSMemorySystem(). 21 | */ 22 | class AWS_CORE_API MemorySystemInterface 23 | { 24 | public: 25 | virtual ~MemorySystemInterface() = default; 26 | 27 | /** 28 | * This is for initializing your memory manager in a static context. This can be empty if you don't need to do that. 29 | */ 30 | virtual void Begin() = 0; 31 | /** 32 | * This is for cleaning up your memory manager in a static context. This can be empty if you don't need to do that. 33 | */ 34 | virtual void End() = 0; 35 | 36 | /** 37 | * Allocate your memory inside this method. blocksize and alignment are exactly the same as the std::allocator interfaces. 38 | * The allocationTag parameter is for memory tracking; you don't have to handle it. 39 | */ 40 | virtual void* AllocateMemory(std::size_t blockSize, std::size_t alignment, const char *allocationTag = nullptr) = 0; 41 | 42 | /** 43 | * Free the memory pointed to by memoryPtr. 44 | */ 45 | virtual void FreeMemory(void* memoryPtr) = 0; 46 | }; 47 | 48 | } // namespace Memory 49 | } // namespace Utils 50 | } // namespace Aws 51 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/memory/stl/AWSAllocator.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | #include 15 | #include 16 | 17 | namespace Aws 18 | { 19 | #ifdef USE_AWS_MEMORY_MANAGEMENT 20 | /** 21 | * Std allocator interface that is used for all STL types in the event that Custom Memory Management is being used. 22 | */ 23 | template 24 | class Allocator : public std::allocator 25 | { 26 | public: 27 | 28 | typedef std::allocator Base; 29 | 30 | Allocator() throw() : 31 | Base() 32 | {} 33 | 34 | Allocator(const Allocator& a) throw() : 35 | Base(a) 36 | {} 37 | 38 | template 39 | Allocator(const Allocator& a) throw() : 40 | Base(a) 41 | {} 42 | 43 | ~Allocator() throw() {} 44 | 45 | typedef std::size_t size_type; 46 | 47 | template 48 | struct rebind 49 | { 50 | typedef Allocator other; 51 | }; 52 | 53 | typename Base::pointer allocate(size_type n, const void *hint = nullptr) 54 | { 55 | AWS_UNREFERENCED_PARAM(hint); 56 | 57 | return reinterpret_cast(Malloc("AWSSTL", n * sizeof(T))); 58 | } 59 | 60 | void deallocate(typename Base::pointer p, size_type n) 61 | { 62 | AWS_UNREFERENCED_PARAM(n); 63 | 64 | Free(p); 65 | } 66 | 67 | }; 68 | 69 | #ifdef __ANDROID__ 70 | #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 71 | template< typename T > 72 | bool operator ==(const Allocator< T >& lhs, const Allocator< T >& rhs) 73 | { 74 | AWS_UNREFERENCED_PARAM(lhs); 75 | AWS_UNREFERENCED_PARAM(rhs); 76 | 77 | return false; 78 | } 79 | #endif // _GLIBCXX_FULLY_DYNAMIC_STRING == 0 80 | #endif // __ANDROID__ 81 | 82 | #else 83 | 84 | template< typename T > using Allocator = std::allocator; 85 | 86 | #endif // USE_AWS_MEMORY_MANAGEMENT 87 | /** 88 | * Creates a shared_ptr using AWS Allocator hooks. 89 | * allocationTag is for memory tracking purposes. 90 | */ 91 | template 92 | std::shared_ptr MakeShared(const char* allocationTag, ArgTypes&&... args) 93 | { 94 | AWS_UNREFERENCED_PARAM(allocationTag); 95 | 96 | return std::allocate_shared>(Aws::Allocator(), std::forward(args)...); 97 | } 98 | 99 | 100 | } // namespace Aws 101 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/memory/stl/AWSDeque.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | 12 | #include 13 | 14 | namespace Aws 15 | { 16 | 17 | template< typename T > using Deque = std::deque< T, Aws::Allocator< T > >; 18 | 19 | } // namespace Aws 20 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/memory/stl/AWSList.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | 12 | #include 13 | 14 | namespace Aws 15 | { 16 | 17 | template< typename T > using List = std::list< T, Aws::Allocator< T > >; 18 | 19 | } // namespace Aws 20 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/memory/stl/AWSMap.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | namespace Aws 17 | { 18 | 19 | template< typename K, typename V > using Map = std::map< K, V, std::less< K >, Aws::Allocator< std::pair< const K, V > > >; 20 | template< typename K, typename V > using UnorderedMap = std::unordered_map< K, V, std::hash< K >, std::equal_to< K >, Aws::Allocator< std::pair< const K, V > > >; 21 | template< typename K, typename V > using MultiMap = std::multimap< K, V, std::less< K >, Aws::Allocator< std::pair< const K, V > > >; 22 | 23 | struct CompareStrings 24 | { 25 | bool operator()(const char* a, const char* b) const 26 | { 27 | return std::strcmp(a, b) < 0; 28 | } 29 | }; 30 | 31 | template using CStringMap = std::map > >; 32 | 33 | } // namespace Aws 34 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/memory/stl/AWSMultiMap.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | 12 | #include 13 | 14 | namespace Aws 15 | { 16 | 17 | template< typename K, typename V > using MultiMap = std::multimap< K, V, std::less< K >, Aws::Allocator< std::pair< const K, V > > >; 18 | 19 | } // namespace Aws 20 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/memory/stl/AWSQueue.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | #include 14 | #include 15 | 16 | namespace Aws 17 | { 18 | 19 | template< typename T > using Queue = std::queue< T, Deque< T > >; 20 | 21 | } // namespace Aws 22 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/memory/stl/AWSSet.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | 12 | #include 13 | 14 | namespace Aws 15 | { 16 | 17 | template< typename T > using Set = std::set< T, std::less< T >, Aws::Allocator< T > >; 18 | 19 | } // namespace Aws 20 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/memory/stl/AWSStack.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | #include 14 | #include 15 | 16 | namespace Aws 17 | { 18 | 19 | template< typename T > using Stack = std::stack< T, Deque< T > >; 20 | 21 | } // namespace Aws 22 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/memory/stl/AWSStreamFwd.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | namespace Aws 14 | { 15 | 16 | // Serves no purpose other than to help my conversion process 17 | typedef std::basic_ifstream< char, std::char_traits< char > > IFStream; 18 | typedef std::basic_ofstream< char, std::char_traits< char > > OFStream; 19 | typedef std::basic_fstream< char, std::char_traits< char > > FStream; 20 | typedef std::basic_istream< char, std::char_traits< char > > IStream; 21 | typedef std::basic_ostream< char, std::char_traits< char > > OStream; 22 | typedef std::basic_iostream< char, std::char_traits< char > > IOStream; 23 | typedef std::istreambuf_iterator< char, std::char_traits< char > > IStreamBufIterator; 24 | 25 | using IOStreamFactory = std::function< Aws::IOStream*(void) >; 26 | 27 | 28 | } // namespace Aws 29 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/memory/stl/AWSStringStream.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #if defined(_GLIBCXX_FULLY_DYNAMIC_STRING) && _GLIBCXX_FULLY_DYNAMIC_STRING == 0 && defined(__ANDROID__) 11 | 12 | #include 13 | 14 | #else 15 | 16 | #include 17 | 18 | #include 19 | 20 | #endif 21 | 22 | namespace Aws 23 | { 24 | 25 | #if defined(_GLIBCXX_FULLY_DYNAMIC_STRING) && _GLIBCXX_FULLY_DYNAMIC_STRING == 0 && defined(__ANDROID__) 26 | 27 | // see the large comment block in AWSString.h for an explanation 28 | typedef Aws::SimpleStringStream StringStream; 29 | typedef Aws::SimpleIStringStream IStringStream; 30 | typedef Aws::SimpleOStringStream OStringStream; 31 | typedef Aws::Utils::Stream::SimpleStreamBuf StringBuf; 32 | 33 | #else 34 | 35 | typedef std::basic_stringstream< char, std::char_traits< char >, Aws::Allocator< char > > StringStream; 36 | typedef std::basic_istringstream< char, std::char_traits< char >, Aws::Allocator< char > > IStringStream; 37 | typedef std::basic_ostringstream< char, std::char_traits< char >, Aws::Allocator< char > > OStringStream; 38 | typedef std::basic_stringbuf< char, std::char_traits< char >, Aws::Allocator< char > > StringBuf; 39 | 40 | #endif 41 | 42 | } // namespace Aws 43 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/memory/stl/AWSVector.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | 12 | #include 13 | 14 | namespace Aws 15 | { 16 | 17 | template< typename T > using Vector = std::vector< T, Aws::Allocator< T > >; 18 | 19 | } // namespace Aws 20 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/ratelimiter/RateLimiterInterface.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | namespace Aws 14 | { 15 | namespace Utils 16 | { 17 | namespace RateLimits 18 | { 19 | /** 20 | * Interface for bandwidth limiters. You likely don't want to implement your own as DefaultRateLimiter is probably what you need. 21 | * If you need to implement one, then this is the interface to implement. 22 | */ 23 | class RateLimiterInterface 24 | { 25 | public: 26 | using DelayType = std::chrono::milliseconds; 27 | 28 | virtual ~RateLimiterInterface() {} 29 | /** 30 | * Calculates time in milliseconds that should be delayed before letting anymore data through. 31 | */ 32 | virtual DelayType ApplyCost(int64_t cost) = 0; 33 | /** 34 | * Same as ApplyCost() but then goes ahead and sleeps the current thread. 35 | */ 36 | virtual void ApplyAndPayForCost(int64_t cost) = 0; 37 | /** 38 | * Update the bandwidth rate to allow. 39 | */ 40 | virtual void SetRate(int64_t rate, bool resetAccumulator = false) = 0; 41 | }; 42 | 43 | } // namespace RateLimits 44 | } // namespace Utils 45 | } // namespace Aws -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/stream/ConcurrentStreamBuf.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | #pragma once 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | namespace Aws 18 | { 19 | namespace Utils 20 | { 21 | namespace Stream 22 | { 23 | /** 24 | * A thread-safe streambuf implementation that allows simultaneous reading and writing. 25 | * NOTE: iostreams maintain state for readers and writers. This means that you can have at most two 26 | * concurrent threads, one for reading and one for writing. Multiple readers or multiple writers are not 27 | * thread-safe and will result in race-conditions. 28 | */ 29 | class AWS_CORE_API ConcurrentStreamBuf : public std::streambuf 30 | { 31 | public: 32 | 33 | explicit ConcurrentStreamBuf(size_t bufferLength = 4 * 1024); 34 | 35 | void SetEof(); 36 | 37 | protected: 38 | std::streampos seekoff(std::streamoff off, std::ios_base::seekdir dir, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out) override; 39 | std::streampos seekpos(std::streampos pos, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out) override; 40 | 41 | int underflow() override; 42 | int overflow(int ch) override; 43 | int sync() override; 44 | std::streamsize showmanyc() override; 45 | 46 | void FlushPutArea(); 47 | 48 | private: 49 | Aws::Vector m_getArea; 50 | Aws::Vector m_putArea; 51 | Aws::Vector m_backbuf; // used to shuttle data from the put area to the get area 52 | std::mutex m_lock; // synchronize access to the common backbuffer 53 | std::condition_variable m_signal; 54 | bool m_eof; 55 | }; 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/stream/PreallocatedStreamBuf.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * SPDX-License-Identifier: Apache-2.0. 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | namespace Aws 14 | { 15 | namespace Utils 16 | { 17 | namespace Stream 18 | { 19 | /** 20 | * this is a stream buf to use with std::iostream that uses a preallocated buffer under the hood. 21 | */ 22 | class AWS_CORE_API PreallocatedStreamBuf : public std::streambuf 23 | { 24 | public: 25 | /** 26 | * Initialize the stream buffer with a pointer to your buffer. This class never takes ownership 27 | * of the buffer. It is your responsibility to delete it once the stream is no longer in use. 28 | * @param buffer buffer to initialize from. 29 | * @param lengthToRead length in bytes to actually use in the buffer (e.g. you have a 1kb buffer, but only want the stream 30 | * to see 500 b of it. 31 | */ 32 | PreallocatedStreamBuf(unsigned char* buffer, uint64_t lengthToRead); 33 | 34 | PreallocatedStreamBuf(const PreallocatedStreamBuf&) = delete; 35 | PreallocatedStreamBuf& operator=(const PreallocatedStreamBuf&) = delete; 36 | 37 | PreallocatedStreamBuf(PreallocatedStreamBuf&& toMove) = delete; 38 | PreallocatedStreamBuf& operator=(PreallocatedStreamBuf&&) = delete; 39 | 40 | /** 41 | * Get the buffer that is being used by the stream buffer. 42 | * @return Pointer to the underlying buffer (probably for a Aws::Delete() call). 43 | */ 44 | unsigned char* GetBuffer() { return m_underlyingBuffer; } 45 | 46 | protected: 47 | pos_type seekoff(off_type off, std::ios_base::seekdir dir, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out) override; 48 | pos_type seekpos(pos_type pos, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out) override; 49 | 50 | private: 51 | unsigned char* m_underlyingBuffer; 52 | const uint64_t m_lengthToRead; 53 | }; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/stream/ResponseStream.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | namespace Aws 13 | { 14 | namespace Utils 15 | { 16 | namespace Stream 17 | { 18 | /** 19 | * Encapsulates and manages ownership of custom response streams. This is a move only type. 20 | */ 21 | class AWS_CORE_API ResponseStream 22 | { 23 | public: 24 | /** 25 | * sets underlying stream to nullptr 26 | */ 27 | ResponseStream(); 28 | /** 29 | * moves the underlying stream 30 | */ 31 | ResponseStream(ResponseStream&&); 32 | /** 33 | * Uses factory to allocate underlying stream 34 | */ 35 | ResponseStream(const Aws::IOStreamFactory& factory); 36 | /** 37 | * Takes ownership of an underlying stream. 38 | */ 39 | ResponseStream(IOStream* underlyingStreamToManage); 40 | ResponseStream(const ResponseStream&) = delete; 41 | ~ResponseStream(); 42 | 43 | /** 44 | * moves the underlying stream 45 | */ 46 | ResponseStream& operator=(ResponseStream&&); 47 | ResponseStream& operator=(const ResponseStream&) = delete; 48 | 49 | /** 50 | * Gives access to underlying stream, but keep in mind that this changes state of the stream 51 | */ 52 | inline Aws::IOStream& GetUnderlyingStream() const { return *m_underlyingStream; } 53 | 54 | private: 55 | void ReleaseStream(); 56 | 57 | Aws::IOStream* m_underlyingStream; 58 | }; 59 | 60 | class AWS_CORE_API DefaultUnderlyingStream : public Aws::IOStream 61 | { 62 | public: 63 | using Base = Aws::IOStream; 64 | 65 | DefaultUnderlyingStream(); 66 | DefaultUnderlyingStream(Aws::UniquePtr buf); 67 | virtual ~DefaultUnderlyingStream(); 68 | }; 69 | 70 | AWS_CORE_API Aws::IOStream* DefaultResponseStreamFactoryMethod(); 71 | 72 | } //namespace Stream 73 | } //namespace Utils 74 | } //namespace Aws 75 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/stream/SimpleStreamBuf.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * SPDX-License-Identifier: Apache-2.0. 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | namespace Aws 15 | { 16 | namespace Utils 17 | { 18 | namespace Stream 19 | { 20 | /** 21 | * A replacement for std::stringbuf when using Android and gnustl together 22 | */ 23 | class AWS_CORE_API SimpleStreamBuf : public std::streambuf 24 | { 25 | public: 26 | 27 | using base = std::streambuf; 28 | 29 | SimpleStreamBuf(); 30 | explicit SimpleStreamBuf(const Aws::String& value); 31 | 32 | SimpleStreamBuf(const SimpleStreamBuf&) = delete; 33 | SimpleStreamBuf& operator=(const SimpleStreamBuf&) = delete; 34 | 35 | SimpleStreamBuf(SimpleStreamBuf&& toMove) = delete; 36 | SimpleStreamBuf& operator=(SimpleStreamBuf&&) = delete; 37 | 38 | virtual ~SimpleStreamBuf(); 39 | 40 | Aws::String str() const; 41 | void str(const Aws::String& value); 42 | 43 | void swap(SimpleStreamBuf& rhs); 44 | 45 | protected: 46 | virtual std::streampos seekoff(std::streamoff off, std::ios_base::seekdir dir, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out) override; 47 | virtual std::streampos seekpos(std::streampos pos, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out) override; 48 | 49 | virtual int overflow (int c = EOF) override; 50 | virtual int underflow() override; 51 | 52 | virtual std::streamsize xsputn(const char* s, std::streamsize n) override; 53 | 54 | private: 55 | 56 | bool GrowBuffer(); 57 | 58 | char* m_buffer; 59 | size_t m_bufferSize; 60 | }; 61 | 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/threading/Semaphore.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | namespace Aws 13 | { 14 | namespace Utils 15 | { 16 | namespace Threading 17 | { 18 | class AWS_CORE_API Semaphore { 19 | public: 20 | /** 21 | * Initializes a new instance of Semaphore class specifying the initial number of entries and 22 | * the maximum number of concurrent entries. 23 | */ 24 | Semaphore(size_t initialCount, size_t maxCount); 25 | /** 26 | * Blocks the current thread until it receives a signal. 27 | */ 28 | void WaitOne(); 29 | /** 30 | * Exits the semaphore once. 31 | */ 32 | void Release(); 33 | /** 34 | * Exit the semaphore up to the maximum number of entries available. 35 | */ 36 | void ReleaseAll(); 37 | private: 38 | size_t m_count; 39 | const size_t m_maxCount; 40 | std::mutex m_mutex; 41 | std::condition_variable m_syncPoint; 42 | }; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /KBot/include/aws/core/utils/threading/ThreadTask.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0. 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | namespace Aws 14 | { 15 | namespace Utils 16 | { 17 | namespace Threading 18 | { 19 | class PooledThreadExecutor; 20 | 21 | class AWS_CORE_API ThreadTask 22 | { 23 | public: 24 | ThreadTask(PooledThreadExecutor& executor); 25 | ~ThreadTask(); 26 | 27 | /** 28 | * Rule of 5 stuff. 29 | * Don't copy or move 30 | */ 31 | ThreadTask(const ThreadTask&) = delete; 32 | ThreadTask& operator =(const ThreadTask&) = delete; 33 | ThreadTask(ThreadTask&&) = delete; 34 | ThreadTask& operator =(ThreadTask&&) = delete; 35 | 36 | void StopProcessingWork(); 37 | 38 | protected: 39 | void MainTaskRunner(); 40 | 41 | private: 42 | std::atomic m_continue; 43 | PooledThreadExecutor& m_executor; 44 | std::thread m_thread; 45 | }; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /KBot/libs/aws-cpp-sdk-core.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KebsCS/KBot/d512106467167f679b8718ff02b25aae1bb2a085/KBot/libs/aws-cpp-sdk-core.exp -------------------------------------------------------------------------------- /KBot/libs/aws-cpp-sdk-core.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KebsCS/KBot/d512106467167f679b8718ff02b25aae1bb2a085/KBot/libs/aws-cpp-sdk-core.lib -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # KBot 2 | 3 | The project started on 23.10.2020 for learning purposes only. Stopped developing in February 2021, but the offsets are updated for patch 11.10 EUW. Only source, no binaries since it's just as a help to someone else who wants to start out. 4 | 5 | I made it with almost no prior game hacking experience, but I'm happy with how it went out. Other than bug fixes and expanding it only evade needs some work, which I started doing with "Evade2" ("Evade" was just to understand how does it work and then rewrite it from scratch) 6 | 7 | ## Screenshots 8 | 9 | ![Visuals](https://i.imgur.com/lZEZ7la.png) 10 | 11 | ![Evade](https://i.imgur.com/6wjyeZX.png) 12 | 13 | ![Orbwalker](https://i.imgur.com/bFursu1.png) 14 | 15 | ![Misc](https://i.imgur.com/AYJBsEg.png) 16 | 17 | ![Champ](https://i.imgur.com/YsOoYVn.png) 18 | 19 | ![Config](https://i.imgur.com/i7iCZaX.png) 20 | --------------------------------------------------------------------------------