|
No.
That is a poor attempt at a password cracker, which is a product designed to circumvent legitimate security measures.
We do not condone, support, or assist in the production of malicious code in any way, form, or manner. This is a professional site for professional developers.
If you want to know how to create such things, you need to visit a hacking site: but be sure to disable all firewalls and antivirus products first or they won't trust you enough to tell you.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Hi this is just for education purpose. I don't think there is any legitimate system that can be cracked that way.
Obviously most if not all systems will lock an account after a few attempts
|
|
|
|
|
Your homework is to write malicious code?
Yeah, right ... We don't do your homework either, malicious or not.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Member 12588963 wrote: I don't think there is any legitimate system that can be cracked that way.
Oh really? How naive of you to try to write something that's already been done innumerable times then.
Why would anyone want to write something like this? BECAUSE THEY ACTUALLY WORKED ON REAL SYSTEMS!
You don't need to check the hashed password against the real system. All you need is a copy of the account database. You can then run as many checks as you want against the database with nothing "locking you out after a few attempts".
|
|
|
|
|
Hi!
I am trying to find the best way to transform a list of objects and sort based on custom order:
I have a list of profile duplicates, and need to find "top" profile based on a priority order. The top profile need to be transformed into a new object with 3 properties. These 3 properties also dictate the sort order.
The 3 new enum-based properties are:
ProfileType with types (SuperUser > NormalUser > Beginner),
ProfileSubType with types (Internal > External),
ProfileValidity with types (Valid > ValidInFuture > Expire)
The properties are based on enums from an external source and are out of order, so I need to have my own custom sort for each of them.
So e.g. a prioritized list would look like:
{Superuser, Internal, Valid},
{Superuser, Internal, Expired},
{Superuser, External, Valid},
{Normaluser, Internal, Valid},
{Beginner, Internal, Expire}
Right now my solution is this:
TransformedProfile = profileList.Select(x => new TransformedProfile
{
ProfileType = GetProfileType(x.PropertyA),
ProfileSubType = GetProfileSubType(x.PropertyB),
ProfileValidity = GetValidity(x.StartDate, x.ExpiryDate)
})
.OrderBy(y => typePriorityDict[y.ProfileType])
.ThenBy(y => subTypePriorityDict[y.ProfileSubType])
.ThenBy(y => validityPriorityDict[y.ProfileValidity])
.FirstOrDefault();
The typePriorityDict , subTypePriorityDict , validityPriorityDict are dictionaries with my custom sort order.
This solution works ok and gives me the desired result. But I was wondering if there are more efficient ways of doing this?
|
|
|
|
|
You could implement IComparable and IComparer[^] in your class, and as a bonus you gain equality, greater than, and less than operators for the class directly.
Your sorting then becomes a whole load more readable.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
OriginalGriff wrote: as a bonus you gain equality, greater than, and less than operators for the class directly
Only if you implement them yourself, although the implementation is fairly trivial.
public static bool operator <(Foo left, Foo right) => left is null || left.CompareTo(right) < 0;
public static bool operator <=(Foo left, Foo right) => left is null || left.CompareTo(right) <= 0;
public static bool operator >=(Foo left, Foo right) => left != null && left.CompareTo(right) >= 0;
public static bool operator >(Foo left, Foo right) => left != null && left.CompareTo(right) > 0;
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
It looks like you are only looking for the highest single item, not getting a complete sorted list, which is what your question seems to imply that you are looking for. But on the assumption that the .FirstOrDefault does give you what you want ...
I am not sure whether any efficiency savings would be sufficiently significant, but I would consider combining the priorities into a single value using const / enums rather than using dictionary lookups and only sorting the list once against a single key. e.g. (my C# is a little rusty, so forgive syntax errors)
[Flags]
enum YourRevisedPriority
{
SuperUser = &x0000,
NormalUser = &x0100,
Beginner = &x0200,
Internal = &x0000,
External = &x0010,
Valid = &x0000,
ValidInFuture = &x0001,
Expire = &x0002
}
TransformedProfile = profileList.Select(x => new TransformedProfile
{
ProfileType = GetProfileType(x.PropertyA),
ProfileValidity = GetValidity(x.StartDate, x.ExpiryDate),
NewPriority =
(ProfileType == SourceEnum.SuperUser ? YourRevisedPriority.SuperUser : (ProfileType == SourceEnum.NormalUser ? YourRevisedPriority.NormalUser : YourRevisedPriority.Beginner)) +
(GetProfileSubType(x.PropertyB) == SourceEnum.Internal ? YourRevisedPriority.Internal : YourRevisedPriority.External) +
(ProfileValidity == SourceEnum.Valid ? YourRevisedPriority.Valid : (ProfileValidity == SourceEnum.ValidInFuture ? YourRevisedPriority.ValidInFuture : YourRevisedPriority.Expire))
})
.OrderBy(y => y.NewPriority)
.FirstOrDefault();
|
|
|
|
|
Thanks for the suggestions! I ended up following @OriginalGriff suggestion and implemented IComparer for the TransformedProfile and IComparer for a custom sort-list, to allow for some short-circuit comparison (and also allowed me to put not-found values last in the sort).
Thanks!
|
|
|
|
|
You're welcome!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Hello all,
So basically, in my programming the user can press the default key that i have set, which is F1, to enable a feature. However, i want the user to be able to change this key. so for example, a dialog pops up and asks them to enter the key they want to set for that feature then it changes the F1 (default key) to the new key that the user chose. How do i do this?
|
|
|
|
|
Firstly, don't use F1 for that: the Windows standard use for F1 is "Help", and it's a bad idea to "play" with standard keys - the user can if he wishes, but you shouldn't as it gets confusing.
The simplest way is to have a Dictionary of keys, and Func values:
private Dictionary<Keys, Func<int>> keyFunctions = new Dictionary<Keys, Func<int>>();
private int A()
{
Console.WriteLine("A");
return 1;
}
private int B()
{
Console.WriteLine("B");
return 2;
}
private int C()
{
Console.WriteLine("C");
return 3;
}
...
keyFunctions.Add(Keys.A, A);
keyFunctions.Add(Keys.B, B);
keyFunctions.Add(Keys.C, C);
...
You can then call the method by accessing the Dictionary with the Key value:
Console.WriteLine(keyFunctions[Keys.C]());
Console.WriteLine(keyFunctions[Keys.B]());
Console.WriteLine(keyFunctions[Keys.A]());
You can use Action instead of Func if your methods do not return a value, but that makes the Add operation more complex:
keyFunctions.Add(Keys.A, () => A());
keyFunctions.Add(Keys.B, () => B());
keyFunctions.Add(Keys.C, () => C());
You can then change the Keys value as you need, and process the Dictionary in your Forms ProcessCmdKey override provided you have set the Form.KeyPreview to true .
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I have a solution as graphically. I need programmatic code for enable and disable scrollbars on datagridview using C# windows application...
tnq in advanced,
Rajasekaran Bose
|
|
|
|
|
|
I am working to build up a GPIB : VISA driver for the IVI and NI models. There is very spare code examples and documentation without some guidance is difficult. Can anyone point me in the right direction. Note the older NationalInstrument.VISANS driver will no longer compile or work under VS2019.
If you have any example code that would be cool.
|
|
|
|
|
|
|
This is why I don't use the NI NET assemblies: the good old Visa32.dll (C/C++ style, not NET) didn't change since probably 20 years and does not depend on the VS version because it binds at runtime only (NB. see answer to your question about my article/software). It is less user friendly than IVI though, I admit.
modified 1-Jul-20 0:56am.
|
|
|
|
|
For the next C# version I would like the ability to have multiple classes with the same name.
But, this is for POCO's
What do I mean?
I have an poco with the name CandidateFunction
public class CandidateFunction
{
public int CandidateFunctionId { get; set; }
public int CandidateId { get; set; }
public int FunctionId { get; set; }
public string Skills { get; set; }
public DateTime Date { get; set; }
}
As you can see, the property with the name Skills is a string.
It can be a long string and it stores one or more Skills.
But customers want to see Skills as a list so I have another POCO
public class CandidateFunctionWithSkillsList
{
public int CandidateFunctionId { get; set; }
public int CandidateId { get; set; }
public int FunctionId { get; set; }
public List<Skill> Skills { get; set; }
public DateTime Date { get; set; }
}
It has another name.
Now, I want both POCO's with the same name. I know there alternatives for what I want but I don't like them.
So, when I instantiate a new CandidateFunction, I want a popup asking me which one I want to use.
Will this ever happen and if not, why not?
|
|
|
|
|
Wiep Corbier wrote: Will this ever happen and if not, why not?
No, because you create a instances of your class at run-time, and you don't want the user to be presented with a pop-up when your application is running asking them to pick which class to instantiate.
You can already have different classes with the same name if they're in different namespaces.
You can have different classes with the same name and namespace if they're in different assemblies, with no reference between the two. But they're an absolute pain to use. You have to create an "external alias" for each reference in order to disambiguate them.
Computers aren't magic. They can't "guess" which class you meant to use. And if two classes have the same name in the same namespace, with no "external alias" to disambiguate them, then there is no way for the computer to uniquely represent the class you want to use.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Quote: Computers aren't magic. They can't "guess" which class you meant to use.
But anything else computers can guess?
It's not up to me to solve this problem. That's up to the people that invent new possibilities for c#.
I think it can happen but no one has ever ask this option.
So, get things done, make it happen.
|
|
|
|
|
But that's the point - it's not a problem. Nobody is seriously asking for the ability to have multiple classes with the same name in the same namespace in the same assembly. It just makes no sense.
Imagine everyone in your office was called Wiep. If you put a message up on the wall saying "Wiep, call me urgently! - Wiep", would anyone have the first clue who was supposed to call whom? It would just be utter chaos. You'd have to find some way to disambiguate your names in order to work.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
The point is Richard, I understand the problems.
But imagine this. You work in a office room with a colleguea also called Richard.
A person walkes in and asks for Richard. People will ask, which Richard? (popup intelli)
Got it?
I know it doesn't work yet, and I know why.
I just want it to work in the future.
ps. C# (8?) now has the ability to work around null values in classes.
Who asked for that? I didn't.
Who cares? No one.
But it's there anyway.
Just....progress
|
|
|
|
|
Wiep Corbier wrote: People will ask, which Richard?
There has to be some way to disambiguate the two people. Usually you would use the surname.
It's no different with classes. If you have two classes with the same name, then they have to be in different namespaces so that you can disambiguate them.
Otherwise, even if you could come up with an intellisense popup to let you pick a class - which could be difficult if the only difference is one character on line 42! - there would be no way to represent that choice in the compiled program.
And before you suggest that the compiler could generate some form of "mangled" name to uniquely identify the class, remember that you'd also have to represent that choice in the source code. And the source code is meant to be read by humans. There are enough arguments against using var when the type isn't clear, without making an explicit variable type ambiguous as well!
Wiep Corbier wrote: C# (8?) now has the ability to work around null values in classes.
Who asked for that? I didn't.
Who cares? No one.
Lots of people asked for it, and lots of people care. You can probably find the history in the C# Language Design repository:
GitHub - dotnet/csharplang: The official repo for the design of the C# programming language[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Richard Deeming wrote: There has to be some way to disambiguate the two people. Usually you would use the surname. Doesn't always work. In my family history, there is a case of three boys, born of the same parents, two of them in the same year, all with the same name. The first one was born shortly after New Year, but lived for only a few days - long enough to be baptized. The second one was born in December the same year, and lived for about a year. The third one, born a couple of years later, grew up to an adult.
When I looked up the name of their paternal grandfather, I was not very surprised: The three boys were named after him. In those days, having a heir to carry your name on, one who grew up to carry the lineage on, was essential.
But I digress.
|
|
|
|
|