给定md5哈希时如何查找特定文件(How to find specific file when given md5 Hash)
我们的服务器已被标记为僵尸网络的一部分,我们已经获得了所谓的坏文件的md5哈希值。
我读过的所有例子和建议都不符合我的要求。 我正在寻找的是如何根据我们给出的md5哈希找到这个特定的文件。
我是否需要为计算机上的每个文件生成md5哈希值然后进行比较,或者是否有更简单的方法来搜索它? 如果没有,我该怎么做呢?
Our server has been flagged as being part of a botnet, and we've been given the md5 hash values of the supposedly bad files.
All the examples and suggestions I've read don't quite match what I need. All I'm looking for is how to find this specific file based on the md5 hash we've been given.
Do I need to generate an md5 hash for each file on the computer and then compare it, or is there some easier way to search for this? If not, how would I go about this?
原文:https://stackoverflow.com/questions/31209647
最满意答案
所以你想要做的就是将输入的电子邮件地址转换为小写。 您可以通过继承auth公司并为该字段添加一个干净的方法来完成此操作:
class EmailAuthForm(AuthenticationForm): def clean_username(self): return self.cleaned_data["username"].lower()
现在通过urls.py在视图中使用它。
url(r'^login/$', auth_views.LoginView.as_view(authentication_form=EmailAuthForm), name="login")
So it seems that all you want to do is convert the entered email address to lower case. You can do this by subclassing the auth firm and adding a clean method for the field:
class EmailAuthForm(AuthenticationForm): def clean_username(self): return self.cleaned_data["username"].lower()
And now use this in the view via urls.py.
url(r'^login/$', auth_views.LoginView.as_view(authentication_form=EmailAuthForm), name="login")
相关问答
更多-
用ACCOUNT_FORMS覆盖Django allauth登录表单(Overriding Django allauth login form with ACCOUNT_FORMS)[2023-05-14]
根据我的理解,您可以使用ACCOUNT_FORMS覆盖默认的LoginForm,但您需要提供一个包含原始类中提供的所有方法的类。 你的班级缺少login方法。 我会在您的settings.py文件中设置ACCOUNT_FORMS = {'login': 'yourapp.forms.YourLoginForm'} ,其中YourLoginForm继承自原始类。 # yourapp/forms.py from allauth.account.forms import LoginForm class You ... -
首先,您不应该编写自己的注册/认证系统。 那里有很多经过试验和测试的解决方案。 Django Allauth浮现在脑海中。 其次,如果您在ajax中发送登录数据,则希望视图返回ajax响应 if user is not None and user.is_active: login(request, user) return JsonResponse({'status': 'ok'}); else: return JsonResponse({'s ...
-
好的,我最终找到了一个这样做的方法,虽然我确定有更好的方法。 我创建了一个名为LoginFormMiddleware的新的中间件类。 在process_request方法中,或多或少处理形式的auth登录视图: class LoginFormMiddleware(object): def process_request(self, request): # if the top login form has been posted if request.method ...
-
django在创建和维护用户方面一直很有帮助。 看看这个链接。 请评论是否有效。 :-) django have always been helpful with its flexibility in creating & maintaining users. Have a look at this link. Kindly comment if it works or not. :-)
-
我的猜测是因为命名而得到了这个问题。 您将以下内容传递给上下文: form = AuthenticationForm() postform = PostForm(request.POST or None) ... context = { "object_list": queryset, "title": "List", "form": postform, "form2": form } 因此, ...
-
您可以使用包含模板标记来构建自定义标记,如下所示: {% login_form %} 您可能希望将此标记传递给request.get_absolute_uri以便它可以在登录视图的?next={{ request.get_absolute_uri }}参数中使用它,以便用户在登录后可以重定向到当前页面。 这样,您可以在任何模板的任何位置放入登录表单,而不违反DRY原则。 你甚至可以使用类似下面的内容将它嵌入到你的基本模板中: {% if not user.is_authenticated %} {% ...
-
您的请求不会通过process_form_data方法传递。 解决方案1 - 在process_form_data方法中记录用户: form_data = process_form_data(self.request, form_list) def process_form_data(request, form_list) ... 解决方案2 - 使用done方法记录用户: class ProfilWizard(SessionWizardView): template_name = "gestio ...
-
所以你想要做的就是将输入的电子邮件地址转换为小写。 您可以通过继承auth公司并为该字段添加一个干净的方法来完成此操作: class EmailAuthForm(AuthenticationForm): def clean_username(self): return self.cleaned_data["username"].lower() 现在通过urls.py在视图中使用它。 url(r'^login/$', auth_views.LoginView.as_view(auth ...
-
您需要在模板中的
-
Django登录部分(Django login part)[2022-05-06]
请使用return render(request, template_name, context_dict)来呈现模板。 你特有的方式可能剥夺了它的背景。 另外, 看看这个装饰器 , if request.user != None :语句,请使用它而不是当前的装饰器 。 Please use return render(request, template_name, context_dict) to render templates. Your peculiar way probably strips it ...