├── .github └── workflows │ └── main.yml ├── ChangeTimestamp ├── ChangeTimestamp.sln └── ChangeTimestamp │ ├── ChangeTimestamp.csproj │ ├── Program.cs │ └── Properties │ └── AssemblyInfo.cs ├── LICENSE ├── README.md └── test.png /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Build ChangeTimestamp 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | 9 | jobs: 10 | build: 11 | strategy: 12 | matrix: 13 | configuration: [Release] 14 | 15 | runs-on: windows-2019 16 | 17 | steps: 18 | - name: Checkout 19 | uses: actions/checkout@main 20 | with: 21 | fetch-depth: 0 22 | 23 | - name: Setup MSBuild 24 | uses: microsoft/setup-msbuild@v1.0.2 25 | 26 | - name: Install NuGet Packages 27 | run: nuget restore ChangeTimestamp\ChangeTimestamp.sln 28 | 29 | - name: Build solution 30 | run: msbuild -nologo -v:m -p:Configuration=${{ matrix.configuration }} ChangeTimestamp\ChangeTimestamp.sln 31 | 32 | - name: Install 7Zip PowerShell Module 33 | shell: powershell 34 | run: Install-Module 7Zip4PowerShell -Force -Verbose 35 | 36 | - name: Build Artifact 37 | shell: powershell 38 | run: Compress-7Zip "ChangeTimestamp\ChangeTimestamp\bin\Release" -ArchiveFileName "ChangeTimestamp.zip" -Format Zip 39 | 40 | - name: Delete-tag-and-release 41 | uses: dev-drprasad/delete-tag-and-release@v0.2.1 42 | with: 43 | delete_release: true 44 | tag_name: AutoBuild-Controler 45 | env: 46 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 47 | 48 | - name: Create Release 49 | id: create_release 50 | uses: actions/create-release@latest 51 | env: 52 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 53 | with: 54 | tag_name: AutoBuild-Controler 55 | release_name: AutoBuild-Controler 56 | body: ${{ steps.changelog.outputs.changelog }} 57 | draft: false 58 | prerelease: true 59 | 60 | - name: Upload Release Asset 61 | id: upload-release-asset 62 | uses: actions/upload-release-asset@v1 63 | env: 64 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 65 | with: 66 | upload_url: ${{ steps.create_release.outputs.upload_url }} 67 | asset_path: ./ChangeTimestamp.zip 68 | asset_name: ChangeTimestamp.zip 69 | asset_content_type: application/zip 70 | -------------------------------------------------------------------------------- /ChangeTimestamp/ChangeTimestamp.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.33027.164 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChangeTimestamp", "ChangeTimestamp\ChangeTimestamp.csproj", "{D114E96D-3EF0-4F82-83E9-E604A30980A2}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {D114E96D-3EF0-4F82-83E9-E604A30980A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {D114E96D-3EF0-4F82-83E9-E604A30980A2}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {D114E96D-3EF0-4F82-83E9-E604A30980A2}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {D114E96D-3EF0-4F82-83E9-E604A30980A2}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {F69342B7-C2CD-48B2-840A-4151A5F34B94} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /ChangeTimestamp/ChangeTimestamp/ChangeTimestamp.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {D114E96D-3EF0-4F82-83E9-E604A30980A2} 8 | Exe 9 | ChangeTimestamp 10 | ChangeTimestamp 11 | v4.0 12 | 512 13 | true 14 | 15 | 16 | AnyCPU 17 | false 18 | none 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | Auto 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /ChangeTimestamp/ChangeTimestamp/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace ChangeTimestamp 5 | { 6 | class Program 7 | { 8 | static void Main(string[] args) 9 | { 10 | if (args.Length < 2) 11 | { 12 | Console.WriteLine("Usage: ChangeTimestamp filepath timestamp"); 13 | return; 14 | } 15 | 16 | string filePath = args[0]; 17 | DateTime timestamp = DateTime.Parse(args[1] + " " + args[2]); 18 | 19 | byte[] fileData; 20 | using (FileStream stream = File.OpenRead(filePath)) 21 | { 22 | fileData = new byte[stream.Length]; 23 | stream.Read(fileData, 0, fileData.Length); 24 | } 25 | 26 | int peHeaderOffset = BitConverter.ToInt32(fileData, 0x3C); 27 | int timestampOffset = peHeaderOffset + 8; 28 | int timestampValue = (int)(timestamp.ToUniversalTime() - new DateTime(1970, 1, 1)).TotalSeconds; 29 | byte[] timestampBytes = BitConverter.GetBytes(timestampValue); 30 | 31 | fileData[timestampOffset + 0] = timestampBytes[0]; 32 | fileData[timestampOffset + 1] = timestampBytes[1]; 33 | fileData[timestampOffset + 2] = timestampBytes[2]; 34 | fileData[timestampOffset + 3] = timestampBytes[3]; 35 | 36 | using (FileStream stream = File.OpenWrite(filePath)) 37 | { 38 | stream.Write(fileData, 0, fileData.Length); 39 | } 40 | File.SetCreationTime(filePath, timestamp); 41 | File.SetLastWriteTime(filePath, timestamp); 42 | File.SetLastAccessTime(filePath, timestamp); 43 | 44 | DateTime creationTime = File.GetCreationTime(filePath); 45 | DateTime lastWriteTime = File.GetLastWriteTime(filePath); 46 | DateTime lastAccessTime = File.GetLastAccessTime(filePath); 47 | 48 | Console.WriteLine("Change file timestamp successfully."); 49 | Console.WriteLine("Compilation time: " + timestamp); 50 | Console.WriteLine("Creation time: " + creationTime); 51 | Console.WriteLine("Last write time: " + lastWriteTime); 52 | Console.WriteLine("Last access time: " + lastAccessTime); 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /ChangeTimestamp/ChangeTimestamp/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ChangeTimestamp")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ChangeTimestamp")] 13 | [assembly: AssemblyCopyright("")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("d114e96d-3ef0-4f82-83e9-e604a30980a2")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Sora 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ChangeTimestamp 2 | 一键修改exe、dll的编译时间、创建时间、修改时间和访问时间 3 | 4 | 某杀软会对时间较新且未扫描过的文件设置很高的可疑分数,通常大家只会改创建时间和修改时间,而virustotal还会识别**编译时间**,使用本脚本可一键修改**exe**、**dll**的**编译时间**、**创建时间**、**修改时间**和**访问时间**。 5 | 6 | 灵感来自此项目https://github.com/qigpig/changeTime 7 | 8 | ### Deployment 9 | 10 | - Build:vs2019 11 | - Runtime:NET Framework 4.0 12 | - 可选择对应系统NET Framework环境编译 13 | 14 | ### Usage 15 | ChangeTimestamp filepath timestamp 16 | ![test](https://github.com/sorabug/ChangeTimestamp/blob/main/test.png) 17 | -------------------------------------------------------------------------------- /test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sorabug/ChangeTimestamp/df43174c283d55a9a3a5f01b899ce6edcc72f0b3/test.png --------------------------------------------------------------------------------