Created
April 27, 2018 16:40
-
-
Save Phillip-C/ac76e96a4798fc729c8f47f374c47b00 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Data; | |
using System.Diagnostics; | |
using System.IO; | |
using System.Linq; | |
using System.ServiceProcess; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace WindowsService1 | |
{ | |
public partial class VulnService : ServiceBase | |
{ | |
public VulnService() | |
{ | |
InitializeComponent(); | |
} | |
protected override void OnStart(string[] args) | |
{ | |
LogService("Service is Started"); | |
} | |
protected override void OnStop() | |
{ | |
LogService("Service Stoped"); | |
} | |
private void LogService(string content) | |
{ | |
FileStream fs = new FileStream(@"c:\VulnServiceLog.txt", FileMode.OpenOrCreate, FileAccess.Write); | |
StreamWriter sw = new StreamWriter(fs); | |
sw.BaseStream.Seek(0, SeekOrigin.End); | |
sw.WriteLine(content); | |
sw.Flush(); | |
sw.Close(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment