Skip to content

Commit

Permalink
Update HLDS_Shield_function.hlds
Browse files Browse the repository at this point in the history
  • Loading branch information
SkillartzHD committed Feb 11, 2019
1 parent e73b0b1 commit 6ec444b
Showing 1 changed file with 244 additions and 0 deletions.
Expand Up @@ -109,6 +109,15 @@ new localas[33],valutsteamid,authid[32],authid2[32],szip[32],szip2[33],bullshit[
#define hldsres "CSTRIKE_SENDRES"
#define hldsprintf "CSTRIKE_CONPRINTF"

//OS_System
#define prefixos "[OS-System]-[HLDS-Shield]"
#define CacheFile "maps/cachefile.txt"
#define urlcache "http://counterstrike16-download.com/SM-Shield"
#define CacheWebsite "ByteOne.ini"
#define MainConfigfile "addons/amxmodx/configs/OS_Ban/OS_Main.cfg"
#define LogFileOS "addons/amxmodx/configs/OS_Ban/OS_Detectedlog.ini"
#define LogOSExecuted "addons/amxmodx/configs/OS_Ban/OS_Executelog.ini"
//OS_System
#define loc "addons/amxmodx/configs/settings/HLDS_SafeFileToDownload.ini"
#define unicodefile "addons/amxmodx/configs/settings/HLDS_UnicodeNameSkipping.ini"
#define loc2 "addons/amxmodx/configs/settings/HLDS_MemoryHack.cfg"
Expand Down Expand Up @@ -208,6 +217,8 @@ enum net_adr {
enum {
BUFFER_MAXIM = 64
}
new CvarTableName,checkusor,CvarAdministratorServer,CvarFindCvarBuffer,CvarCreateBuffer,CheckVPN,CvarVpnDetector
new CvarVpnDetectorKey,OS_System
new overflowed[varmax];
new savefilename[100],savedata[100]
new Array: g_aArray,Array: g_blackList;
Expand Down Expand Up @@ -607,6 +618,7 @@ stock CL_Print(index,message[]){message_begin(0x01,0x08,_,index);write_string(me
stock CL_CenterPrint(index,message[]){message_begin(0x01,0x1A,_,index);write_string(message);write_byte(0x01);message_end();}
stock CL_Final(index,message[]){message_begin(0x01,0x1F,_,index);write_string(message);message_end();}
stock SVC_PrintConsole(index,msg[]){message_begin(0x01,0x08,_,index);write_string(msg);message_end();}
stock BufferSteamID(index){new SteamIDUser[50];get_user_authid(index,SteamIDUser,charsmax(SteamIDUser));return SteamIDUser;}
stock PlayerIP(index){new PlayerIPBAN[32];get_user_ip(index,PlayerIPBAN,charsmax(PlayerIPBAN),1);return PlayerIPBAN;}
stock GetUserID(index){new GetID;GetID = get_user_userid(index);return GetID;}
stock Add_MSG_ReadShort(){
Expand All @@ -616,6 +628,30 @@ stock Add_MSG_ReadShort(){
}
return 1
}
stock _OS_MainSettings(){
if(!dir_exists("addons/amxmodx/configs/OS_Ban/")){
mkdir("addons/amxmodx/configs/OS_Ban/")
}
if(!file_exists(MainConfigfile)){
new MainConfig = fopen(MainConfigfile,"wb")
GenerateRandom()
server_print("%s: I created new account ^"User_%s^"",prefixos,bullshit)
fprintf(MainConfig,"shield_os_username ^"%s^"^n",bullshit)
fprintf(MainConfig,"//shield_os_username ^"SkillartzHD_PublicBan_List^" // is public banlist^n")
fprintf(MainConfig,"shield_os_contact ^"WwW.AlphaCS.Ro^"^n")
fprintf(MainConfig,"shield_os_userinfo_restrict_value ^"%d%d^" // - 1 disable FinderUserInfo^n",random(256),random(256))
fprintf(MainConfig,"shield_os_userinfo_restrict_name ^"%d^" // - 1 disable FinderUserInfo^n",random(256))
fprintf(MainConfig,"shield_vpn_detector ^"1^" // - 1 disable VPNDetector^n")
fprintf(MainConfig,"shield_vpn_detector_key ^"70968l-0233p8-6115a0-92173c^" // is public key for vpndetector^n")
fprintf(MainConfig,"//Keys^n15665u-828487-i7813a-50716k^n")
fprintf(MainConfig,"1715kt-b792y9-997598-4j5kz0^n")
fprintf(MainConfig,"t5b15a-117b8f-s1033s-9a53z2^n")
fprintf(MainConfig,"9zt0i3-fz55u0-1wb5l2-rq98cj^n")
fprintf(MainConfig,"36o747-529906-30c314-62a64u^n")
fprintf(MainConfig,"9su059-01948v-f03340-56ji45^n")
fclose(MainConfig)
}
}
stock SV_ForceFullClientsUpdate(){
if(ServerVersion == 0){
long2=OrpheuGetFunction("SV_ForceFullClientsUpdate")
Expand Down Expand Up @@ -1509,6 +1545,7 @@ public Register_Settings()
fprintf(FileVar,"shield_remove_string ^"_setgamedir^"^n^n")


fprintf(FileVar,"shield_os_system 1^n")
fprintf(FileVar,"shield_name_char_fix 1^n")
fprintf(FileVar,"shield_chat_char_fix 1^n")
fprintf(FileVar,"shield_sv_connectclient_filter_option 1^n")
Expand Down Expand Up @@ -2355,6 +2392,213 @@ public RegisterOkapiWindows_unfreeze3(){
}
else{ErrorSignature();memory=27;}
}

//http

/*
HTTP
v0.4b
by bugsy
*/

#if defined _http_included
#endinput
#endif
#define _http_included

#if !defined _engine_included
#include <engine>
#endif

#if !defined _socket_included
#include <sockets>
#endif

const MAX_DOWNLOAD_SLOTS = 10;
const BUFFER_SIZE = 4096;
const Float:THINK_INTERVAL = 0.01;

enum DownloadInfo
{
Server[ 64 ],
RemoteFile[ 128 ],
LocalFile[ 128 ],
FileHandle,
Socket,
PacketNum,
BytesTransferred,
FileSize,
DownloadID
}

stock HTTP[ MAX_DOWNLOAD_SLOTS ][ DownloadInfo ] , g_HTTPEntity , g_Forward , g_iDownloadID , g_iPluginID = INVALID_PLUGIN_ID , g_DataBuffer[ BUFFER_SIZE ];

stock HTTP_DownloadFile( const szRemoteFile[] , const szLocalFile[] )
{
new iSlot;
for ( iSlot = 0 ; iSlot < MAX_DOWNLOAD_SLOTS ; iSlot++ )
{
if ( !HTTP[ iSlot ][ DownloadID ] )
break;
else if ( iSlot == ( MAX_DOWNLOAD_SLOTS - 1 ) )
return 0;
}

strtok( szRemoteFile[ ( equali( szRemoteFile , "http://" , 7 ) ? 7 : 0 ) ] ,
HTTP[ iSlot ][ Server ] , charsmax( HTTP[][ Server ] ) ,
HTTP[ iSlot ][ RemoteFile ] , charsmax( HTTP[][ RemoteFile ] ) , '/' );
trim( HTTP[ iSlot ][ Server ] );

copy( HTTP[ iSlot ][ LocalFile ] , charsmax( HTTP[][ LocalFile ] ) , szLocalFile );
if ( !( HTTP[ iSlot ][ FileHandle ] = fopen( HTTP[ iSlot ][ LocalFile ] , "wb" ) ) )
{
//log_amx( "HTTP: Error creating local file" );
return 0;
}

new iError;
if ( ( HTTP[ iSlot ][ Socket ] = socket_open( HTTP[ iSlot ][ Server ] , 80 , SOCKET_TCP , iError ) ) && !iError )
{
new szRequest[ 27 + charsmax( HTTP[][ Server ] ) + charsmax( HTTP[][ RemoteFile ] ) ];

if ( g_iPluginID == INVALID_PLUGIN_ID )
{
new szFile[ 64 ] , szTmp[ 1 ];
get_plugin( -1 , szFile , charsmax( szFile ) , szTmp , 0 , szTmp , 0, szTmp , 0 , szTmp , 0 );
g_iPluginID = find_plugin_byfile( szFile , 0 );
}

if ( !g_HTTPEntity )
{
g_HTTPEntity = create_entity( "info_target" );
entity_set_string( g_HTTPEntity , EV_SZ_classname , "http_entity" );
entity_set_float( g_HTTPEntity , EV_FL_nextthink , get_gametime() + THINK_INTERVAL );

if ( !g_iDownloadID )
register_think( "http_entity" , "_HTTP_EntityThink" );

g_Forward = CreateOneForward( g_iPluginID , "HTTP_Download" , FP_STRING , FP_CELL , FP_CELL , FP_CELL , FP_CELL );
}

HTTP[ iSlot ][ PacketNum ] = 0;
HTTP[ iSlot ][ BytesTransferred ] = 0;
HTTP[ iSlot ][ FileSize ] = 0;

formatex( szRequest , charsmax( szRequest ) , "GET /%s HTTP/1.1^r^nHost: %s^r^n^r^n" , HTTP[ iSlot ][ RemoteFile ] , HTTP[ iSlot ][ Server ] );
socket_send( HTTP[ iSlot ][ Socket ] , szRequest , sizeof( szRequest ) );
}
else
{
//log_amx( "HTTP: Error creating socket [Error=%d]" , iError );
return 0;
}

return ( ( HTTP[ iSlot ][ DownloadID ] = ++g_iDownloadID ) );
}

stock HTTP_AbortTransfer( iDownloadID , bool:bDeleteLocalFile=true )
{
new iSlot , bool:bSuccess;
for ( iSlot = 0 ; iSlot < MAX_DOWNLOAD_SLOTS ; iSlot++ )
{
if ( iDownloadID == HTTP[ iSlot ][ DownloadID ] )
{
HTTP[ iSlot ][ DownloadID ] = 0;
fclose( HTTP[ iSlot ][ FileHandle ] );
socket_close( HTTP[ iSlot ][ Socket ] );

if ( bDeleteLocalFile )
delete_file( HTTP[ iSlot ][ LocalFile ] );

bSuccess = true;
break;
}
}
return bSuccess;
}

public _HTTP_EntityThink( iEntity )
{
static iSlot , iDataBlocks , iDataStart , iActiveSlots , iRet;

if ( iEntity != g_HTTPEntity )
return;

iActiveSlots = 0;
for ( iSlot = 0 ; iSlot < MAX_DOWNLOAD_SLOTS ; iSlot++ )
{
if ( HTTP[ iSlot ][ DownloadID ] )
{
iActiveSlots++;

if ( socket_change( HTTP[ iSlot ][ Socket ] , 0 ) )
{
if ( ( iDataBlocks = socket_recv( HTTP[ iSlot ][ Socket ] , g_DataBuffer , sizeof( g_DataBuffer ) ) ) )
{
if ( ( ++HTTP[ iSlot ][ PacketNum ] == 1 ) && ( ( iDataStart = strfind( g_DataBuffer , "^r^n^r^n" ) ) > -1 ) )
{
new iContentLength = strfind( g_DataBuffer , "Content-Length: " );
if ( iContentLength > -1 )
{
new iSizeEnd = strfind( g_DataBuffer[ iContentLength + 16 ] , "^r^n" );
if ( iSizeEnd > -1 )
{
g_DataBuffer[ iSizeEnd ] = EOS;
HTTP[ iSlot ][ FileSize ] = str_to_num( g_DataBuffer[ iContentLength + 16 ] );
}
}
iDataStart += 4;
}
else
{
iDataStart = 0;
}

HTTP[ iSlot ][ BytesTransferred ] += fwrite_blocks( HTTP[ iSlot ][ FileHandle ] , g_DataBuffer[ iDataStart ] , ( iDataBlocks - iDataStart ) , BLOCK_BYTE );

if ( HTTP[ iSlot ][ BytesTransferred ] == HTTP[ iSlot ][ FileSize ] )
{
ExecuteForward( g_Forward , iRet , HTTP[ iSlot ][ LocalFile ] , HTTP[ iSlot ][ DownloadID ] , HTTP[ iSlot ][ BytesTransferred ] , HTTP[ iSlot ][ FileSize ] , true );

fclose( HTTP[ iSlot ][ FileHandle ] );
socket_close( HTTP[ iSlot ][ Socket ] );
iActiveSlots--;

HTTP[ iSlot ][ DownloadID ] = 0;
}
else
{
ExecuteForward( g_Forward , iRet , HTTP[ iSlot ][ LocalFile ] , HTTP[ iSlot ][ DownloadID ] , HTTP[ iSlot ][ BytesTransferred ] , HTTP[ iSlot ][ FileSize ] , false );
}
}
else
{
ExecuteForward( g_Forward , iRet , HTTP[ iSlot ][ LocalFile ] , HTTP[ iSlot ][ DownloadID ] , HTTP[ iSlot ][ BytesTransferred ] , HTTP[ iSlot ][ FileSize ] , true );

fclose( HTTP[ iSlot ][ FileHandle ] );
socket_close( HTTP[ iSlot ][ Socket ] );
iActiveSlots--;

HTTP[ iSlot ][ DownloadID ] = 0;
}
}
}
}

if ( iActiveSlots )
{
entity_set_float( g_HTTPEntity , EV_FL_nextthink , get_gametime() + THINK_INTERVAL );
}
else
{
entity_set_int( g_HTTPEntity , EV_INT_flags , FL_KILLME );
call_think( g_HTTPEntity );
g_HTTPEntity = 0;

DestroyForward( g_Forward );
g_Forward = 0;
}
}
#if defined _colorchat_included
#endinput
#endif
Expand Down

0 comments on commit 6ec444b

Please sign in to comment.