text stringlengths 1 81 | start float64 0 10.1k | duration float64 0 24.9 |
|---|---|---|
It just means to figure
out what a password is, | 564.86 | 2.69 |
to brute force your way in. | 567.55 | 1.53 |
I'm going to go ahead and
from a library called string. | 569.08 | 4.14 |
I'm going to go ahead and import digits. | 573.22 | 2.52 |
Now, this is a very easy
way of just giving me | 575.74 | 3 |
access to the numbers 0 through 9. | 578.74 | 1.62 |
I could obviously type them
all out on my keyboard. | 580.36 | 2.385 |
This is a little faster
because this gives me | 582.745 | 1.875 |
like a list of the numbers I care about. | 584.62 | 1.908 |
Now, there's a bunch of different
ways I can write this code. | 586.528 | 2.542 |
But what I really want
to do intuitively is | 589.07 | 2.09 |
try all possible digits
for the first value, | 591.16 | 2.61 |
try all possible digits for
the second, then for the third, | 593.77 | 3.21 |
then for the fourth. | 596.98 | 1.05 |
So one way of doing this
might be as follows. | 598.03 | 2.83 |
I'm going to use a keyword in Python
called for, which just means do | 600.86 | 3.14 |
something for as long as I want you to. | 604 | 2.13 |
And then I'm going to give
myself a variable, like in math, | 606.13 | 2.64 |
just so I can use something
to keep track of each number. | 608.77 | 2.82 |
And I'm going to use a default
value of i for integer. | 611.59 | 2.94 |
And then I'm going to go ahead and
say that for each value i in those 10 | 614.53 | 4.81 |
digits, I want to go ahead
and do the following. | 619.34 | 2.79 |
Well, for each of those i
digits, for the first value, | 622.13 | 3.63 |
I want to do for j in digits as well. | 625.76 | 2.86 |
And then for each value
for my third placeholder, | 628.62 | 3.56 |
I might do something
like for k in digits. | 632.18 | 3.27 |
And then lastly, I might
do for l in digits. | 635.45 | 2.92 |
So this is admittedly
not the best design. | 638.37 | 1.882 |
And those of you who've
programmed before | 640.252 | 1.708 |
are probably cringing that I have this
indentation, indentation, indentation. | 641.96 | 3.852 |
But it's a simple way of demonstrating,
especially for those unfamiliar | 645.812 | 2.958 |
with programming, how we can
try all possible first digits, | 648.77 | 2.91 |
all possible second, all possible
third, all possible fourth. | 651.68 | 3.45 |
And all I'm going to do, bury inside
of this code now is print out the value | 655.13 | 4.26 |
of i, j, k, and l so that iteratively,
we should see on the screen 0000 | 659.39 | 7.5 |
and then all the way up to 9999. | 666.89 | 2.67 |
So if you assume that I've
connected my phone to this laptop, | 669.56 | 3.21 |
ideally, then, we'll have an estimation
of how long it might take until we | 672.77 | 4.39 |
actually have cracked into the device. | 677.16 | 3.28 |
So let's go ahead and do this. | 680.44 | 1.62 |
I'm going to open up a separate
window on my screen here called | 682.06 | 2.66 |
a terminal window. | 684.72 | 1.24 |
And I'm going to go ahead
and run Python of crack.py. | 685.96 | 3.78 |
So in just a moment
we're going to see is | 689.74 | 1.76 |
it going to take a few minutes, a few
milliseconds, a day, four hours, or-- | 691.5 | 4.77 |
here we go. | 696.27 | 1.05 |
1, 2, 3, go. | 697.32 | 5.01 |
So those of you who estimated just
a few milliseconds were spot on. | 702.33 | 4.66 |
So what's the takeaway here? | 706.99 | 1.2 |
Well, apparently using
a four-digit password | 708.19 | 2.39 |
is not very secure at all
because look how quickly | 710.58 | 3.48 |
I, the adversary, the hacker in the
story, was able to get into your phone. | 714.06 | 3.57 |
And in fact, I could probably
unplug it at that point | 717.63 | 1.71 |
because I've gotten whatever
data I care about off your phone. | 719.34 | 2.583 |
And you might not be none the wiser. | 721.923 | 2.107 |
So how can we go about
improving upon this system? | 724.03 | 3.24 |
Well, let me propose that instead
of using a four-digit passcode, | 727.27 | 2.75 |
let's use four letters instead. | 730.02 | 1.618 |
And we'll use English because
that's what I speak well. | 731.638 | 2.292 |
And in English, we have 26 letters
of the alphabet, A through Z. | 733.93 | 3.68 |
But you know what? | 737.61 | 0.78 |
That might give us initially 26
possibilities for the first position, | 738.39 | 4.71 |
times 26, times 26, times 26
for the second through fourth. | 743.1 | 3.72 |
But let me propose that we actually
use lowercase and uppercase letters. | 746.82 | 4.06 |
So that gives me not 26, but 52
possibilities for each location. | 750.88 | 4.8 |
So if I do 52 possibilities,
that's 52 to the fourth power. | 755.68 | 4.82 |
And does anyone want to estimate
how many possible passwords there | 760.5 | 3.48 |
are if I'm using four English
letters now, uppercase or lowercase? | 763.98 | 7.36 |
I'm seeing 26 to the fourth power. | 771.34 | 2.45 |
But that's not right if we're
using uppercase and lowercase. | 773.79 | 2.5 |
It's indeed 52 to the fourth power. | 776.29 | 1.98 |
And I'm seeing "a lot." | 778.27 | 1.95 |
But here we have estimates along the
lines of indeed 7 million as well. | 780.22 | 5.23 |
So with 7 million possibilities,
you might think, OK, surely, | 785.45 | 3.007 |
that's going to be a lot better. | 788.457 | 1.333 |
And it's going to take the adversary
a lot longer to hack into this phone. | 789.79 | 3.083 |
But let's try that. | 792.873 | 0.847 |
Let me go back to my
terminal window here. | 793.72 | 2.44 |
Let me reopen now my code file, and
let's go ahead and use not digits, | 796.16 | 4.22 |
but let's go ahead
and use ASCII letters. | 800.38 | 2.58 |
For those unfamiliar, ASCII
letters are simply the letters A | 802.96 | 4.41 |
through Z in both
uppercase and lowercase. | 807.37 | 3.43 |
Now, here I have to go ahead and change
this from digits to ASCII letters, | 810.8 | 4.34 |
from digits to ASCII letters,
from digits to ASCII letters, | 815.14 | 5.19 |
and lastly, from digits
to ASCII letters. | 820.33 | 2.7 |
Again, there's an easier way
I could implement this code | 823.03 | 2.67 |
to be more succinct
and less duplicative, | 825.7 | 2.28 |
but it involves some features that we'll
introduce in another class altogether. | 827.98 | 4.06 |
But now I have all possible ASCII
letters from my first placeholder | 832.04 | 4.14 |
to the last. | 836.18 | 0.84 |
Let's go ahead and open up
that same terminal window. | 837.02 | 2.49 |
Let's run Python of crack.py. | 839.51 | 1.5 |
And here now is the answer to how
long might it take an adversary | 841.01 | 3.54 |
to get into your phone if you're using
four letters of the English alphabet | 844.55 | 4.5 |
for your password instead. | 849.05 | 3.9 |
So this time, I have enough time to walk
all the way over to the screen here. | 852.95 | 3.61 |
And you can see that we're going in
alphabetical order, first lowercase, | 856.56 | 3.36 |
now uppercase. | 859.92 | 0.65 |
But in just a moment, we are done. | 860.57 | 2.34 |
And we're down all the way to ZZZZ. | 862.91 | 2.67 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.