Шмот 2:12 Мидраш: Mekhilta DeRabbi Yishmael, Shemot Rabbah, Midrash Tanchuma Buber & Midrash Tanchuma

וַיִּ֤פֶן כֹּה֙ וָכֹ֔ה וַיַּ֖רְא כִּ֣י אֵ֣ין אִ֑ישׁ וַיַּךְ֙ אֶת־הַמִּצְרִ֔י וַֽיִּטְמְנֵ֖הוּ בַּחֽוֹל׃

И он смотрел туда и сюда, и когда он увидел, что нет человека, он ударил египтянина и спрятал его в песке.

Mekhilta DeRabbi Yishmael

"by way of the land of the Philistines, for it was near": Near (i.e., "close") is the thing of which the Holy One Blessed be He spoke to Moses (Exodus 2:12): "When you take the people out of Egypt, you will serve G–d on this mountain." Variantly: "for it was near": It afforded easy return to Egypt, viz. (Ibid. 5:3) "Let us go a three days' distance in the desert." Variantly: "for it was near": Close (in time) was the oath that Abraham had sworn to Avimelech, viz. (Genesis 21:23) "And now, swear to me here by G–d that you will not deal with me falsely (by trespassing on my land), or to my son or my grandson," and his grandson was still alive. Variantly: "for it was near": The first war (that with Egypt) was too close to the second (that with Canaan). Variantly: "for it was near": The Canaanites had only recently acquired the land, and (Genesis 15:16) "And they (the Israelites) shall return here in the fourth generation, for the sin of the Amorites is not yet complete."

Mekhilta DeRabbi Yishmael

And whence do we find that he gave his life for Torah? In (Exodus 34:28) "And he was there with the L–rd (to receive the Torah) … Bread he did not eat, etc." And it is written (Devarim 9:10) "And I stayed on the mountain forty days and forty nights, etc." — Because he devoted his life to Torah, it was called by his name. Because he devoted his life to Israel, they were called by his name, viz. (Exodus 32:7) "Go, descend, for your people have wrought corruptly." Now are they not the people of the L–rd? viz. (Devarim 9:29) "For they are Your people and Your inheritance," and (Ezekiel 36:20) "… when it was said of them: These are the people of the L–rd, and they came out of His land." How, then, are we to understand "Go, descend, for your people have wrought corruptly"? Because he devoted his life to them, they were called by his name. And whence do we find that he devoted his life to them? In (Exodus 2:11) "And it was in those days that Moses grew, and he went out to his brothers and he saw their toils," and (bid. 12) "And he turned here and there (… and he smote the Egyptian, etc.") Because he devoted his life to them, they were called by his name.

Shemot Rabbah

“He turned this way and that and saw that there was no man; he smote the Egyptian and concealed him in the sand” (Exodus 2:12).
“He saw that there was no man,” because he was deserving of death. Rabbi Yehuda says: There was no man who would be zealous on behalf of the Holy One blessed be He, and kill him. Rabbi Neḥemya says: He saw that there was no one who would invoke the name of God and kill him. The Rabbis say: He saw that there was no expectation that righteous people would emerge from him or from his descendants until the end of all the generations. When Moses saw this, he consulted with the angels and said to them: ‘Is this one liable for execution?’ They said: ‘Yes.’ That is what is written: “He saw that there was no man” – who would speak in his favor.
“He smote the Egyptian.” With what did he kill him? Rabbi Evyatar said: He struck him with a fist. Some say: He took a mortar rake and removed his brain. The Rabbis say: He invoked the name of God and killed him, as it is stated; “Do you propose [omer] to kill me [as you killed the Egyptian?]” (Exodus 2:14).
“He concealed him in the sand” as there was no one there other than Israelites. He concealed him before Israel, who were likened to sand. He said to them: ‘You were likened to sand; just as sand, a person takes it from here and places it there and no sound is heard, so too, this matter will remain concealed among you and will not be heard.’ Indeed, you find that the matter was heard only by means of the Hebrews, as it is stated: “He went out on the second day and behold, two Hebrew men were fighting [nitzim]; [he said to the wicked one: why do you strike your counterpart?]” (Exodus 2:13). These are Datan and Aviram, and it called them nitzim after their end.64“They are Datan and Aviram…who agitated [hitzu] against Moses…when they agitated [behatzotam] against the Lord” (Numbers 26:9). It was they who said this matter, it was they who left over some of the manna. It was they who said: “Let us appoint a leader and return to Egypt” (Numbers 14:4). And it was they who agitated at the Red Sea.
Alternatively, [they are called] nitzim because they intended to kill one another, as it is said: “If men fight together” (Deuteronomy 25:11), and Rabbi Elazar said: The verse is referring to a fight to the death.
“He said to the wicked one: Why do you strike your counterpart?” Why did you strike is not stated, but rather “why do you strike.” From here it is derived that from the moment that a person raises his hand against another, even if he does not strike him, he is called wicked. “Your counterpart,” who is wicked like you are; this teaches both of them were wicked.