Skip to content

Commit

Permalink
Merge pull request #4 from coj337/Develop
Browse files Browse the repository at this point in the history
Add continous spraying and persistant storage
  • Loading branch information
coj337 committed Jul 16, 2021
2 parents 9083663 + f03a5e8 commit 0daeadf
Show file tree
Hide file tree
Showing 16 changed files with 434 additions and 9 deletions.
4 changes: 3 additions & 1 deletion ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,12 @@ TheSprayer.exe -p Passwords.txt -f
-s, --Server Required. The IP or hostname of a domain controller
-U, --Username Required. Username for domain user to enumerate policies
-P, --Password Required. Password for domain user to enumerate policies
-p, --PasswordList Required. A file containing a line delimited list of passwords or a single password to try
-u, --UserList A file containing a line delimited list of usernames or a single user to try
-p, --PasswordList Required. A file containing a line delimited list of passwords or a single password to try
-o, --OutFile File to output found credentials
-a, --AttemptsRemaining Amount of attempts to leave per-account before lockout (Default: 2)
-c, --Continuous Continuously spray credentials, waiting between attempts to prevent lockout.
-n, --NoDb Disable using a DB to store previously sprayed creds.
-f, --Force Force authentication attempts, even users close to lockout
--help Display this help screen.
```
Expand Down
6 changes: 6 additions & 0 deletions TheSprayer/CommandLineOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ public class CommandLineOptions
[Option('a', "AttemptsRemaining", Required = false, HelpText = "Amount of attempts to leave per-account before lockout (Default: 2)")]
public int AttemptsRemaining { get; set; }

[Option('c', "Continuous", Required = false, HelpText = "Continuously spray credentials, waiting between attempts to prevent lockout.")]
public bool Continuous { get; set; }

[Option('n', "NoDb", Required = false, HelpText = "Disable using a DB to store previously sprayed creds.")]
public bool NoDb { get; set; }

[Option('f', "Force", Required = false, HelpText = "Force authentication attempts, even users close to lockout")]
public bool Force { get; set; }
}
Expand Down
42 changes: 42 additions & 0 deletions TheSprayer/Db/20210716054454_InitialMigration.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions TheSprayer/Db/20210716054454_InitialMigration.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace TheSprayer.Db
{
public partial class InitialMigration : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Attempts",
columns: table => new
{
Id = table.Column<string>(type: "TEXT", nullable: false),
Username = table.Column<string>(type: "TEXT", nullable: true),
Password = table.Column<string>(type: "TEXT", nullable: true),
LastSprayTime = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Attempts", x => x.Id);
});
}

protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Attempts");
}
}
}
43 changes: 43 additions & 0 deletions TheSprayer/Db/20210716060345_AddAutoKey.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions TheSprayer/Db/20210716060345_AddAutoKey.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Microsoft.EntityFrameworkCore.Migrations;

namespace TheSprayer.Db
{
public partial class AddAutoKey : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{

}

protected override void Down(MigrationBuilder migrationBuilder)
{

}
}
}
46 changes: 46 additions & 0 deletions TheSprayer/Db/20210716061202_AddSuccess.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions TheSprayer/Db/20210716061202_AddSuccess.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Microsoft.EntityFrameworkCore.Migrations;

namespace TheSprayer.Db
{
public partial class AddSuccess : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "Success",
table: "Attempts",
type: "INTEGER",
nullable: false,
defaultValue: false);
}

protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Success",
table: "Attempts");
}
}
}
20 changes: 20 additions & 0 deletions TheSprayer/Db/SprayDbContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Microsoft.EntityFrameworkCore;
using System.Reflection;
using TheSprayer.Models;

namespace TheSprayer.Db
{
public class SprayDbContext : DbContext
{
public DbSet<CredentialAttempt> Attempts { get; set; }

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlite("Filename=TheSprayer.db", options =>
{
options.MigrationsAssembly(Assembly.GetExecutingAssembly().FullName);
});
base.OnConfiguring(optionsBuilder);
}
}
}
44 changes: 44 additions & 0 deletions TheSprayer/Db/SprayDbContextModelSnapshot.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using TheSprayer.Db;

namespace TheSprayer.Db
{
[DbContext(typeof(SprayDbContext))]
partial class SprayDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "5.0.8");

modelBuilder.Entity("TheSprayer.Models.CredentialAttempt", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<DateTime>("LastSprayTime")
.HasColumnType("TEXT");
b.Property<string>("Password")
.HasColumnType("TEXT");
b.Property<bool>("Success")
.HasColumnType("INTEGER");
b.Property<string>("Username")
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Attempts");
});
#pragma warning restore 612, 618
}
}
}
15 changes: 15 additions & 0 deletions TheSprayer/Models/CredentialAttempt.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.ComponentModel.DataAnnotations.Schema;

namespace TheSprayer.Models
{
public class CredentialAttempt
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public string Id { get; set; }
public string Username { get; set; }
public string Password { get; set; }
public bool Success { get; set; }
public DateTime LastSprayTime { get; set; }
}
}
3 changes: 2 additions & 1 deletion TheSprayer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.IO;
using TheSprayer.Helpers;
using TheSprayer.Services;

namespace TheSprayer
{
Expand Down Expand Up @@ -86,7 +87,7 @@ public static void Main(string[] args)
}
var adService = new ActiveDirectoryService(o.Domain, o.Username, o.Password, o.DomainController);
adService.SprayPasswords(passwords, users, remainingAttempts, o.OutFile, o.Force);
adService.SprayPasswords(passwords, users, remainingAttempts, o.OutFile, o.Continuous, o.NoDb, o.Force);
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion TheSprayer/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"TheSprayer": {
"commandName": "Project",
"commandLineArgs": "-d windomain.local -s 192.168.38.102 -U vagrant -P vagrant -p Passwords.txt"
"commandLineArgs": "-p vagrant -U vagrant -P vagrant -d windomain.local -s 192.168.38.102"
}
}
}
Loading

0 comments on commit 0daeadf

Please sign in to comment.