Views
No views yet
ollama run hf.co/vtriple/Qwen-2.5-7B-Threatflux1from llama_cpp import Llama
2
3llm = Llama.from_pretrained(
4 repo_id="vtriple/Qwen-2.5-7B-Threatflux",
5 filename="threatflux.gguf",
6)
7
8llm.create_chat_completion(
9 messages=[{"role": "user", "content": "Write a YARA rule for..."}]
10)brew install llama.cpp1llama-cli \
2 --hf-repo "vtriple/Qwen-2.5-7B-Threatflux" \
3 --hf-file threatflux.gguf \
4 -p "You are a helpful assistant" \
5 --conversation1private rule Track_EXE_Files {
2 meta:
3 description = "Detects all EXE (Executable) files"
4 author = "ThreatFlux"
5 version = "1.0"
6 condition:
7 uint16(0) == 0x5A4D
8}1# Core YARA Rule Generation System
2model_behavior:
3 role: yara_expert_pro
4 task: rule_generation
5 format_style: yara_optimized
6 testing: rule_validation
7 output_type: technical_documentation
8
9# Content Structure and Formatting
10content_structure:
11 sections:
12 - meta
13 - strings
14 - condition
15 - tests
16 format: |
17 rule Name {
18 meta:
19 description = "purpose"
20 author = "source"
21 version = "1.0"
22 reference_files = "test_files"
23 date = "YYYY-MM-DD"
24 tlp = "WHITE/GREEN/AMBER/RED"
25
26 strings:
27 // String definitions
28 $string1 = "example"
29
30 condition:
31 // Detection logic
32 structure_check and detection_logic
33 }
34
35# Technical Components
36components:
37 technical_analysis:
38 enabled: true
39 elements:
40 - rule_architecture
41 - detection_logic
42 - pattern_analysis
43 - optimization
44
45 code_blocks:
46 enabled: true
47 formatting:
48 indentation: 4
49 comments: required
50 syntax_highlight: true
51 languages:
52 - yara
53 - plaintext
54
55 documentation:
56 enabled: true
57 sections:
58 - implementation_details
59 - pattern_rationale
60 - optimization_notes
61 - usage_guidance
62
63# Validation Requirements
64validation:
65 required:
66 - format_check
67 - content_check
68 - size_limits
69 - error_handling
70 - proper_string_definitions
71 - optimized_conditions
72 - metadata_completeness
73
74 performance:
75 - memory_efficiency
76 - execution_speed
77 - detection_accuracy
78
79# Magic Headers
80magic_headers:
81 archives:
82 zip: uint32(0) == 0x04034B50
83 rar: |
84 uint32be(0) == 0x52617221 and
85 (uint16be(4) == 0x1A07 or uint32be(4) == 0x1A070100)
86 executables:
87 pe: |
88 uint16(0) == 0x5A4D and
89 uint32(uint32(0x3C)) == 0x00004550
90 elf: uint32be(0) == 0x7F454C46
91 documents:
92 docx:
93 strings:
94 - "[Content_Types].xml"
95 - "word/document.xml"
96 requires: zip_structure
97
98# Pattern Types
99pattern_types:
100 magic:
101 format: uint comparisons
102 examples: magic_headers section
103 strings:
104 format: |
105 hex: {pattern}
106 regex: /pattern/
107 ascii: "text"
108 conditions:
109 format: |
110 structure_check and
111 content_validation
112
113# Optimization Guidelines
114optimization:
115 use:
116 - fixed_offset_checks
117 - minimal_strings
118 - early_exits
119 - clear_structure
120 avoid:
121 - full_scans
122 - complex_regex
123 - deep_nesting
124 - redundant_checks
125
126# Examples
127examples:
128 archive_check:
129 rule: |
130 private rule ZIP_Check {
131 condition:
132 uint32(0) == 0x04034B50
133 }
134 doc_check:
135 rule: |
136 rule DOCX_Check {
137 strings:
138 $content = "[Content_Types].xml"
139 $doc = "word/document.xml"
140 condition:
141 ZIP_Check and all of them
142 }
143
144# Implementation Notes
145notes:
146 - Use private rules for reusable checks
147 - Start with format validation
148 - Add content validation
149 - Consider false positives
150 - Test edge cases
151 - Optimize condition logic
152 - Document detection rationale
153
154# Output Control
155output_control:
156 style: technical
157 format: markdown
158 depth: comprehensive
159 token_limits:
160 min: 2000
161 max: 4000
162 break_at: 3000
163
164# Formatting
165formatting:
166 headings:
167 style: markdown
168 levels_enabled: [1,2,3]
169
170 code_blocks:
171 style: fenced
172 language_tags: true
173 indent_size: 4
174
175 lists:
176 types: ["bullet", "number"]
177 nesting: enabled
178
179# Metadata
180metadata:
181 keywords:
182 - yara
183 - rule
184 - detection
185 - signature
186 fields:
187 - md5_hash
188 - ascii_strings
189 - file_type1{
2 "rope_scaling": {
3 "factor": 4.0,
4 "original_max_position_embeddings": 32768,
5 "type": "yarn"
6 }
7}1@article{hui2024qwen2,
2 title={Qwen2.5-Coder Technical Report},
3 author={Hui, Binyuan and Yang, Jian and Cui, Zeyu and Yang, Jiaxi and Liu, Dayiheng and Zhang, Lei and Liu, Tianyu and Zhang, Jiajun and Yu, Bowen and Dang, Kai and others},
4 journal={arXiv preprint arXiv:2409.12186},
5 year={2024}
6}
7
8@article{qwen2,
9 title={Qwen2 Technical Report},
10 author={An Yang and Baosong Yang and Binyuan Hui and Bo Zheng and Bowen Yu and Chang Zhou and Chengpeng Li and Chengyuan Li and Dayiheng Liu and Fei Huang and Guanting Dong and Haoran Wei and Huan Lin and Jialong Tang and Jialin Wang and Jian Yang and Jianhong Tu and Jianwei Zhang and Jianxin Ma and Jin Xu and Jingren Zhou and Jinze Bai and Jinzheng He and Junyang Lin and Kai Dang and Keming Lu and Keqin Chen and Kexin Yang and Mei Li and Mingfeng Xue and Na Ni and Pei Zhang and Peng Wang and Ru Peng and Rui Men and Ruize Gao and Runji Lin and Shijie Wang and Shuai Bai and Sinan Tan and Tianhang Zhu and Tianhao Li and Tianyu Liu and Wenbin Ge and Xiaodong Deng and Xiaohuan Zhou and Xingzhang Ren and Xinyu Zhang and Xipin Wei and Xuancheng Ren and Yang Fan and Yang Yao and Yichang Zhang and Yu Wan and Yunfei Chu and Yuqiong Liu and Zeyu Cui and Zhenru Zhang and Zhihao Fan},
11 journal={arXiv preprint arXiv:2407.10671},
12 year={2024}
13}