我有这个错误:
Traceback (most recent call last):
File "python_md5_cracker.py", line 27, in <module>
m.update(line)
TypeError: Unicode-objects must be encoded before hashing
Run Code Online (Sandbox Code Playgroud)
当我尝试在Python 3.2.2中执行此代码时:
import hashlib, sys
m = hashlib.md5()
hash = ""
hash_file = input("What is the file name in which the hash resides? ")
wordlist = input("What is your wordlist? (Enter the file name) ")
try:
hashdocument = open(hash_file, "r")
except IOError:
print("Invalid file.")
raw_input()
sys.exit()
else:
hash = hashdocument.readline()
hash = hash.replace("\n", "")
try:
wordlistfile = open(wordlist, …Run Code Online (Sandbox Code Playgroud) 为什么Python print在第9行的简单语句中给出了语法错误?
import hashlib, sys
m = hashlib.md5()
hash = ""
hash_file = raw_input("What is the file name in which the hash resides? ")
wordlist = raw_input("What is your wordlist? (Enter the file name) ")
try:
hashdocument = open(hash_file,"r")
except IOError:
print "Invalid file." # Syntax error: invalid syntax
raw_input()
sys.exit()
else:
hash = hashdocument.readline()
hash = hash.replace("\n","")
Run Code Online (Sandbox Code Playgroud)
Python的版本是:
Python 3.2.2 (default, Sep 4 2011, 09:07:29) [MSC v.1500 64 bit (AMD64)] on win
32
Run Code Online (Sandbox Code Playgroud) 假设您有一个.EXE,并且您想要检查它是否具有命令行选项.如何知道.EXE是否具备此功能.在我的情况下,我知道Nir Sofers WebBrowserPassView.exe能够通过cmd.exe和WebBrowserPassView.exe/stext output.txt启动它.但是我怎么能知道我不知道呢?
我想设置一次返回值,使其进入while循环:
#!/bin/bash
while [ $? -eq 1 ]
do
#do something until it returns 0
done
Run Code Online (Sandbox Code Playgroud)
为了使这个工作,我需要$? = 1在开始时设置,但这不起作用.
我想用grep搜索一个如下所示的字符串:
something ~* 'bla'
Run Code Online (Sandbox Code Playgroud)
我试过这个,但是shell删除了单引号argh ..
grep -i '"something ~* '[:alnum:]'"' /var/log/syslog
Run Code Online (Sandbox Code Playgroud)
什么是正确的搜索?
我有一个包含两个不同列的CSV文件,一个包含PC名称,另一个包含MAC地址,如下所示:
PCxxxx 00-11-22-33-44-55
...
...
Run Code Online (Sandbox Code Playgroud)
这些值应放在以下CLI命令中:
wdsutil /Set-Device /Device:PCxxxx /ID:00-11-22-33-44-55
Run Code Online (Sandbox Code Playgroud)
现在因为它们中有大约200个,我想自动化它.
有兴趣的话,可以批量做吗?这会很复杂,对吧?我想到了数组,但不认为可以批量执行此操作.
也许使用PowerShell它会更容易一些.
比方说,我想用printk()内部arch/x86/boot/string.c编译内核之前.我必须包含哪个头文件,以便链接器知道在哪里找到printk()?我尝试过#include <linux/kernel.h>,#include <linux/printk.h>但在make bzImage告诉我链接器找不到时总是出错printk:
arch/x86/boot/compressed/string.o: In function `memcmp`:
string.c:(.text+0x19): undefined reference to `printk`
Run Code Online (Sandbox Code Playgroud) 我想迭代所有(至少16位)unicode字符并用C在屏幕上打印它们.
我知道有关于SO的相关问题,但它们并没有解决printfC中的问题,但这是我想要实现的,如果它毕竟是可能的.我认为应该可能有一个我不知道的技巧.
既然我想使用printf,我想到了这样的事情:
for (int i = 0x0000; i <= 0xffff; i++) {
//then somehow increment the string
char str[] = "\u25A1\n";
printf("%s", str);
char str[] = "\u25A2\n";
printf("%s", str);
char str[] = "\u25A3\n";
printf("%s", str);
...
}
Run Code Online (Sandbox Code Playgroud)
但是这里增加unicode代码点有点问题\u25A1.我知道它本身不可能,因为有些字符\u0000不可打印,编译器说不.但除此之外,我怎么能从十六进制0000增加到ffff并打印字符printf.
我怎么能测量linux内核响应IRQ需要多长时间?
我可以触发键盘IRQ并开始计算时间但是如何找出ISR何时完成?
根据官方 kernel.org 文档 echo l > /proc/sysrq-trigger应该给我所有 CPU 的当前调用跟踪。但是当我这样做几次并查看dmesg之后,调用跟踪看起来完全相似。这是为什么?
linux ×4
c ×3
linux-kernel ×3
bash ×2
python ×2
python-3.x ×2
syntax-error ×2
unicode ×2
backtrace ×1
batch-file ×1
call ×1
cmd ×1
command-line ×1
escaping ×1
exe ×1
executable ×1
exit-code ×1
gcc ×1
grep ×1
hashlib ×1
interrupt ×1
kernel ×1
powershell ×1
printf ×1
return-value ×1
syntax ×1
sysctl ×1